Reputation: 29421
Is there any way to check, from an active session, whether a Redis server has persistence (e.g. RDB persistence) enabled? The INFO command does contain a section on persistence, but it is not clear to me whether the values indicate that persistence is turned on.
Upvotes: 11
Views: 6972
Reputation: 1991
There are two type of persistance, RDB and AOF.
redis-cli CONFIG GET save
RDB persistence enabled if it return something like that:1) "save" 2) "900 1 300 10 60 10000"
RDB persistence disabled if you get empty result:
1) "save" 2) ""
To check is AOF persistence enabled, invoke:
redis-cli CONFIG GET appendonly
If you get yes
- it's enabled, no
- disabled.
Upvotes: 18
Reputation: 49932
INFO
is one way, but you can also use CONFIG GET
for save
and appendonly
to check if persistence is enabled.
As for using INFO
's output to understand your persistency settings, this is a little trickier. For AOF, simply check the value of aof_enabled
under the Persistence section of INFO
's output - 0
means that it's disabled. RDB files, OTOH, are used both for snapshotting and backups so INFO
is less helpful in that context. If you know that no SAVE
/BGSAVE
commands have been issued to your instances, periodic changes to the value of rdb_last_save_time
will indicate that the save
configuration directive is used.
Upvotes: 6