day07-Redis主从及安全

2018-06-08  本文已影响4人  雨醉风尘

Redis集群


高可用 Sentinel 哨兵

Sentinel 时官方提供的用于监控多个Redis服务实例运行情况的解决方案。

#复制四份sentinel.conf文件

- sentinel26380.conf
- sentinel26381.conf
- sentinel26382.conf
- sentinel26383.conf

#修改sentinel2638*.conf中的两个配置项

port 26380   //sentinel26380.conf

port 26381   //sentinel26381.conf

port 26382   //sentinel26382.conf

port 26383   //sentinel26383.conf

#修改sentinel监视配置项

<!---->
#                name     masterIP    masterPort  哨兵投票数
sentinel monitor mymaster 127.0.0.1   6381        2

#创建监视主服务器的Sentinel实例

redis-sentinel /etc/redis/sentinel26380.conf

redis-sentinel /etc/redis/sentinel26381.conf

redis-sentinel /etc/redis/sentinel26382.conf

redis-sentinel /etc/redis/sentinel26383.conf

安全

redis.conf 文件中设置 requirepass yourPassword

#只允许本机登陆
bind 127.0.0.1
#重命名flushall为asdfg
#注意:对于flushall命令,需要保证appendonly.aof文件没有flushall命令,否则服务器无法启动
rename-command flushall asdfg

#禁止使用flushdb命令
rename-command flushdb ""

#禁止使用config命令
rename-command config ""

参考:【动力节点】Redis视频教程

上一篇下一篇

猜你喜欢

热点阅读