Redis 5.0 Cluster in CoreOS
基本结构
前端 : VIP:6379 haproxy_stats:9091 | ||
---|---|---|
Node1 | Node2 | Node3 |
master1:6380 | master2:6380 | master3:6380 |
slave2:6381 | slave3:6381 | slave1:6381 |
phpredmin:8080 | phpredmin:8080 | phpredmin:8080 |
redisadmin:8000 | ||
分片slots(0-5461) | slots(5462-10922) | slots(10923-16383) |
Download
git clone https://github.com/Thomas-YangHT/redisHa.git;cp *tgz redisHa; cd redisHa
vim CONFIG
NODE1_NAME=node1 NODE2_NAME=node2 NODE3_NAME=node3 NODE1_IP=192.168.253.41 NODE2_IP=192.168.253.42 NODE3_IP=192.168.253.43 VIP_IP=192.168.253.40 VR_ID=53 VPORT=6379 MasterPort=6380 SlavePort=6381 REMOTE_USER=core masterauth=123321 requirepass=123321 NODES=$NODE1_IP,$NODE2_IP,$NODE3_IP#for kvm clone shKVM_NAME=$NODE1_NAME,$NODE2_NAME,$NODE3_NAMEGATEWAY=192.168.253.125 DNS1=192.168.253.110 DNS2=114.114.114.114 PJ=redis
INSTALL
sh -x install.sh all
and waiting for a moment...
see video
Check STATUS
sh install.sh status
and see all nodes connected
cluster info & nodes status
Check Result by browse svc-redis.html
svc-redis.html
phpredmin带统计和命令终端
RedisAdmin支持多主机管理
haproxy_stats
More about install.sh:
usage: install.sh [OPTION]OPTIONS: p|prepare :prepare redis.tgz .etc. p1|prepareMon :prepare redismon.tgz p2|haprepare :prepare ha.tgz. keepalived :install keepalived. haproxy :install haproxy. status :get redis status. reset :when reinstall, delete all. start :start all redis container. redis :start redis container. redisMeet :handshake nodes. addSlots :seprate 16384 slots to three nodes nodeInfo :get nodeInfo addSlave :add slave to master redisAdmin :install phpredisadmin on node1 phpRedmin :install phpredmin on all nodes repaireRedis :fix aof file & restart failed redis all :install all components. reboot :reboot all nodes in CEPH cluster.
Q&A
集群模式的限制
Redis集群模式只支持一个库,即db0
分片存储,Master1(0-5461slots) Master2(5462-10922) Master3(10923-16383),keys *将只返回连接结点的KEY
redis-cli -c 需要加-c 选项,其它常用选项:-p $MasterPort -a $requirepass -h $node[1-3]
可通过VIP:VPORT,或任一NODEIP:MasterPort访问集群
集群通讯是通过通讯端口(数据端口+10000)互连
作者:LinuxMan_yang
链接:https://www.jianshu.com/p/ee83230a4cfb
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦