Jedis连接失败解决:JedisConnectionException: Failed connecting to host localhost:6379

今天在使用Jedis连接redis时报如下错误

Jedis连接失败解决:JedisConnectionException: Failed connecting to host localhost:6379

此时我的redis服务器端已正常打开,经过查看发现没有将bind注释掉以及关闭保护模式。

Jedis连接失败解决:JedisConnectionException: Failed connecting to host localhost:6379

解决方法为修改redis.conf配置,将此句注释。

Jedis连接失败解决:JedisConnectionException: Failed connecting to host localhost:6379

并将protected-mode修改为no

Jedis连接失败解决:JedisConnectionException: Failed connecting to host localhost:6379

之后重启redis-server即可。