redis 客户端:
[root@localhost ~]# rcli -h 192.168.0.96
192.168.0.96:6379> info replication
role:slave //角色显示slave,而不是master , bind:0.0.0.0
master_host:192.168.0.96
master_port:6379
master_link_status:down
master_last_io_sec1. onds_ago:-1
master_sync_in_progress:0
slave_repl_offset:1
master_link_down_since_seconds:1607254967
slave_priority:100
slave_read_only:1
connected_slaves:0 //从节点连接个数零
master_replid:292a51893f06102926d2b2deb1e62ae99c0b5f31
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
Redis启动服务提示: redis-server
2836:S 06 Dec 2020 19:49:55.902 * Connecting to MASTER 192.168.0.96:6379
2836:S 06 Dec 2020 19:49:55.902 * MASTER <-> REPLICA sync started
2836:S 06 Dec 2020 19:49:55.902 * Non blocking connect for SYNC fired the event.
2836:S 06 Dec 2020 19:49:55.902 * Master replied to PING, replication can continue...
2836:S 06 Dec 2020 19:49:55.902 * Partial resynchronization not possible (no cached master)
2836:S 06 Dec 2020 19:49:55.902 * Master is currently unable to PSYNC but should be in the future: -NOMASTERLINK Can't SYNC while not connected with my master
这个问题,有两个可能性
1、你的主服务器自定义了密码,那么从服务器在连接时要指定主服务器的密码;
2、主服务器设置成了 slave 模式(从服务器),登录客户端,用 slaveof no one 命令改回来。
参考https://lawsssscat.blog.csdn.net/article/details/105141410