Redis (centOS 7 阿里云) 设置了 protected-mode no,还是同样的错误。

发布于 2022-09-11 22:50:18 字数 1462 浏览 17 评论 0

错误提示:

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.

1).云端已经修改:
protected-mode no

2).云端连接正常:(执行ping,返回 PONG,如下图)

3).本地连接:
testOnBorrow 设置为 false:
redis.pool.testOnBorrow=false

连接测试还是报同样的错误。
经多次搜索,未解决

Service.png

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心如狂蝶 2022-09-18 22:50:18

感谢各位,重启可以了,如下:

配置redis后,kill进程,重新启动redis服务,成功连接!

(redis 目录下)

1)ps -ef | grep redis
2)kill -9 进程编号
3)src/redis-server redis.conf

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文