The redis slave won't sync with the master.
I can connect to the master when I issue
HOST_NAME=fakehost redis-cli -h $HOST_NAME
and check the master status using a command like INFO
, so connectivity is not an issue.
From the slave box, I issued
SLAVEOF $HOST_NAME 6379
And received an OK
.
When I issue the INFO
command on the slave, I get
# Replication role:slave master_host:<removed> master_port:6379 master_link_status:down master_last_io_seconds_ago:-1 master_sync_in_progress:0 master_link_down_since_seconds:1379450797 slave_priority:100 slave_read_only:1 connected_slaves:0
On the master box, I issue info
and get
# Replication role:master connected_slaves:0
So obviously I'm not connected.
[11225] 17 Sep 14:31:33.225 * Connecting to MASTER... [11225] 17 Sep 14:31:33.226 * MASTER <-> SLAVE sync started [11225] 17 Sep 14:31:33.226 * Non blocking connect for SYNC fired the event. [11225] 17 Sep 14:31:33.226 * Master replied to PING, replication can continue... [11225] 17 Sep 14:31:33.227 # MASTER aborted replication with an error: ERR Unable to perform background save
Test that dump.rdb is created on BGSAVE
BGSAVE > OK
Test that dump.rdb is created on SAVE
SAVE > OK
Thanks in advance.
The Redis replication uses an asynchronous method to transfer data from master to slave. The slave periodically acknowledges the received data sent by the master node, and also the master node can have many slaves. Redis can support cascading replication, so the slave can be connected to another slave.
Sentinel is a system used to manage redis servers , it monitors the redis master and slaves continuously, and whenever a master goes down it will automatically promote a slave in to master. and when the old master is UP it will be made as slave of the new master.
Redis is single threaded server. Server will execute commands syncronously. When Pipeline with transaction is used, server will execute all commands in pipeline atomically.
I encountered a similar situation today. It seems that for systems that use sysctl
, you might have to do:
sysctl vm.overcommit_memory=1
and restart the slave redis server. This link might help.
This issue little tricky,
the reason that the slave can't sync is in the master itself,
pay attention to the Log output : MASTER aborted replication with an error: ERR Unable to perform background save
this is mean that the master can't do background saving due low memory reserve on the master machine,
to solve this issue I Restarted the master redis server , then all the slaves has been sync by themselves.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With