jedis连接远程redis出现
Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: Failed to connect to any host resolved for DNS name.
springboot出现
org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to xxx.xxx.xxx.xxx:6379
首先进入配置文件(我的配置文件在redisConfig/redis.conf目录下)
[root@zhaookee bin]# vim redisConfig/redis.conf
输入==/关键字==即可查找
1、注释bind
2、关闭保护模式
3、打开后台启动
4、此处最好设置一个密码
5、重启redis
[root@zhaookee bin]# redis-cli
127.0.0.1:6379> shutdown
not connected> quit
[root@zhaookee bin]# redis-server redisConfig/redis.conf
6、打开阿里云安全组
7、关闭防火墙
[root@zhaookee bin]# firewall-cmd --zone=public --permanent --add-port=6379/tcp
[root@zhaookee bin]# systemctl restart firewalld.service
[root@zhaookee bin]# firewall-cmd --list-all
完成以上操作就可以正常访问了