1
我想將redis純粹用作緩存。爲確保如此,我必須在redis.conf中禁用哪些選項。我讀了默認情況下redis持久數據(AOF和rdb文件,也許更多)。即使設置爲過期的鍵也是如此。 是否堅持被設置爲過期的數據是矛盾的?將redis配置爲緩存
我想將redis純粹用作緩存。爲確保如此,我必須在redis.conf中禁用哪些選項。我讀了默認情況下redis持久數據(AOF和rdb文件,也許更多)。即使設置爲過期的鍵也是如此。 是否堅持被設置爲過期的數據是矛盾的?將redis配置爲緩存
Redis將其所有數據存儲在RAM中,但不時將其轉儲到持久存儲(HDD/SDD)。這個過程被稱爲快照。
你可以在your redis.conf
file配置快照的頻率(見SNAPSHOTTING
部分):
# 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 completely by commenting out all "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 ""
save 900 1
save 300 10
save 60 10000
所以,如果你想完全禁用快照,您應該刪除或redis.conf
文件發表評論所有save
指令。
確定最近,我偶然發現此 [鏈接] http://oldblog.antirez.com/post/redis-persistence-demystified.html 它說,「執行主當RDB快照還用於通過Redis的 - >從屬同步。「 因此,如果我禁用快照會阻止我的主從同步?! 也任何想法如何禁用AOF持久性,我試圖設置「appendonly」爲否,但我不知道如果這是足夠的。 除了快照和追加只有相關參數(在redis.conf中)還有其他我需要照顧的事情/參數嗎? – user2713255 2015-04-03 11:51:45
Redis使用快照執行**初始**同步。禁用RDB快照只會禁用自動快照,不會影響像'SYNC'(複製)或'BGSAVE'(手動快照)的命令。 – 2015-04-03 12:19:51
至於AOF,它應該足以將'appendonly'設置爲'no',儘管它在redis默認配置中沒有啓用。 – 2015-04-03 12:21:14