Update Redis_集群模式.md
This commit is contained in:
parent
9ba2b98e36
commit
60a671908f
@ -172,6 +172,7 @@ redis-cli -h 127.0.0.1 -p 6479 cluster nodes
|
||||
```
|
||||
|
||||
<div align="center"> <img src="../pictures/redis-cluster-nodes.png"/> </div>
|
||||
|
||||
想要让新加入的节点能够进行读写操作,可以使用 `reshard` 命令为其分配槽,这里我们将其他三个主节点上的槽迁移一部分到 6485 节点上,这里一共迁移 4096 个槽,即 16384 除以 4 。 `cluster-from` 用于指明槽的源节点,可以为多个,`cluster-to` 为槽的目标节点,`cluster-slots` 为需要迁移的槽的总数:
|
||||
|
||||
```shell
|
||||
@ -184,6 +185,7 @@ redis-cli --cluster reshard 127.0.0.1:6479 \
|
||||
迁移后,再次使用 `cluster nodes` 命令可以查看到此时 6485 上已经有其他三个主节点上迁移过来的槽:
|
||||
|
||||
<div align="center"> <img src="../pictures/redis-cluster-nodes2.png"/> </div>
|
||||
|
||||
为保证高可用,可以为新加入的主节点添加从节点,命令如下。`add-node` 接收两个参数,第一个为需要添加的从节点,第二个参数为集群内任意节点,用于发现集群。`cluster-master-id` 参数用于指明作为哪个主节点的从节点,如果不加这个参数,则自动分配给从节点较少的主节点:
|
||||
|
||||
```shell
|
||||
|
Loading…
x
Reference in New Issue
Block a user