Exception in thread “main” redis.clients.jedis.exceptions.JedisConnectionException: Failed connecting to 192.168.112.164:6379
1、注释掉bind,protected-mode为no
2、输入以下代码命令
//打开防火墙6379端口号
[root@localhost admin]# firewall-cmd --state
running
[root@localhost admin]# firewall-cmd --permanent --add-port=6379/tcp
success
[root@localhost admin]# firewall-cmd --permanent --query-port=6379/tcp
yes
[root@localhost admin]# firewall-cmd --permanent --list-ports
6379/tcp
[root@localhost admin]# firewall-cmd --reload
success
//重启redis
[root@localhost admin]# cd redis-6.2.4/
[root@localhost redis-6.2.4]# src/redis-cli -p 6379 shutdown
[root@localhost redis-6.2.4]# src/redis-server redis.conf