从库2:
- 127.0.0.1:6382> mget a b c d
- 1) "1"
- 2) "2"
- 3) "3"
- 4) "4"
关闭主库:
- 127.0.0.1:6379> shutdown
从库状态:
- 33570:S 26 Aug 2019 13:23:41.429 * Connecting to MASTER 127.0.0.1:6379
- 33570:S 26 Aug 2019 13:23:41.429 * MASTER <-> REPLICA sync started
- 33570:S 26 Aug 2019 13:23:41.429 # Error condition on socket for SYNC: Connection refused
- 33570:S 26 Aug 2019 13:23:42.441 * Connecting to MASTER 127.0.0.1:6379
- 33570:S 26 Aug 2019 13:23:42.442 * MASTER <-> REPLICA sync started
- 33570:S 26 Aug 2019 13:23:42.442 # Error condition on socket for SYNC: Connection refused
- 33570:S 26 Aug 2019 13:23:43.455 * Connecting to MASTER 127.0.0.1:6379
- 33570:S 26 Aug 2019 13:23:43.456 * MASTER <-> REPLICA sync started
- 33570:S 26 Aug 2019 13:23:43.456 # Error condition on socket for SYNC: Connection refused
- 33570:S 26 Aug 2019 13:23:44.466 * Connecting to MASTER 127.0.0.1:6379
- 33570:S 26 Aug 2019 13:23:44.466 * MASTER <-> REPLICA sync started
- 33570:S 26 Aug 2019 13:23:44.466 # Error condition on socket for SYNC: Connection refused
- 33570:S 26 Aug 2019 13:23:45.470 * Connecting to MASTER 127.0.0.1:6379
- 33570:S 26 Aug 2019 13:23:45.471 * MASTER <-> REPLICA sync started
- 33570:S 26 Aug 2019 13:23:45.471 # Error condition on socket for SYNC: Connection refused
- 33570:S 26 Aug 2019 13:23:46.474 * Connecting to MASTER 127.0.0.1:6379
- 33570:S 26 Aug 2019 13:23:46.475 * MASTER <-> REPLICA sync started
- 33570:S 26 Aug 2019 13:23:46.475 # Error condition on socket for SYNC: Connection refused
- 33570:S 26 Aug 2019 13:23:47.478 * Connecting to MASTER 127.0.0.1:6379
- 33570:S 26 Aug 2019 13:23:47.478 * MASTER <-> REPLICA sync started
- 33570:S 26 Aug 2019 13:23:47.478 # Error condition on socket for SYNC: Connection refused
- 33570:S 26 Aug 2019 13:23:48.481 * Connecting to MASTER 127.0.0.1:6379
- 33570:S 26 Aug 2019 13:23:48.481 * MASTER <-> REPLICA sync started
- 33570:S 26 Aug 2019 13:23:48.481 # Error condition on socket for SYNC: Connection refused
- 33570:S 26 Aug 2019 13:23:49.485 * Connecting to MASTER 127.0.0.1:6379
- 33570:S 26 Aug 2019 13:23:49.485 * MASTER <-> REPLICA sync started
- 33570:S 26 Aug 2019 13:23:49.485 # Error condition on socket for SYNC: Connection refused
- 33570:S 26 Aug 2019 13:23:50.488 * Connecting to MASTER 127.0.0.1:6379
从库开始检测主库的连接,发送sync请求
重启主库:
- 34781:M 26 Aug 2019 13:24:05.899 * DB loaded from disk: 0.000 seconds
- 34781:M 26 Aug 2019 13:24:05.899 * Ready to accept connections
- 34781:M 26 Aug 2019 13:24:06.544 * Replica 127.0.0.1:6380 asks for synchronization
- 34781:M 26 Aug 2019 13:24:06.544 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for 'b9e0f41a523e078a6a88ae274f204777775ab4dc', my replication IDs are 'aac4a31754592820422c3ba7c8244f31c39f067f' and '0000000000000000000000000000000000000000')
- 34781:M 26 Aug 2019 13:24:06.544 * Starting BGSAVE for SYNC with target: disk
- 34781:M 26 Aug 2019 13:24:06.545 * Background saving started by pid 34785
- 34785:C 26 Aug 2019 13:24:06.555 * DB saved on disk
- 34785:C 26 Aug 2019 13:24:06.555 * RDB: 4 MB of memory used by copy-on-write
- 34781:M 26 Aug 2019 13:24:06.601 * Background saving terminated with success
- 34781:M 26 Aug 2019 13:24:06.602 * Synchronization with replica 127.0.0.1:6380 succeeded
- 34781:M 26 Aug 2019 13:24:06.642 * Replica 127.0.0.1:6382 asks for synchronization
- 34781:M 26 Aug 2019 13:24:06.642 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for 'b9e0f41a523e078a6a88ae274f204777775ab4dc', my replication IDs are 'd41f950be7593a93620b1fd872b7552668f0b355' and '0000000000000000000000000000000000000000')
- 34781:M 26 Aug 2019 13:24:06.642 * Starting BGSAVE for SYNC with target: disk
- 34781:M 26 Aug 2019 13:24:06.643 * Background saving started by pid 34786
- 34786:C 26 Aug 2019 13:24:06.644 * DB saved on disk
- 34786:C 26 Aug 2019 13:24:06.644 * RDB: 4 MB of memory used by copy-on-write
- 34781:M 26 Aug 2019 13:24:06.701 * Background saving terminated with success
- 34781:M 26 Aug 2019 13:24:06.701 * Synchronization with replica 127.0.0.1:6382 succeeded
重启主数据库后,开始向两个发送同步数据,建立连接
(编辑:ASP站长网)
|