- gcc --version确认gcc已经安装,如果没有则yum install gcc
- tar -zxvf 解压安装包后进入文件夹,执行make。如果报错,执行make distclean
- 执行make install。安装成功后如下
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/caeca45b5f156c8216d1e52dbd2f9412.png)
- redis.conf 修改内容
bind 0.0.0.0
protected-mode no
requirepass xxxxx
daemonize yes
logfile "/home/rancher/redis/redis.log"
appendonly no
masterauth xxxx
replica-priority 100
- 启动 redis-server redis.conf
- 查看当前redis状态 redis-cli -p 6379,输入密码 auth xxxx,info replication
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/9cb57334869d4d57d4756416ed7f1f8f.png)
- 在从机上执行 slaveof $主机ip $主机port
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/13c155efa7ae0fb9becbffc1dce0fb47.png)
- 设置哨兵。创建 sentinel.conf,内容为
sentinel monitor mymaster ${master的ip} 6379 1
sentinel auth-pass mymaster xxxxx
daemonize yes
logfile "/home/rancher/redis-6.2.6/sentinel.log"
sentinel announce-ip ${本机外网ip}
- 启动哨兵 redis-sentinel sentinel.conf