gpt4 book ai didi

redis - 复制结束后,Redis slave 是如何保持同步的?

转载 作者:IT王子 更新时间:2023-10-29 06:04:35 26 4
gpt4 key购买 nike

Redis 的 replication在从站连接到主站时开始。但是在inital replication结束之后,slave是如何和master持续保持同步的呢?我找不到描述此机制的文档的任何部分。特别是,如何衡量主从之间的滞后?

最佳答案

在初始复制之后,master 将更改写入内部缓冲区并将它们发送给 slave。来自replication页:

The master will then send to the slave all buffered commands. This is done as a stream of commands and is in the same format of the Redis protocol itself.

你可以看看full replication source code (这指向 Redis 3.0 版)在 GitHub 上获取详细信息。

就延迟而言,有一个 page dedicated to latency troubleshootingone dedicated to latency monitoring .这两个页面包含大量的背景信息和技术来解决/测量 Redis 延迟。一个简单的起点是运行 redis-cli --latency -h 'host' -p 'port' 从 slave 到 master 和/或 master 到 slave。

关于redis - 复制结束后,Redis slave 是如何保持同步的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26239452/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com