2.6.redis-cluster流程

1.cluster基础信息

1.1.cluster info

1
2
3
4
5
*2
$7
cluster
$4
info
1
2
3
4
5
6
7
8
9
10
11
12
$267
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:1
cluster_size:1
cluster_current_epoch:1
cluster_my_epoch:1
cluster_stats_messages_sent:0
cluster_stats_messages_received:0

1.2.cluster nodes

1
2
3
4
5
*2
$7
cluster
$5
nodes
1
2
$102
184833235217c242457768709178276ee67b1852 127.0.0.1:7005@17005 myself,master - 0 0 1 connected 0-16383

1.3.cluster help

1
2
3
4
5
*2
$7
cluster
$4
help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
*23
+CLUSTER <subcommand> arg arg ... arg. Subcommands are:
+ADDSLOTS <slot> [slot ...] -- Assign slots to current node.
+BUMPEPOCH -- Advance the cluster config epoch.
+COUNT-failure-reports <node-id> -- Return number of failure reports for <node-id>.
+COUNTKEYSINSLOT <slot> - Return the number of keys in <slot>.
+DELSLOTS <slot> [slot ...] -- Delete slots information from current node.
+FAILOVER [force|takeover] -- Promote current replica node to being a master.
+FORGET <node-id> -- Remove a node from the cluster.
+GETKEYSINSLOT <slot> <count> -- Return key names stored by current node in a slot.
+FLUSHSLOTS -- Delete current node own slots information.
+INFO - Return onformation about the cluster.
+KEYSLOT <key> -- Return the hash slot for <key>.
+MEET <ip> <port> [bus-port] -- Connect nodes into a working cluster.
+MYID -- Return the node id.
+NODES -- Return cluster configuration seen by node. Output format:
+ <id> <ip:port> <flags> <master> <pings> <pongs> <epoch> <link> <slot> ... <slot>
+REPLICATE <node-id> -- Configure current node as replica to <node-id>.
+RESET [hard|soft] -- Reset current node (default: soft).
+SET-config-epoch <epoch> - Set config epoch of current node.
+SETSLOT <slot> (importing|migrating|stable|node <node-id>) -- Set slot state.
+REPLICAS <node-id> -- Return <node-id> replicas.
+SLOTS -- Return information about slots range mappings. Each range is made of:
+ start, end, master and replicas IP addresses, ports and ids

1.4.cluster myid

1
2
3
4
5
*2
$7
cluster
$4
myid
1
2
$40
184833235217c242457768709178276ee67b1852