1、代码
Jedis jedis = new Jedis("192.168.88.151",6379);
2、开启6379端口
//查看6379端口是否开启--yes是开启;no是关闭
firewall-cmd --query-port=6379/tcp
//开启6379端口
firewall-cmd --zone=public --add-port=6379/tcp --permanent
//重启使生效
firewall-cmd --reload
//再次查看6379端口是否成功开启
firewall-cmd --query-port=6379/tcp
//查看已经开启的端口
firewall-cmd --list-ports
3、关闭防火墙
//查看防火墙状态
systemctl status firewalld
//关闭防火墙
systemctl stop firewalld
//查看是否正确关闭防火墙
systemctl status firewalld
然后就能够正确连接到啦~~~~
标签:Java,6379,--,虚拟机,cmd,端口,开启,firewall,本机 From: https://www.cnblogs.com/liuzijin/p/17827399.html