当前位置 : 主页 > 数据库 > redis >

redis异常原因及解决方案

来源:互联网 收集:自由互联 发布时间:2021-08-12
下面是工作中遇到的redis异常问题,并在文章末尾给出了异常出现的原因及解决方案,希望对大家有所帮助。 Exception in thread main redis.clients.jedis.exceptions.JedisConnectionException: java.net.Socke

下面是工作中遇到的redis异常问题,并在文章末尾给出了异常出现的原因及解决方案,希望对大家有所帮助。

Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: connect timed out
at redis.clients.jedis.Connection.connect(Connection.java:155)
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:83)
at redis.clients.jedis.Connection.sendCommand(Connection.java:94)
at redis.clients.jedis.Connection.sendCommand(Connection.java:89)
at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:539)
at redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2000)
at com.cheguanjia.test.Jdeis.main(Jdeis.java:20)
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at redis.clients.jedis.Connection.connect(Connection.java:149)
... 6 more

异常出现的原因:

liunx服务器的防火墙没有把6379的端口给外网访问

解决方案:

vim   /etc/sysconfig/iptables

相关推荐:redis数据库教程

以上就是redis异常原因及解决方案的详细内容,更多请关注自由互联其它相关文章!

网友评论