-
Notifications
You must be signed in to change notification settings - Fork 0
Changing roles between nodes after failover
By default, RDS cluster works in standby mode. It means that Redis instances on master node will handle all read and write commands, and Redis instances on minion node will only synchronize with instances on master node.
Standby failover mode based on the use of virtual IP (for example, using keepalived, which is natively supported by RDS).
Important
We do not recommend using DNS for standby failover. The resolved IP of the node can be cached at the system/service level and your service will continue to send requests to the down node.
When the master node reboots or goes down, the virtual IP is transferred from the master to the minion node, and Redis instances on the minion node start serving requests. There is no automatic role change after failover, so you must change them manually.
To change roles between nodes, follow the next steps.
Caution
Note that all actions must be performed in the specified order. Performing actions in a different order or skipping them may result in data loss.
- Open configuration file
/etc/rds.knf
and change node role to themaster
inreplication:role
property; - Change property
replication:master-ip
to the IP of machine; - Stop syncing daemon using
sudo service rds-sync stop
command; - Run
sudo rds replication-role-set master
command and follow the instructions; - Start syncing daemon using
sudo service rds-sync start
command; - Check log file
/var/log/rds/rds-sync.log
for errors or warnings.
- If syncing daemon is works stop it using
sudo service rds-sync stop
command; - Open configuration file
/etc/rds.knf
and change node role to theminion
inreplication:role
property; - Change property
replication:master-ip
to the IP of master node; - Run
sudo rds replication-role-set minion
command and follow the instructions;
Tip
If you are not sure about data consistency, or if you have a lot of data, you can delete all existing data with the command rm -rf /opt/rds/conf/* /opt/rds/meta/* /opt/rds/data/* /opt/rds/log/*
.
- Start syncing daemon using
sudo service rds-sync start
command; - Check log file
/var/log/rds/rds-sync.log
for errors or warnings.