3 Redis伪分布式集群

4 篇文章 0 订阅

redis-5.0.5参考资料:https://blog.csdn.net/u010520146/article/details/84932104

redis-3.0.0参考资料:https://blog.csdn.net/qq_42815754/article/details/82912130

 

复制文件全部

cp -r redis-5.0.5/* 8004

sh redis-cluster-start.sh

 

protected-mode no (yes,不变)

port 8000 (修改)

cluster-enabled yes (放开注释)

cluster-config-file nodes-8000.conf (修改)

cluster-node-timeout 5000 (放开注释,修改)

daemonize yes (不变)

pidfile /var/run/redis_8000.pid (修改)

logfile "8000.log" (修改)

dir /redis/data (不修改,不新建文件夹,保留./)

 

 

 

创建集群

[root@ylm-100 soft]# redis-cli -a 123456 --cluster create 192.168.92.100:8000 192.168.92.100:8001 192.168.92.100:8002 192.168.92.100:8003 192.168.92.100:8004 192.168.92.100:8005 --cluster-replicas 1

yes

 

 

进入节点

cluster info

cluster nodes

[root@localhost src]# redis-cli -p 8001 -a 123456

127.0.0.1:8001> get a

(error) MOVED 15495 127.0.0.1:8002

127.0.0.1:8001>

这边提示MOVED命令,则用如下:

 

[root@localhost src]# redis-cli -c -p 8001 -a 123456

127.0.0.1:8001> get a

-> Redirected to slot [15495] located at 127.0.0.1:8002

"aaaa"

127.0.0.1:8002> keys *

 

集群登录 -c

[root@ylm-100 soft]# redis-cli -c -h 192.168.92.100 -p 8000 -a 123456

Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.

192.168.92.100:8000> set ww ww

-> Redirected to slot [8126] located at 192.168.92.100:8001

OK

192.168.92.100:8001> get ww

"ww"

 

 

启动脚本

vim ../redis-cluster-start.sh

/usr/local/soft/8000/src/redis-server /usr/local/soft/8000/redis.conf

/usr/local/soft/8001/src/redis-server /usr/local/soft/8001/redis.conf

/usr/local/soft/8002/src/redis-server /usr/local/soft/8002/redis.conf

/usr/local/soft/8003/src/redis-server /usr/local/soft/8003/redis.conf

/usr/local/soft/8004/src/redis-server /usr/local/soft/8004/redis.conf

/usr/local/soft/8005/src/redis-server /usr/local/soft/8005/redis.conf

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值