Redis从节点启动时的加载顺序
若是redis开启了rdb持久化,redis备节点在重启时,会先加载本地的rdb持久化文件,然后再发起主备同步,相关日志如下:
11748:S 26 Aug 10:35:08.976 * DB loaded from disk: 0.000 seconds 11748:S 26 Aug 10:35:08.976 * The server is now ready to accept connections on port 7400 11748:S 26 Aug 10:35:09.975 * Connecting to MASTER 192.168.161.89:7200 11748:S 26 Aug 10:35:09.975 * MASTER <-> SLAVE sync started 11748:S 26 Aug 10:35:09.976 * Non blocking connect for SYNC fired the event. 11748:S 26 Aug 10:35:09.976 * Master replied to PING, replication can continue... 11748:S 26 Aug 10:35:09.976 * Partial resynchronization not possible (no cached master) 11748:S 26 Aug 10:35:09.980 * Full resync from master: 01021a470914a1fd7bf2e739507b528bfa75eed5:1 11748:S 26 Aug 10:35:10.212 * MASTER <-> SLAVE sync: receiving 4577 bytes from master 11748:S 26 Aug 10:35:10.212 * MASTER <-> SLAVE sync: Flushing old data 11748:S 26 Aug 10:35:10.212 * MASTER <-> SLAVE sync: Loading DB in memory 11748:S 26 Aug 10:35:10.213 * MASTER <-> SLAVE sync: Finished with success
若是redis开启了aof持久化,redis备节点在重启时,会先加载本地的aof持久化文件,然后再发起主备同步,相关日志如下:
13403:S 26 Aug 10:45:31.175 * DB loaded from append only file: 0.001 seconds 13403:S 26 Aug 10:45:31.175 * The server is now ready to accept connections on port 7400 13403:S 26 Aug 10:45:32.174 * Connecting to MASTER 192.168.161.89:7200 13403:S 26 Aug 10:45:32.174 * MASTER <-> SLAVE sync started 13403:S 26 Aug 10:45:32.174 # Error condition on socket for SYNC: Connection refused
注意:在同时开启rdb和aof持久化时,重启时只会加载aof持久化文件,不会加载rdb持久化文件。
下一篇:
Linux下安装MySql详细教程