1.搭建三主三从的cluster的集群的搭建
2.配置环境
redis版本要求:redis大版本为5.0.8
安装环境:
软件下载地址http://download.redis.io/releases/
服务器系统---centos6.5
安装包存放目录 /home/app
redis安装目录/home/app/redis
配置文件 /home/app/redis/conf/redis_cluster
可执行命令 /home/app/redis/bin/* 被链接到 /usr/local/bin/
2.6台机器分别安装redis,并启动redis
3.修改系统参数
echo "* soft nofile 10240" >> /etc/security/limits.conf
echo "* hard nofile 10240" >> /etc/security/limits.conf
echo "net.core.somaxconn = 10240" >> /etc/sysctl.conf
echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
sysctl -p
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local
echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.local
4.添加redis到集群中
redis5以上集群添加命令:
./redis-cli --cluster create 192.168.4.206:9000 192.168.4.214:9000 192.168.4.207:9000 192.168.4.215:9000 192.168.4.208:9000 192.168.4.212:9000 --cluster-replicas 1
redis5以下的命令:
./redis-trib.rb create --replicas 1 192.168.4.206:9000 192.168.4.214:9000 192.168.4.207:9000 192.168.4.215:9000 192.168.4.208:9000 192.168.4.212:9000
5.查看cluster的状态