Redis DB,是否有可能对某些数据库启用快照,而对其他数据库不启用快照?



在REDIS数据库上执行CRUD操作时,必须指定在操作键/值时应用的数据库。我想知道是否有可能快照(持久化)某个指定数据库的键/值,但不适合其他人?

我喜欢使用一个数据库来管理序列化设置,但另一个数据库来存储集合数据,这些数据也将从R中访问,但应该严格地在内存中并且非持久化。

谢谢

TL:DR;您不能为一个数据库启用快照而不为其他数据库启用快照。

在这种情况下(当处理多个工作流时)最好的做法是生成2个redis服务器,并使用它们自己的配置。

你将能够设置一个没有持久性(严格在内存中)(save "")和另一个具有细粒度持久性的Redis服务器,这取决于你的写使用。

看到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 ""

不,当redis持久化到磁盘时,它会将整个数据集持久化到磁盘。此外,多数据库配置已被弃用,因此我建议不要依赖它。

最新更新