Redis disable persistence – How we do it easily?
Are you trying to disable persistence in Redis? We can help you with it.
Redis persistence allows us to log every change in the dataset. However, due to disk space shortage, some users may need to disable persistence in Redis.
At Bobcares, we often receive requests to disable it as part of our Server Management Services.
Today, let us discuss how our Support Engineers disable Redis persistence easily for our customers.
A quick look at Redis data persistence
As we all know, Redis is a key-value store that also functions as a database, cache and a message broker.
Moreover, Redis is an in-memory database. So, the data in the RAM is lost once the process has been stopped.
Therefore, data persistence is important in Redis. If we store this data to disk, then we can back it up to a remote location in the case of failure.
And, Redis cloud provides two methods to persist the data to disk. They are Append Only File (AOF) and Snapshot (RDB).
How we disable persistence?
Snapshot or RDB takes the data at that moment and writes it to the disk, in a binary file called dump.rdb.
On the other hand, AOF writes all the incoming “write” commands to the disk. Data persistence is optional and we can disable it too.
Though persistence prevents data loss, it increases the disk space usage abundantly. So, in cases where we cant persist large data on disk, we disable persistence.
Recently, one of our customers approached us to disable it. Our Support Engineers followed the below steps to disable it easily.
1. Firstly, we disable the AOF. To do so, we edit the /etc/redis/redis.conf file and set the appendonly directive to NO. Mostly, this will be the default value.
2. Then, we disable RDB snapshotting. And, there are three default configurations defined in the save directive.
We need to disable these three configurations to disable RDB. So, we use the below command to get the default configurations.
Then, to disable the save configuration, we use the command,
config set save ""
Finally, we restart the Redis server. Then, we can confirm the new configuration as below.
Then, if we scan the redis.conf file, we get no results for the save configurations.
Similarly, we can also use the below command to disable RDB snapshotting.
sed -e '/save/ s/^#*/#/' -i /etc/redis/redis.conf && sudo service redis-server restart
This command will comment out the save configurations in the /etc/redis/redis.conf file and restart the Redis server.
[Need more assistance to disable Redis persistence? – We’re available 24/7 to help you.]
In today’s writeup, we saw how our Support Engineers disable persistence in Redis.