首页 >数据库 >Redis >redis异常原因及解决方案

redis异常原因及解决方案

王林
王林转载
2021-03-15 09:34:294373浏览

redis异常原因及解决方案

下面是工作中遇到的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异常原因及解决方案的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文转载于:cnblogs.com。如有侵权,请联系admin@php.cn删除