设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 创业者 数据 手机
当前位置: 首页 > 站长学院 > MySql教程 > 正文

一文带你揭开Redis复制原理的神秘面纱(8)

发布时间:2019-09-17 08:52 所属栏目:115 来源:陈龙
导读:从库2: 127.0.0.1:6382mgetabcd 1)1 2)2 3)3 4)4 关闭主库: 127.0.0.1:6379shutdown 从库状态: 33570:S26Aug201913:23:41.429*ConnectingtoMASTER127.0.0.1:6379 33570:S26Aug201913:23:41.429*MASTER-REPLICAsy

从库2:

  1. 127.0.0.1:6382> mget a b c d 
  2. 1) "1" 
  3. 2) "2" 
  4. 3) "3" 
  5. 4) "4" 

关闭主库:

  1. 127.0.0.1:6379> shutdown 

从库状态:

  1. 33570:S 26 Aug 2019 13:23:41.429 * Connecting to MASTER 127.0.0.1:6379 
  2. 33570:S 26 Aug 2019 13:23:41.429 * MASTER <-> REPLICA sync started 
  3. 33570:S 26 Aug 2019 13:23:41.429 # Error condition on socket for SYNC: Connection refused 
  4. 33570:S 26 Aug 2019 13:23:42.441 * Connecting to MASTER 127.0.0.1:6379 
  5. 33570:S 26 Aug 2019 13:23:42.442 * MASTER <-> REPLICA sync started 
  6. 33570:S 26 Aug 2019 13:23:42.442 # Error condition on socket for SYNC: Connection refused 
  7. 33570:S 26 Aug 2019 13:23:43.455 * Connecting to MASTER 127.0.0.1:6379 
  8. 33570:S 26 Aug 2019 13:23:43.456 * MASTER <-> REPLICA sync started 
  9. 33570:S 26 Aug 2019 13:23:43.456 # Error condition on socket for SYNC: Connection refused 
  10. 33570:S 26 Aug 2019 13:23:44.466 * Connecting to MASTER 127.0.0.1:6379 
  11. 33570:S 26 Aug 2019 13:23:44.466 * MASTER <-> REPLICA sync started 
  12. 33570:S 26 Aug 2019 13:23:44.466 # Error condition on socket for SYNC: Connection refused 
  13. 33570:S 26 Aug 2019 13:23:45.470 * Connecting to MASTER 127.0.0.1:6379 
  14. 33570:S 26 Aug 2019 13:23:45.471 * MASTER <-> REPLICA sync started 
  15. 33570:S 26 Aug 2019 13:23:45.471 # Error condition on socket for SYNC: Connection refused 
  16. 33570:S 26 Aug 2019 13:23:46.474 * Connecting to MASTER 127.0.0.1:6379 
  17. 33570:S 26 Aug 2019 13:23:46.475 * MASTER <-> REPLICA sync started 
  18. 33570:S 26 Aug 2019 13:23:46.475 # Error condition on socket for SYNC: Connection refused 
  19. 33570:S 26 Aug 2019 13:23:47.478 * Connecting to MASTER 127.0.0.1:6379 
  20. 33570:S 26 Aug 2019 13:23:47.478 * MASTER <-> REPLICA sync started 
  21. 33570:S 26 Aug 2019 13:23:47.478 # Error condition on socket for SYNC: Connection refused 
  22. 33570:S 26 Aug 2019 13:23:48.481 * Connecting to MASTER 127.0.0.1:6379 
  23. 33570:S 26 Aug 2019 13:23:48.481 * MASTER <-> REPLICA sync started 
  24. 33570:S 26 Aug 2019 13:23:48.481 # Error condition on socket for SYNC: Connection refused 
  25. 33570:S 26 Aug 2019 13:23:49.485 * Connecting to MASTER 127.0.0.1:6379 
  26. 33570:S 26 Aug 2019 13:23:49.485 * MASTER <-> REPLICA sync started 
  27. 33570:S 26 Aug 2019 13:23:49.485 # Error condition on socket for SYNC: Connection refused 
  28. 33570:S 26 Aug 2019 13:23:50.488 * Connecting to MASTER 127.0.0.1:6379 

从库开始检测主库的连接,发送sync请求

重启主库:

  1. 34781:M 26 Aug 2019 13:24:05.899 * DB loaded from disk: 0.000 seconds 
  2. 34781:M 26 Aug 2019 13:24:05.899 * Ready to accept connections 
  3. 34781:M 26 Aug 2019 13:24:06.544 * Replica 127.0.0.1:6380 asks for synchronization 
  4. 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') 
  5. 34781:M 26 Aug 2019 13:24:06.544 * Starting BGSAVE for SYNC with target: disk 
  6. 34781:M 26 Aug 2019 13:24:06.545 * Background saving started by pid 34785 
  7. 34785:C 26 Aug 2019 13:24:06.555 * DB saved on disk 
  8. 34785:C 26 Aug 2019 13:24:06.555 * RDB: 4 MB of memory used by copy-on-write 
  9. 34781:M 26 Aug 2019 13:24:06.601 * Background saving terminated with success 
  10. 34781:M 26 Aug 2019 13:24:06.602 * Synchronization with replica 127.0.0.1:6380 succeeded 
  11. 34781:M 26 Aug 2019 13:24:06.642 * Replica 127.0.0.1:6382 asks for synchronization 
  12. 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') 
  13. 34781:M 26 Aug 2019 13:24:06.642 * Starting BGSAVE for SYNC with target: disk 
  14. 34781:M 26 Aug 2019 13:24:06.643 * Background saving started by pid 34786 
  15. 34786:C 26 Aug 2019 13:24:06.644 * DB saved on disk 
  16. 34786:C 26 Aug 2019 13:24:06.644 * RDB: 4 MB of memory used by copy-on-write 
  17. 34781:M 26 Aug 2019 13:24:06.701 * Background saving terminated with success 
  18. 34781:M 26 Aug 2019 13:24:06.701 * Synchronization with replica 127.0.0.1:6382 succeeded 

重启主数据库后,开始向两个发送同步数据,建立连接

(编辑:ASP站长网)

网友评论
推荐文章
    热点阅读