如何解决Jedis连接Linux上的redis出现DENIEDRedisisrunninginprotectedmode问题-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

如何解决Jedis连接Linux上的redis出现DENIEDRedisisrunninginprotectedmode问题

本篇内容介绍了“如何解决Jedis连接Linux上的redis出现 DENIED Redis is running in protected mode问题”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

10多年的北戴河网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都全网营销的优势是能够根据用户设备显示端的尺寸不同,自动调整北戴河建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联公司从事“北戴河网站设计”,“北戴河网站推广”以来,每个客户项目都认真落实执行。

最近有段时间没有写博客了,今天抽出时间写写,之前开发的时候redis部署在Linux是其他人搞得,我没怎么参与,于是闲着无聊在本地的虚拟机上安装了个redis进行测试,没想到在进行连接时报了下面这么一个错,fuck,Linux上的redis还真是麻烦,哪像windows上的redis这么简单一解压完事

Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions:
 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.
 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
 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 
 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
    at redis.clients.jedis.Protocol.processError(Protocol.java:127)
    at redis.clients.jedis.Protocol.process(Protocol.java:161)
    at redis.clients.jedis.Protocol.read(Protocol.java:215)
    at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
    at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:239)
    at redis.clients.jedis.BinaryJedis.ping(BinaryJedis.java:196)
    at com.example.redis.JedisTest.main(JedisTest.java:24)

经过我英语八级的翻译,上面一共提供了四种解决方案,但是综合考虑为了简单起见只需要执行以下几步即可:


  1.修改redis.conf配置文件,将绑定的ip地址端口号给注释见下图
  如何解决Jedis连接Linux上的redis出现 DENIED Redis is running in protected mode问题
  
   6. 解决了这个问题就可以进行各种有趣的测试了哈哈

“如何解决Jedis连接Linux上的redis出现 DENIED Redis is running in protected mode问题”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


网站栏目:如何解决Jedis连接Linux上的redis出现DENIEDRedisisrunninginprotectedmode问题
网页链接:http://kswsj.cn/article/gpeeid.html

其他资讯