Using clusters
The main record is the operation of learning Jedis. third, add new nodes to the cluster
Depending on the newly added node type, there are 2 ways to add new nodes to the cluster.
1: If you add a new node that is a master, then we need to create an empty node and then move some hash buckets to this empty node.
2: To add the new node is slave, then we will set the new node as a replica of a node in the cluster.
Add master node Master
Create a new port6305 node (using the same configuration file as before) and start.
executes the command ./REDIS-TRIB.RB add-node 127.0.0.1:6305 127.0.0.1:6300, add the new node to the cluster.
The first parameter is the address of the new node, and the second parameter is the IP and port of any node that already exists.
We can see that the new node has been added to the cluster: cluster nodes
6305 has been added as master, but the 1> new node does not contain any data because he does not contain any hash slots. 2> when a cluster needs to upgrade a node to a new master node, the node is not selected because there is no hash slot.
Next, as soon as you move some of the hash buckets in the cluster to the new node, the new node becomes the real master.
to add a slave from a node (a replica of a master node)
Create a new empty node and start the connection
Execute command cluster replicate (ID of any one master)
Reprinted from Http://redis.readthedocs.org/en/latest/topic/cluster-tutorial.html