Home  >  Article  >  Database  >  Reasons and solutions for redis exceptions

Reasons and solutions for redis exceptions

王林
王林forward
2021-03-15 09:34:294327browse

Reasons and solutions for redis exceptions

The following are redis exception problems encountered at work, and the reasons and solutions for the exceptions are given at the end of the article. I hope it will be helpful to everyone.

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

The reason for the exception:

The firewall of the liunx server does not allow port 6379 to be accessed from the external network

Solution:

vim   /etc/sysconfig/iptables

Related recommendations: redis database tutorial

The above is the detailed content of Reasons and solutions for redis exceptions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete