redis创建cluster

在一些文档中,创建redis cluster需要采用redis-trib.rb脚本实现

但是,在redis5中,已经修改为采用redis-cli实现了,语法如下:

redis-cli --cluster help
Cluster Manager Commands:
  create         host1:port1 ... hostN:portN
                 --cluster-replicas
  check          host:port
  info           host:port
  fix            host:port
  reshard        host:port
                 --cluster-from
                 --cluster-to
                 --cluster-slots
                 --cluster-yes
                 --cluster-timeout
                 --cluster-pipeline
  rebalance      host:port
                 --cluster-weight
                 --cluster-use-empty-masters
                 --cluster-timeout
                 --cluster-simulate
                 --cluster-pipeline
                 --cluster-threshold
  add-node       new_host:new_port existing_host:existing_port
                 --cluster-slave
                 --cluster-master-id
  del-node       host:port node_id
  call           host:port command arg arg .. arg
  set-timeout    host:port milliseconds
  import         host:port
                 --cluster-from
                 --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

你可能感兴趣的:(redis)