Redis Cluster 待运行的Redis集群永久加密并远程连接
阅读 (2011) 2016-12-28 03:44:28
Redis Cluster 连接加密码
前面写到Redis Cluster 已运行的Redis集群 设置密码 Predis 连接,该方法遇到不可抗力,服务器重启,或需要重新启动redis集群,或redis集群进程被结束,需重新创建redis集群密码
手动给Redis加密
1.编缉7000-7005目录下的redis.conf,找到主从的密码设置
[root@localhost src]# vim /usr/local/cluster/7000/redis.conf
[root@localhost src]# vim /usr/local/cluster/7001/redis.conf
[root@localhost src]# vim /usr/local/cluster/7002/redis.conf
[root@localhost src]# vim /usr/local/cluster/7003/redis.conf
[root@localhost src]# vim /usr/local/cluster/7004/redis.conf
[root@localhost src]# vim /usr/local/cluster/7005/redis.conf
主只需配置:requirepass 123456
从只需配置:masterauth 123456
2.启动redis 并查看进程
[root@localhost ~]# cd /usr/local/cluster/7000
[root@localhost 7000]# redis-server redis.conf
[root@localhost 7000]# cd /usr/local/cluster/7001
[root@localhost 7001]# redis-server redis.conf
[root@localhost 7001]# cd /usr/local/cluster/7002
[root@localhost 7002]# redis-server redis.conf
[root@localhost 7002]# cd /usr/local/cluster/7003
[root@localhost 7003]# redis-server redis.conf
[root@localhost 7003]# cd /usr/local/cluster/7004
[root@localhost 7004]# redis-server redis.conf
[root@localhost 7004]# cd /usr/local/cluster/7005
[root@localhost 7005]# redis-server redis.conf
[root@localhost 7005]#
[root@localhost 7005]# ps -ef|grep redis
root 1480 1 5 11:14 ? 00:00:00 redis-server *:7000 [cluster]
root 1484 1 4 11:14 ? 00:00:00 redis-server *:7001 [cluster]
root 1488 1 5 11:14 ? 00:00:00 redis-server *:7002 [cluster]
root 1490 1 3 11:14 ? 00:00:00 redis-server *:7003 [cluster]
root 1492 1 3 11:14 ? 00:00:00 redis-server *:7004 [cluster]
root 1502 1 3 11:14 ? 00:00:00 redis-server *:7005 [cluster]
root 1507 1459 0 11:14 pts/0 00:00:00 grep redis
Redis已启动,即便再发生重启的情况,密码也不会丢失
更新于:2016-12-28 03:44:28