Add master/Slave node one, view cluster information redis-cli-p 6379 cluster nodes
[Email protected] redis]# redis-cli-h 192.168.1.3-p 6379 cluster nodes
dbc41c1e1a3c0c51c1e2a8216dace0f8883cf51f 192.168.1.3:6385 master-0 1434048814711 0 connected
85ad96dbdb49fd901de6f9f1431662c7ab58a208 192.168.1.4:6383 master-0 1434048816227 5 Connected 10923-16383
b37d1d090fdfffdeaeccc09f7978eeedc36b342a 192.168.1.4:6384 master-0 1434048815218 7 connected 5461-10922
D9A852AFAD1669ADF3561A57DBFA77B250AE32BB 192.168.1.4:6382 master-0 1434048815722 4 connected 0-5460
76ea836e326fbd4b2a242f5da01b9005c131eb46 192.168.1.3:6380 Slave D9A852AFAD1669ADF3561A57DBFA77B250AE32BB 0 1434048816740 4 Connected
4e54918bfc57e0895d68ad0f6bea1d104b18e0f6 192.168.1.3:6381 Slave 85ad96dbdb49fd901de6f9f1431662c7ab58a208 0 1434048816740 5 Connected
178b951fd08ae3250d06719509ea45258c6cef73 192.168.1.3:6379 myself,slave b37d1d090fdfffdeaeccc09f7978eeedc36b342a 0 0 1 connected
Node ID
IP: Port
Flag: Master, Slave, myself, fail, ...
If it is a slave node, here is its node ID
How long has it been since the cluster last sent a PING to a node that it hasn't received a reply?
The last time the node returned a PONG reply.
Configuration epoch for the node: For more information, refer to the Redis cluster specification.
Network connectivity of this node: for example, connected.
The slot currently contained by the node: for example, 127.0.0.1:7001 currently contains a hash slot with a number of 5960 to 10921.
6385 is already the master node, now for him to configure a one from node 6387, in addition to 4 on this host, if you copy the redis-6387.conf from the other configuration file, note that there are two places to change, one is the port number 6367, the other is Cluster-config-file nodes-6387.conf, otherwise the execution Redis-server redis-6387.conf will not be able to start the process port, the view log will appear the following error
[Email protected] redis]# cat/var/log/redis/redis-6387
12992:m June 02:49:53.280 * Increased maximum number of open files to 10032 (it is originally set to 1024).
12992:m June 02:49:53.281 # Sorry, the cluster configuration file nodes-6384.conf is already used by a different Redis C Luster node. Please make sure this different nodes use different cluster configuration files.
Two, add 6387 from the node
[Email protected] redis]# redis-cli-p 6387 cluster meet 192.168.1.3 6379
OK //execute this command by default to add the master node,
[Email protected] redis]# redis-cli-h 192.168.1.3-p 6379 cluster nodes
dbc41c1e1a3c0c51c1e2a8216dace0f8883cf51f 192.168.1.3:6385 master-0 1434048912150 0 connected
85ad96dbdb49fd901de6f9f1431662c7ab58a208 192.168.1.4:6383 master-0 1434048911648 5 Connected 10923-16383
b37d1d090fdfffdeaeccc09f7978eeedc36b342a 192.168.1.4:6384 master-0 1434048911143 7 connected 5461-10922
a1f35e42feba83fa12ee87fe366266095598e431 192.168.1.4:6387 master-0 1434048912554 8 connected
D9A852AFAD1669ADF3561A57DBFA77B250AE32BB 192.168.1.4:6382 master-0 1434048911648 4 connected 0-5460
76ea836e326fbd4b2a242f5da01b9005c131eb46 192.168.1.3:6380 Slave D9A852AFAD1669ADF3561A57DBFA77B250AE32BB 0 1434048910634 4 Connected
4e54918bfc57e0895d68ad0f6bea1d104b18e0f6 192.168.1.3:6381 Slave 85ad96dbdb49fd901de6f9f1431662c7ab58a208 0 1434048912652 5 Connected
178b951fd08ae3250d06719509ea45258c6cef73 192.168.1.3:6379 myself,slave b37d1d090fdfffdeaeccc09f7978eeedc36b342a 0 0 1 connected
[Email protected] redis]# redis-cli-p 6387 cluster replicate dbc41c1e1a3c0c51c1e2a8216dace0f8883cf51f
OK // CLUSTER REPLICATE
command Add. This command can also change the master node from the node.
Three in view
[Email protected] redis]# redis-cli-h 192.168.1.3-p 6379 cluster nodes
dbc41c1e1a3c0c51c1e2a8216dace0f8883cf51f 192.168.1.3:6385 master-0 1434048953498 0 connected
85ad96dbdb49fd901de6f9f1431662c7ab58a208 192.168.1.4:6383 master-0 1434048952996 5 Connected 10923-16383
b37d1d090fdfffdeaeccc09f7978eeedc36b342a 192.168.1.4:6384 master-0 1434048952492 7 connected 5461-10922
a1f35e42feba83fa12ee87fe366266095598e431 192.168.1.4:6387 slave dbc41c1e1a3c0c51c1e2a8216dace0f8883cf51f 0 1434048951990 8 Connected //become slave node
D9A852AFAD1669ADF3561A57DBFA77B250AE32BB 192.168.1.4:6382 master-0 1434048951484 4 connected 0-5460
76ea836e326fbd4b2a242f5da01b9005c131eb46 192.168.1.3:6380 Slave D9A852AFAD1669ADF3561A57DBFA77B250AE32BB 0 1434048952492 4 Connected
4e54918bfc57e0895d68ad0f6bea1d104b18e0f6 192.168.1.3:6381 Slave 85ad96dbdb49fd901de6f9f1431662c7ab58a208 0 1434048951988 5 Connected
178b951fd08ae3250d06719509ea45258c6cef73 192.168.1.3:6379 myself,slave b37d1d090fdfffdeaeccc09f7978eeedc36b342a 0 0 1 connected
This article is from the "Scattered People" blog, please be sure to keep this source http://zouqingyun.blog.51cto.com/782246/1661332
Redis cluster Deployment (ii)