Docker Community Forums

Share and learn in the Docker community.

Redis replication error: Master is currently unable to PSYNC but should be in the future

I am getting below error while configuring replication for redis containers in windows.

redis-secondary_1 | 1:S 15 Jun 2020 06:36:59.522 * Master is currently unable to PSYNC but should be in the future: -NOMASTERLINK Can’t SYNC while not connected with my master

I created both master and slave replicas with ports 6379 and 6380 ports respectively. Both containers are in the same server and when i run below command, it says completed. But, i cannot see any slaves connected to master. Can you please help?

In Slave:

127.0.0.1:6379> slaveof localhost 6379
OK
(3.23s)

In Master
127.0.0.1:6379> info replication

Replication

role:master
connected_slaves:0
master_replid:3ce591b2d9208101653bad29d10e2689b81b7b43
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
127.0.0.1:6379> info replication

Replication

role:master
connected_slaves:0
master_replid:3ce591b2d9208101653bad29d10e2689b81b7b43
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

It turn out that the problem is related to the used of host name instead of IP:

slaveof redis-master.fp8-cache 6379

slave-announce-ip redis-slave.fp8-cache
So, when the master came back as slave, sentinel shows that there are now 2 slaves: one with ip address and another with host name. Not sure exactly how does these 2 slave entries (that points to the same Redis server) cause the problem above. Now that I changed the config to use IP address instead of host name the Redis HA is working flawlessly.