shell启动集群redis

#start all redis
cd /usr/local/redis-cluster/7001
./redis-server redis7001.conf
cd /usr/local/redis-cluster/7002
./redis-server redis7002.conf
cd /usr/local/redis-cluster/7003
./redis-server redis7003.conf
cd /usr/local/redis-cluster/7004
./redis-server redis7004.conf
cd /usr/local/redis-cluster/7005
./redis-server redis7005.conf
cd /usr/local/redis-cluster/7006
./redis-server redis7006.conf

#-----------------stop all redis--------------#
./7001/redis-cli -p 7001 shutdown
./7002/redis-cli -p 7002 shutdown
./7003/redis-cli -p 7003 shutdown
./7004/redis-cli -p 7004 shutdown
./7005/redis-cli -p 7005 shutdown
./7006/redis-cli -p 7006 shutdown

#----------------create redis cluster ---------#
./redis-trib.rb create --replicas 1 106.13.43.192:7001 106.13.43.192:7002 106.13.43.192:7003 106.13.43.192:7004 106.13.43.192:7005  106.13.43.192:7006

#----------其中-c表示以集群方式连接redis,-h指定ip地址,-p指定端口号------#
./redis-cli -c -h 106.13.43.192 -p 7001 

你可能感兴趣的:(虚拟机,shell)