多节点redis集群搭建流程
环境:redis-5.0.3,suse linux 12
修改配置文件
bind 本地ip
port 监听端口(多节点搭建使用默认端口6379,单节点多实例需修改为不同端口)
daemonize yes #开启守护进程
pidfile /var/run/redis_6379.pid #pidfile路径,修改为拥有操作权限的路径
cluster-enabled yes #开启集群模式
cluster-config-file nodes_7000.conf #集群的配置,配置文件首次启动时自动生成
cluster-node-timeout 5000 #节点超时
appendonly yes #aof日志开启,记录写操作日志
logfile "/arrow/redis-cluster/redis/log/redis.log" #修改为拥有操作权限的路径
拷贝redis到各个节点,并启动redis实例
赋予执行权限
chmod -R 777 redis/
查看服务
ps -ef|grep redis #查看是否启动成功
netstat -tnlp|grep redis #查看redis监听端口
1. 使用redis-cli 创建集群
#创建集群
./redis-cli --cluster create 10.230.147.171:6379 10.230.147.181:6380 10.230.147.188:6381 10.230.147.189:6382