admin管理员组文章数量:1571108
redis 通过ip连接失败
报错1
报错:Could not connect to Redis at 192.168.137.154:6379: Connection refused
原因: redis认为直接在互联网上暴露redis端口是危险的,所以redis遵信bind指令,强制redis只监听IPV4回退接口地址(即:只能够接收同一台计算机的连接)
例如:(Linux: /etc/redis/redis.conf)
redis.conf文件中配置了,注解掉即可,或配置多个访问IP
bind 127.0.0.1
或
bind 127.0.0.1 192.168.0.1
报错2
报错:RedisConnectionException: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified,
原因:Linux上的redis处于一种安全保护状态,(bind指令注释将redis暴露),所以外部就无法轻易连接。
Linux: /etc/redis/redis.conf)
总结三种解决方式
1、 bind指令注释去掉,指定IP
bind 127.0.0.1 192.168.0.
2、关闭保护模式
protected-mode no
3、redis设置密码
requirepass 123456
本文标签: SpringBootipRedis
版权声明:本文标题:springboot 通过ip连接redis 失败 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1727688829a1125634.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论