io.lettuce.core.RedisConnectionException: Unable to connect to localhost/<unresolved>:6379
时间: 2023-10-26 14:27:03 浏览: 332
Host 'localhost' Not Allowed To Connect To Server
io.lettuce.core.RedisConnectionException: Unable to connect to localhost/<unresolved>:6379是一个与redis连接相关的异常。根据引用内容,这个异常可能是由于以下几个原因之一引起的:
1. 防火墙问题:可能是服务器的防火墙拦截了与Redis的连接请求。你可以检查阿里云或者腾讯云实例的安全组设置,确保端口6379被开放。
2. Redis配置问题:可能是Redis的配置文件中只允许本地连接,而不允许远程连接。你可以找到Redis的redis.conf配置文件,将bind选项的值从127.0.0.1改为0.0.0.0,或者将其注释掉。
3. 端口访问限制:默认情况下,Redis的默认端口号6379不允许进行远程连接。你可以在Linux中执行/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT命令,以开放端口6379作为远程服务。
综上所述,当出现io.lettuce.core.RedisConnectionException: Unable to connect to localhost/<unresolved>:6379的异常时,你可以检查防火墙设置、Redis配置以及端口访问限制来解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Unable to connect to ... nested exception is io.lettuce.core.RedisConnectionException: 我的解决办法](https://blog.csdn.net/ohh_lang/article/details/106067037)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [11-05关于Spring连接远程redis 一直报连接超时(Caused by: io.lettuce.core.RedisConnectionException:...](https://blog.csdn.net/weixin_44680569/article/details/109513630)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文