以下是工作中遇到的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中文網其他相關文章!