redis集群搭建
修改配置文件
一主(6379)两从(6380,6381)
打开第一个Redis的配置文件redis6379.conf
修改端口
修改进程pid
添加日志
修改持久化文件名
打开第二个Redis的配置文件redis6380.conf
连接主节点
打开第三个Redis的配置文件redis6381.conf
连接主节点
设置broker哨兵
创建setinel.conf文件
vim setinel.conf
编辑setinel.conf文件
setinel monitor 随便取redis名称 主机ip 主机端口 选举
setinel monitor myredis 127.0.0.1 6379 1
打开redis服务和哨兵
redis-server redisconfig/redis6379.conf
redis-server redisconfig/redis6380.conf
redis-server redisconfig/redis6381.conf
redis-sentinel redisconfig/sentinel.conf
查看redis集群配置
redis-cli -p 6379
info replication
测试
关闭6379redis服务
shutdown
6380被选举为主机