How can I make redis-server flushes all data when it restarts?

configuration, persistence, recovery, redis

Solution

Look in the redis.conf file that you are using:

#   It is also possible to remove all the previously configured save
#   points by adding a save directive with a single empty string argument
#   like in the following example:
#
#   save ""

Stop redis-server, configure it as stated above, throw away the .rdb file, and start redis-server.

From now on, on every restart, redis-server will start with no data. Plus, no automatic snapshotting will happen at all.

Note: I presume here that you have not configured AOF. If that's the case, the solution is similar to the method mentioned above.

Hope this helps, TW

Problem

I am studying redis. I got local redis-server(localhost) and access with terminal in same device. Since I heard that redis is memory-database, I expect all data gone when I shutdown the server. However, When I command `"shudown"/"exit"` in redis-cli and restart, data still alive. I think there is an option to control this, but I can not find. Would you let me know where to find and what has to be changed?

Original source