远程连接Redis时出现: java.net.SocketTimeoutException: connect timed out

i奇异

关注

阅读 74

2022-04-25

远程连接Redis时出现: java.net.SocketTimeoutException: connect timed out
1.关闭Redis的防火墙【不建议使用】

sudo systemctl stop firewalld.service #停止firewall
sudo systemctl disable firewalld.service #停止firewall开机启动

2.修改redis中的redis.conf 文件-首先开发端口:

firewall-cmd --zone=public --add-port=6379/tcp --permanent # 开放9200端口
firewall-cmd --zone=public --remove-port=6379/tcp --permanent #关闭9200端口
firewall-cmd --reload # 配置立即生效
2.1,注释掉 bind 127.0.0.1
2.2,必须关闭主机保护模式,将protected-mode yes 的yes 改为 no
2.3,修改密码,将requirepass foobared 后面的 foobared 修改为自己设定的密码,比如:123456

3.重启redis

在这里插入图片描述

精彩评论(0)

0 0 举报