问题描述
我遇到了无法弄清楚的 redis 复制问题.Master 不断达到客户端输出缓冲区限制.
I am having a problem with redis replication that I can not figure out. Master keeps hitting the client-output-buffer-limit.
主配置:
# redis-cli -p 6380 config get client-output-buffer-limit
1) "client-output-buffer-limit"
2) "normal 0 0 0 slave 536870912 536870912 0 pubsub 33554432 8388608 60"
主日志:
Client id=3014598 addr={{MASTER}} fd=6 name= age=217 idle=217 flags=S db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=3723 oll=4806 omem=581952061 events=rw cmd=psync scheduled to be closed ASAP for overcoming of output buffer limits.
主信息:
# redis-cli -p 6380 info
role:master
connected_slaves:1
slave0:ip={{SLAVE_IP}},port=6380,state=wait_bgsave,offset=0,lag=0 // stays on wait_bgsave
从属信息:
role:slave
master_host:{{MASTER_IP}}
master_port:6380
master_link_status:down
master_last_io_seconds_ago:-1
master_sync_in_progress:1
Redis 版本:3.0.2
Redis version: 3.0.2
数据库大小:~21GBMaster 是一个 30GB Ram EC2 实例Slave 是一个 60GB Ram EC2 实例
Database size: ~21GBMaster is a 30GB Ram EC2 instanceSlave is a 60GB Ram EC2 instance
从站正在连接,但是无论我将缓冲区设置得有多高,主站总是超时.master 几乎总是处于 wait_bgsave 状态.
The slave is connecting, however the master always times-out no matter how high I set the buffers. The master is almost always in the wait_bgsave state.
任何人都可以提供有关为什么会发生这种情况的任何见解吗?
Can anybody provide any insight into why this might be happening?
推荐答案
尝试为复制创建 RDB 转储文件时可能会出现问题.它可能没有足够的可用 RAM 来创建文件,或者可能存在一个问题,从属设备无法足够快地读取传入数据,因此它断开连接.
您可以通过在 redis-cli 上发出 bgsave 来检查它是否成功,还可以检查 redis.conf 用于客户端输出缓冲区限制部分.对于解决方法,您可以尝试新的 无盘复制,它可能需要更少的 RAM它(即使我从未发现任何文档这么说).
It might be a problem when trying to create the RDB dump file for the replication. It might not have enough RAM available to create the file or maybe there is a peoblem with the slave not being able to read the incoming data fast enough so it gets disconnected.
You can check that by issuing a bgsave on redis-cli and see if it is succesful and also check the redis.conf for the client-output-buffer-limit part. And for a workaround you can try the new diskless replication, it might need less RAM to do it (even though I never found any docs saying that).
这篇关于Redis 复制和客户端输出缓冲区限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!