我正在使用带有 aof 的 Redis 2.6.14。重写后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,而是很小。原因是我在测试程序中的错误。