Redis 从站无法连接到 Redis 主站。 我们在 Azure 服务器上安装了 redis。
以下是redis日志,
Connecting to MASTER MasterIP:6379
* MASTER <-> SLAVE sync started
* Non blocking connect for SYNC fired the event.
* Master replied to PING, replication can continue...
* Partial resynchronization not possible (no cached master)
* Master does not support PSYNC or is in error state (reply: -ERR Can't SYNC while not connected with my
* Retrying with SYNC...
# MASTER aborted replication with an error: ERR Can't SYNC while not connected with my master
同时找到master redis连接恰好在slave连接丢失的时间,
* Background saving terminated with success
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
# Connection with slave IP:6379 lost.
* SLAVE OF **UNKNOWN IP**:8888 enabled (user request)
* Connecting to MASTER **UNKNOW IP**:8888
* MASTER <-> SLAVE sync started
* Non blocking connect for SYNC fired the event.
* Master replied to PING, replication can continue...
# Unable to AUTH to MASTER: -Reading from master: Connection timed out
这里,master会自动尝试连接到一些未知的IP。
如何进一步调试?
最佳答案
# Replication
role:slave
master_host:xxx.xx.xx.xxx
master_port:xxxx
master_link_status:up
master_last_io_seconds_ago:6
master_sync_in_progress:0
- 使用命令“info”检查redis Slave的复制状态,确保角色为Slave
- 检查master_link_status是否开启,如果关闭,可能有两个原因:
(1) 尝试与 MASTER 同步时出现 I/O 错误:连接丢失
使用config set client-output-buffer-limit 'slave 512mb 128mb 120' 更改缓冲区限制
( client-output-buffer-limit )或更改配置文件
(2) 无法对 MASTER 进行 AUTH:-ERR 客户端已发送 AUTH,但未设置密码
如果不正确,请更改密码
关于azure - REDIS Slave无法连接Master,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59505367/