客户端无法登录Redis服务器报错,解除保护模式

http://blog.csdn.net/fly43108622/article/details/52972433

Redis技术学习,更多资源请访问 https://www.itkc8.com

 

一:问题如下

 

[sql] view plain copy  在CODE上查看代码片派生到我的代码片

  1. 在192.168.56.57客户端登录192.168.56.56的redis服务器时,报错如下:  
  2. [root@localhost src]# ./redis-cli -h  192.168.56.56  -p  6379 -a  "aabbcc"  
  3. 192.168.56.56:6379> ping  
  4. Error: Connection reset by peer  
  5.   
  6.    
  7. 再telnet一下192.168.56.56的redis服务器的6379端口,提示redis服务有保护模式,需要解除  
  8. [root@localhost src]# telnet 192.168.56.56  6379  
  9. Trying 192.168.56.56...  
  10. Connected to 192.168.56.56.  
  11. Escape character is '^]'.  
  12.   
  13. -DENIED Redis is running in protected modebecause protected mode is enabled, no bind address was specified, noauthentication password is requested to clients.   
  14. In this mode connections areonly accepted from the loopback interface. If you want to connect from externalcomputers to Redis you may adopt one of the following   
  15. solutions: 1) Justdisable protected mode sending the command 'CONFIG SET protected-mode no' fromthe loopback interface by connecting to Redis from the same host   
  16. the server isrunning, however MAKE SURE Redis is not publicly accessible from internet ifyou do so. Use CONFIG REWRITE to make this change permanent.   
  17. 2) Alternativelyyou can just disable the protected mode by editing the Redis configurationfile, and setting the protected mode option to 'no'and then restarting theserver.   
  18. 3) If you started the server manually just for testing, restart it withthe '--protected-mode no' option.   
  19. 4) Setup a bind address or an authenticationpassword. NOTE: You only need to do one of the above things in order for theserver to start accepting connections from the outside.  
  20. Connection closed by foreign host.  

 

 

二:解决方案

 

[sql] view plain copy  在CODE上查看代码片派生到我的代码片

  1. 1、修改redis服务器的配置文件  
  2. vi redis.conf    
  3.   
  4. 注释以下绑定的主机地址  
  5. # bind 127.0.0.1  
  6.   
  7.    
  8. 2、修改redis服务器的参数配置  
  9.   
  10. 修改redis的守护进程为no ,不启用  
  11. 127.0.0.1:6379> config set daemonize "no"  
  12. OK  
  13.   
  14. 修改redis的保护模式为no,不启用  
  15. 127.0.0.1:6379> config set protected-mode "no"  
  16. OK  

 

 

三:问题解决

 

[sql] view plain copy  在CODE上查看代码片派生到我的代码片

  1. 再次telnet一下192.168.56.56的redis服务器的6379端口,无问题  
  2. [root@localhost Packages]# telnet 192.168.56.56  6379  
  3. Trying 192.168.56.56...  
  4. Connected to 192.168.56.56.  
  5. Escape character is '^]'.  
  6.   
  7.   
  8. 再次在192.168.56.57客户端登录192.168.56.56的redis服务器,无问题  
  9. [root@localhost src]# ./redis-cli -h  192.168.56.56 -p 6379 -a "aabbcc"  
  10. 192.168.56.56:6379> ping  
  11. PONG  

Redis技术学习,更多资源请访问 https://www.itkc8.com

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值