I was wondering how to disable presistence in redis. There is mention of the possibility of doing this here: http://redis.io/topics/persistence. I mean it in the exact same sense as described there. Any help would be very much appreciated!
-
I found it surprising, if not annoying, that there's no instructions on the official website on this nor there's a lot of information on internet about this (See that https://stackoverflow.com/questions/19581059/misconf-redis-is-configured-to-save-rdb-snapshots has much more votes and is better documented than this). Overall considering that Redis is often used as a non-persistent database. – Akronix Aug 23 '18 at 13:51
4 Answers
To disable all data persistence in Redis do the following in the redis.conf
file:
Disable AOF by setting the
appendonly
configuration directive tono
(it is the default value). like this:appendonly no
Disable RDB snapshotting by commenting all of the
save
configuration directives (there are 3 that are defined by default) and explicitly disabling saving:#save 900 1 #save 300 10 #save 60 10000 save ""
After change, make sure you restart Redis to apply them.
Alternatively, you can use the CONFIG SET
command to apply these changes during runtime (just make sure you also do a CONFIG REWRITE
to persist the changes).
Note: depending on your Redis' version, there are other tweaks that prevent Redis from accessing the disk for replication-related tasks.

- 17,381
- 6
- 41
- 47

- 47,336
- 7
- 91
- 117
-
1
-
3I have configured my Redis to not save data to disk by commenting out the three `save` directives. I can see that it no longer periodically snapshots the data. However, I am still seeing a .rdb file written to disk whenever I shutdown my server. Could it be created anyway, perhaps due to the failover process? – Jolta Aug 03 '17 at 14:02
-
1To actually make this effective, you could use the commands listed here to do it via cli: https://stackoverflow.com/a/34736871/2904315 Or you could just change the redis.conf file as explained in this answer and then restart the service with: `systemctl restart redis` – Akronix Aug 23 '18 at 13:41
-
1In linux, the `redis.conf` file located in `/etc/redis/redis.conf` – Amin Shojaei Aug 09 '20 at 13:34
-
Also don't forget to delete any existing `*.rdb` files created by default config. E.g. in my case after commenting `save` lines, I also had to delete `/var/lib/redis/dump.rdb` before reboot. – AneesAhmed777 Feb 01 '21 at 08:58
If you want to avoid playing with redis.conf
(dev/test environments), you can do it through the command line with
redis-server --save "" --appendonly no
(tested with redis server 3.2.6
and 5.0.5
)

- 1,593
- 15
- 16
-
3Are you sure the `--appendonly no` is necessary? Isn't it off by default? – aleclarson Feb 09 '18 at 01:38
-
7Could be true. But it certainly doesn't hurt to add it there, just to be on the safe side, what we want is to disable all types of persistence ;) – Kostis Feb 10 '18 at 02:24
-
-
@JamesGentes what's the error. It works in my Fedora 29 with Redis 5.0.3, tested it now. Perhaps you need to pass the arguments in a different way in Windows? What's the Redis version? `redis-server --help` could perhaps give some insight – Kostis Feb 13 '19 at 20:48
-
Hi @Kostis, it's redis 3.0.6 :-/ which may be why. But I was able to just run the separate config commands to get it working, so no biggie. Thx for the follow up on a 2yr old solution :) – James Gentes Feb 14 '19 at 00:56
-
ah yes, the version must be the issue. No worries, i opened SO and your message popped up :) – Kostis Feb 14 '19 at 18:09
-
1
As AOF (appendonly) is disabled by default, there is only one thing that is to be done for disabling persistence without redis service restart is to disable save configuration.
For disabling it on runtime and verifying run below commands
Check current save configuration
pawan@devops:~$ redis-cli config get save
1) "save"
2) "900 1 300 10 60 10000"
Same setting will be present in redis.conf file as well
pawan@devops:~$ grep -w 'save' /etc/redis/redis.conf | grep -v '#'
save 900 1
save 300 10
save 60 10000
Disable save configuration
pawan@devops:~$ redis-cli config set save ""
OK
Modify redis.conf file with the new save configuration so that the configuration remains permanent on redis service restarts
root@ip-172-16-3-114:~# redis-cli config rewrite
OK
Confirm the new save configuration
pawan@devops:~$ redis-cli config get save
1) "save"
2) ""
Now if you will scan the redis.conf file for save configuration there won't be any results
pawan@devops:~$ grep -w 'save' /etc/redis/redis.conf | grep -v '#'
pawan@devops:~$

- 511
- 5
- 4
For RDB snapshotting you can disable it by using
$ sed -e '/save/ s/^#*/#/' -i /etc/redis/redis.conf && sudo service redis-server restart
It will comment the save lines in redis.conf and restarts the redis-server

- 7,273
- 2
- 29
- 23