2013-03-04 26 views
0

在REDIS DB上執行CRUD操作時,必須指定在對鍵/值進行操作時應用的數據庫。我想知道是否可以快照(堅持)某個特定數據庫的鍵/值而不是其他鍵?Redis DB,是否可以爲某些數據庫啓用快照但不能爲其他人啓用快照?

我喜歡使用一個數據庫來管理序列化設置,但另一個數據庫來存儲集合數據,這些數據也可以從R中訪問,但應該是嚴格內存和非持久的。

感謝

回答

2

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 "" 
1

沒有,當Redis的保存到磁盤上,它仍然存在,整個數據集到磁盤。此外,多數據庫配置已棄用,因此我建議不要依賴它。