当前位置:网站首页>Redis master-slave synchronization mechanism

Redis master-slave synchronization mechanism

2022-07-24 00:19:00 A little dog





Redis Master slave synchronization mechanism

 Insert picture description here

Copy in full

stay slave From the service initialization stage , Need to put master All replicates on the master server are replicated , technological process :

  • Connect from the slave server to the master server , And send the psync command
  • The master server received psync After the command , perform bgsave Command to generate RDB file , And record all subsequent recording operations in the buffer
  • master After execution bgsave after ,master take RDB The document is sent to slave, And continue to write in the buffer during this stage
  • slave On receiving RDB Before document , Will discard all its own data , load RDB
  • master sent , Will send to slave Buffer send of Write execute command
  • slave Finish right RDB Loading of , Start accepting command requests , And execute the command of buffer

Incremental replication

stay slave After initialization and normal operation ,master The writes that occur will be synchronized to slave On

For incremental replication, only the data in the squeeze buffer is copied , If the master-slave node offset Gap is too large , It may lead to the need to use full replication .






Please correct me if there is any mistake

原网站

版权声明
本文为[A little dog]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/205/202207240014083837.html