Matt
Matt

Reputation: 7254

Redis DB, is it possible to enable snapshotting for certain databases but not for others?

When performing CRUD operations on a REDIS DB one has to specify the database that is applied when operating on key/values. I wonder whether it is possibly to snapshot (persist) key/values of a certain specified database but not for others?

I like to use one database for the management of serialized settings, but another database to store collection data that will also be accessed from within R but that are supposed to be strictly in-memory and non-persisted.

Thanks

Upvotes: 0

Views: 232

Answers (2)

FGRibreau
FGRibreau

Reputation: 7239

TL:DR; You can't enable snapshotting for one database and not for the others.

The best thing to do in that case (when dealing with multiple workflow) is to spawn 2 redis server with their own configuration.

You will be then able to setup one Redis Server without durability (strictly in-memory) (save "") and another one with fine grained durability depending on your write usage.

See Redis-conf:

################################ SNAPSHOTTING  #################################
#
# Save the DB on disk:
#
#   save <seconds> <changes>
#
#   Will save the DB if both the given number of seconds and the given
#   number of write operations against the DB occurred.
#
#   In the example below the behaviour will be to save:
#   after 900 sec (15 min) if at least 1 key changed
#   after 300 sec (5 min) if at least 10 keys changed
#   after 60 sec if at least 10000 keys changed
#
#   Note: you can disable saving at all commenting all the "save" lines.
#
#   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 ""

Upvotes: 2

The Real Bill
The Real Bill

Reputation: 15773

No, when redis persists to disk, it persists the entire data set to disk. Further, the multi-db configuration is deprecated so I would recommend not relying on it.

Upvotes: 1

Related Questions