使用Jedis在客户端连接轻量服务器时要进行以下步骤:
1.修改配置文件
注释掉bind,protected-mode为no
2.查看远程服务器的防火墙状态并开启
systemctl status firewalld
开启防火墙
systemctl start firewalld
(关闭防火墙 systemctl stop firewalld)
3.开放6379端口b并重启
//查看防火墙状态
firewall-cmd --state
//开放6379端口
firewall-cmd --permanent --add-port=6379/tcp
//查看端口,执行
firewall-cmd --permanent --query-port=6379/tcp
firewall-cmd --permanent --list-ports
//重启防火墙
firewall-cmd --reload
4.重启redis
redis-cli -p 6379 shutdown
redis-server /usr/local/software/myRedis/redis6379.conf
第一次连接要这样,以后连接一般只需开启防火墙。