远程连接不上reids
承接spring线程中无法创建bean,我需要用到redis,于是问公司要了台基本上没用的服务器,安装了redis。然后执行代码的时候一直报
1: org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
2: Caused by: java.net.ConnectException: Connection refused: connect
这两个错误

造成这两个的原因:
- 地址和端口号不对 比如说我redis的地址是 192.168.2.225,但是我写成了
- 可能是防火墙没关
- 其实看其他的博文说redis中还可能有个绑定本机地址127.0.0.1的配置文件,只需要把他注释掉就好
我没遇到过第三种情况,可能是redis.conf里的配置,如果以上两个原因帮助不了你的话,可以参考第三个问题去百度,会有很多博文的。
我遇到的是第二种情况,当时想到了会是防火墙的原因,但是我没想到他们居然用的firewalld,最后还是问的公司的人他们用的什么防火墙才解决的问题。
firewalld 停止 :systemctl stop firewalld.service