2015-09-22 54 views
0

我是Redis的新手,我試圖刪除Ram上的一個鍵,但它已經存在於磁盤上的啞文件中。重新啓動服務器後,Ram上的密鑰已存在。請幫幫我。如何在RAM和磁盤之間同步數據?如何刪除磁盤上的Redis密鑰?

+0

請幫助我,我不知道爲什麼它不工作。 這裏是我的配置文件 - redis.windows-service.conf(http://www.mediafire.com/view/89o0ff9df8bb0bb/redis.windows-service.conf) 和redis.windows.conf(http:// www .mediafire.com/view/3rhdxkdo9i1l6l8/redis.windows%282%29.conf) – Ducthien

回答

1

取決於您的配置文件,您可以修改您redis config file,如

appendonly yes 
appendfsync always 
# appendfsync everysec 
# append 

希望幫助。

+0

我只是配置,如你建議,但它不工作。 請幫助我,下面是我的配置文件。它有什麼不對嗎? [鏈接文件配置](http://www.mediafire.com/view/k03ckybn2yvb6j2/redis.windows.conf) – Ducthien

+0

redis-server Javy

+0

我附加的文件是。你能幫我找到任何我配置錯誤的東西嗎? – Ducthien

1
appendonly yes 
appendfsync always 
# appendfsync everysec 
# append 

做到像上面所說Javy肯定是要去幫助,這使AOF和RAM確保數據同步到磁盤上的每一秒。 另一種方法是發出一個BGSAVE命令來立即產生一個新的dump.rdb文件。我認爲你應該修改自動轉儲執行的頻率。這是在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 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 "" 

如果您DONOT知道如何更改配置文件,按照指定的順序鍵入以下命令:

config set appendonly yes 
config set appendonly everysec 
config rewrite 

如果有什麼不清楚的地方,請隨時回覆。

+0

我只是配置如你建議的,但它不工作。請幫助我,下面是我的配置文件。它有什麼不對嗎? [鏈接文件配置](http://www.mediafire.com/view/k03ckybn2yvb6j2/redis.windows.conf) – Ducthien

+0

你的conf文件是可以的,但你可能會改變「appendfsync總是 」到「appendfsync everysec」到使您的Redis運行得更快。 –

+0

我認爲問題可能在於如何重新啓動您的Redis服務器。你能告訴我你用來重新啓動你的redis的確切命令嗎? –