Cluster Cache --redis-- reconstruction (linux)

table of Contents

1. Shut down the old cluster node redis:

2, delete the old cluster node configuration file:

3, delete the old cluster node data file:

4, start the new cluster nodes single redis:

5, creating a new cluster using redis-trib.rb:

6, redis-trib.rb add a new cluster slave:

7, using redis-cli see the new cluster information:


 

If you need to re-create redis clusters, then the core idea is to cluster node configuration information to delete, and then re-create the new cluster to the specific steps are as follows:

1. Shut down the old cluster node redis:

By ps -ef | grep redis redis query to process ID, and then you can kill off one by one.

2, delete the old cluster node configuration file:

Cluster nodes in the cluster configuration file on each node has a redis file cluster-config-file dir arranged in the path of the file is arranged at each node redis profile. The file can be deleted.

3, delete the old cluster node data file:

If there is an old cluster nodes and other data persistence rdb file, but also need to delete the file, otherwise there will still be the old cluster node startup information.

4, start the new cluster nodes single redis:

Start all stand-alone service redis respectively in each node of the new cluster.

Execute the command: ./ redis-server configuration file path.

5, creating a new cluster using redis-trib.rb:

Any new cluster on a primary node, enter redis extract the source folder src, execute the command to create redis clusters.

Execute the command: ./ redis-trib.rb create 192.168.0.141:6379 192.168.0.142:6379 192.168.0.143:6379

After the command is completed, there are ok on that success.

6, redis-trib.rb add a new cluster slave:

On any one master node cluster, enter redis extract the source folder src, execute the command to add a node from the master node redis cluster.

Execute the command: ./ redis-trib.rb add-node --slave 192.168.50.168:8000 192.168.50.167:7000

Description: The first node is a Slave (from), the second node is a Master (Main).

7, using redis-cli see the new cluster information:

On either a cluster master node connected to the cluster via redis-cli any one redis, redis view cluster information.

Execute the command: ./ redis-cli -h 192.168.0.141 -p 6379 cluster nodes

Published 131 original articles · won praise 23 · views 10000 +

Guess you like

Origin blog.csdn.net/LSY_CSDN_/article/details/103945436