2017.7.10 Redis报错:DENIED Redis is running in protected mode

参考来自:

java 客户端链接不上redis解决方案 

DENIED Redis is running in protected mode

 

完整错误信息:

 1 Caused by: redis.clients.jedis.exceptions.JedisDataException: 
 2 DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, 
no authentication password is requested to clients.
3 In this mode connections are only accepted from the loopback interface. 4 If you want to connect from external computers to Redis you may adopt one of the following solutions: 5 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 6 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 7 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 8 4) Setup a bind address or an authentication password. 9 10 NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

 

这里列举了四个解决办法。
我用了第二种。将配置文件里的protected mode改为了no,原本是yes。

 

2017.7.27 又遇到了这个错误,之前明明将protected-mode改为了no,就ok的。

原因是:之前redis的服务端和客户端都是在本机上,现在客户端在其他机器上,访问redis就出错了。

因此采取了第4种。设置redis的密码。

操作过程:

(1)开启168.2.237.207上的redis

(2)在88环境上连接168.2.237.207上的redis,出错

 (3)在168.2.237.207上开一个redis的客户端,连接本机的redis,并且设置密码。

(4)回到88环境,重新连接redis,报错提示:NOAUTH Authentication required。

(5)输入密码,连接成功。

 

但这里有一个问题:一旦redis服务器重启,又报这个DENIED Redis is running in protected mode的错误了。每次重启后都要重新设置密码才能在别的机器上成功连接。

有没有只设置一次密码就ok的办法?

 

转载于:https://www.cnblogs.com/lyh421/p/7145430.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值