我在aof上使用Redis 2.6.14。重寫後aof文件的大小變爲0M,我無法理解這一點。給我一些幫助,PLZ。下面是日誌:爲什麼redis aof將0M重寫到磁盤?
# Server started, Redis version 2.6.14
* The server is now ready to accept connections on port 7379
* Starting automatic rewriting of AOF on 2098226700% growth
* Background append only file rewriting started by pid 7961
* SYNC append only file rewrite performed
* AOF rewrite: 0 MB of memory used by copy-on-write
* Background AOF rewrite terminated with success
* Parent diff successfully flushed to the rewritten AOF (94778 bytes)
* Background AOF rewrite finished successfully
我覺得「AOF重寫:0 MB的內存寫入時複製使用」的關鍵是,誰將會解釋呢?
我得到了這樣的答案:
1.edit the redis.conf, set the loglevel to debug.
2.I found that the keys is only 32, so it is the problem of my test program.
3.I modified the test program, make keys unique. When the program runs again, the keys in reids increase rapidly, and the aof file increase too.
4.when the rewrite is triggered, write 2M bytes into aof file instead of 0M.
的結論是:重寫AOF字節大小是不是真的0,但非常小。原因是我的測試程序錯誤。
我認爲它應該是重寫時所有數據的大小。 – zhmt
不,它只是表示COW複製數據的大小(通常遠離所有數據的大小)。 –
我明白了,謝謝。 – zhmt