我有一个Redis集群,拥有3个主站和3个从站。 我可以将数据添加到群集并获取数据,没有问题。
数据保存到主节点时就会出现问题。 一段时间后,主设备将自行重启(请参见下面的输出),然后其所保存的数据将会丢失。 如果集群决定使用一个从机来存储数据,那么数据将被保存直到达到ttl。
发生重启时,日志中的输出如下所示:
30580:signal-handler (1479922724) Received SIGTERM scheduling shutdown... 30580:M 23 Nov 17:38:44.544 # User requested shutdown... 30580:M 23 Nov 17:38:44.545 * Calling fsync() on the AOF file. 30580:M 23 Nov 17:38:44.545 * Saving the final RDB snapshot before exiting. 30580:M 23 Nov 17:38:44.567 * DB saved on disk 30580:M 23 Nov 17:38:44.567 * Removing the pid file. 30580:M 23 Nov 17:38:44.567 # Redis is now ready to exit, bye bye... 30636:M 23 Nov 17:38:44.783 * Increased maximum number of open files to 10032 (it was originally set to 1024). 17513:M 23 Nov 17:31:10.552 * Node configuration loaded, I'm cd698d5a4350c161930b40c52f71e1fabeac549d <%insert_logo_and_pid_here%> 17513:M 23 Nov 17:31:10.553 # Server started, Redis version 3.2.4 17513:M 23 Nov 17:31:10.553 * The server is now ready to accept connections on port 6379 17513:M 23 Nov 17:31:11.404 * Slave <%ip%>:6379 asks for synchronization 17513:M 23 Nov 17:31:11.404 * Full resync requested by slave <%ip%>:6379 17513:M 23 Nov 17:31:11.404 * Starting BGSAVE for SYNC with target: disk 17513:M 23 Nov 17:31:11.405 * Background saving started by pid 17518 17518:C 23 Nov 17:31:11.418 * DB saved on disk 17518:C 23 Nov 17:31:11.418 * RDB: 0 MB of memory used by copy-on-write 17513:M 23 Nov 17:31:11.455 * Background saving terminated with success 17513:M 23 Nov 17:31:11.455 * Synchronization with slave <%ip%>:6379 succeeded 17513:M 23 Nov 17:31:12.557 # Cluster state changed: ok
我不确定这是否是杀了它,或者它是保存和重新启动? 我可以看到有sigterm和用户请求关机,但我没有做任何这样的事情。
另外,你眼中的鹰会注意到行号的差异,这是因为我从不同的Redis实例复制它,不能打扰改变它。
它运行的服务器是Centos 7,Redis 3.2.4版本。
任何帮助将不胜感激,在此先感谢。
看了很多文章说,在Centos 7 daemonize yes需要被注释掉,我终于试图把它留下是的。 这立即解决了问题,不再重新启动redis实例。