向现有集群添加新的 redis 节点

时间:2021-01-18 09:25:28

标签: redis node-redis

我已经在新的 centos D、E、F 服务器中安装了最新版本(6.0.8)的 redis,现在我想将这些新服务器添加到具有旧 redis 版本的现有集群 A、B、C 中,我的计划是在添加新的 redis 服务器后,然后停用旧服务器。任何人都可以指导我的步骤

1 个答案:

答案 0 :(得分:0)

1. Setup your new Redis instance as a slave for your current Redis instance. In order to do so you need a different server, or a server that has enough RAM to keep two instances of Redis running at the same time.
2. If you use a single server, make sure that the slave is started in a different port than the master instance, otherwise the slave will not be able to start at all.
3. Wait for the replication initial synchronization to complete (check the slave log file).
4. Make sure using INFO that there are the same number of keys in the master and in the slave. Check with redis-cli that the slave is working as you wish and is replying to your commands.
5. Allow writes to the slave using CONFIG SET slave-read-only no
6. Configure all your clients in order to use the new instance (that is, the 
  slave). Note that you may want to use the CLIENT PAUSE command in order to make sure that no client can write to the old master during the switch.
7. Once you are sure that the master is no longer receiving any query (you can check this with the MONITOR command), elect the slave to master using the SLAVEOF NO ONE command, and shut down your master.

您可以按照本指南 upgrading-or-restarting-a-redis-instance-without-downtime