在一些文档中,创建redis cluster需要采用redis-trib.rb脚本实现
但是,在redis5中,已经修改为采用redis-cli实现了,语法如下:
redis-cli --cluster help
Cluster Manager Commands:
create host1:port1 ... hostN:portN
--cluster-replicas <arg>
check host:port
info host:port
fix host:port
reshard host:port
--cluster-from <arg>
--cluster-to <arg>
--cluster-slots <arg>
--cluster-yes
--cluster-timeout <arg>
--cluster-pipeline <arg>
rebalance host:port
--cluster-weight <node1=w1...nodeN=wN>
--cluster-use-empty-masters
--cluster-timeout <arg>
--cluster-simulate
--cluster-pipeline <arg>
--cluster-threshold <arg>
add-node new_host:new_port existing_host:existing_port
--cluster-slave
--cluster-master-id <arg>
del-node host:port node_id
call host:port command arg arg .. arg
set-timeout host:port milliseconds
import host:port
--cluster-from <arg>
--cluster-copy
--cluster-replace
help
实例:
redis-cli --cluster create --cluster-replicas 1 192.168.1.10:6481 192.168.1.10:6482 192.168.1.10:6483 192.168.1.10:6484 192.168.1.10:6485 192.168.1.10:6486