redis安装目录:/root/redis-5.0.5/utils/create-cluster

vi create-cluster

NODES=6
REPLICAS=1
创建6个节点,其实副本数1  也就是3主3从

  

自动创建集群

[root@redis2 create-cluster]# ./create-cluster start
Starting 30001
Starting 30002
Starting 30003
Starting 30004
Starting 30005
Starting 30006

[root@redis2 create-cluster]# ps -ef | grep redis
root 9471 1 0 21:22 ? 00:00:07 redis-server *:46380
root 9584 1 0 23:38 ? 00:00:00 ../../src/redis-server *:30001 [cluster]
root 9586 1 0 23:38 ? 00:00:00 ../../src/redis-server *:30002 [cluster]
root 9591 1 0 23:38 ? 00:00:00 ../../src/redis-server *:30003 [cluster]
root 9596 1 0 23:38 ? 00:00:00 ../../src/redis-server *:30004 [cluster]
root 9601 1 0 23:38 ? 00:00:00 ../../src/redis-server *:30005 [cluster]
root 9606 1 0 23:38 ? 00:00:00 ../../src/redis-server *:30006 [cluster]
root 9616 9324 0 23:39 pts/6 00:00:00 grep redis

  

 

帮助

[root@redis2 create-cluster]# redis-cli --cluster help
Cluster Manager Commands:
  create         host1:port1 ... hostN:portN
                 --cluster-replicas <arg>
  check          host:port
                 --cluster-search-multiple-owners
  info           host:port
  fix            host:port
                 --cluster-search-multiple-owners
  reshard        host:port
                 --cluster-from <arg>
                 --cluster-to <arg>
                 --cluster-slots <arg>
                 --cluster-yes
                 --cluster-timeout <arg>
                 --cluster-pipeline <arg>
                 --cluster-replace
  rebalance      host:port
                 --cluster-weight <node1=w1...nodeN=wN>
                 --cluster-use-empty-masters
                 --cluster-timeout <arg>
                 --cluster-simulate
                 --cluster-pipeline <arg>
                 --cluster-threshold <arg>
                 --cluster-replace
  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

  

手动创建

 redis-cli 6379.conf  --cluster create 127.0.0.1:30001 127.0.0.1:30002 127.0.0.1:30003 127.0.0.1:3004 127.0.0.1:3005 127.0.0.1:3006 --cluster-replicas 1

  

移动槽位

redis-cli --cluster reshard 127.0.1:30001

 

posted on 2021-01-23 17:17  陕西小楞娃  阅读(62)  评论(0编辑  收藏  举报