database - Redis DB,是否可以为某些数据库启用快照而不为其他数据库启用快照?

标签 database serialization redis persistence

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

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

谢谢

最佳答案

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

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

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

参见 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 ""

关于database - Redis DB,是否可以为某些数据库启用快照而不为其他数据库启用快照?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15194727/

相关文章:

SQL Server - SQL 级联更改列的数据类型

C# XML 同一元素多次出现

python - Celery 无法连接到哨兵 : No master found for 'mymaster'

python - 如何使用函数运行脚本? (反复)

ruby-on-rails - Rails 表单未将输入保存到数据库

java - 我是否应该预期 Java 序列化最终会被放弃?

django - 在我的 Django 应用程序中使用 Celery 和 Redis

mysql - 用于创建用户段的最佳数据库结构

sql - 如何找出数据库上的 sql 查询所需的临时空间?

c# - 如何在C#中序列化一个对象并防止被篡改?