標籤:rgs test gets 問題 blog 異常 tin redis伺服器 .com
環境說明:
redis伺服器系統:ubuntu ip 192.168.10.9port 6379兩台電腦:一個作為專門的伺服器,一個是開發環境
就這樣的簡單的代碼串連redis伺服器
import redis.clients.jedis.Jedis;public class Test {public static void main(String[] args) {Jedis jedis = new Jedis("192.168.10.9");jedis.auth("ldd");jedis.set("age", "1"); System.out.println(jedis.get("age"));}}
但是卻出現了下面的異常:
Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed outat redis.clients.jedis.Protocol.process(Protocol.java:79)at redis.clients.jedis.Protocol.read(Protocol.java:131)at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:162)at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:72)at redis.clients.jedis.Connection.sendCommand(Connection.java:79)at redis.clients.jedis.Connection.sendCommand(Connection.java:75)at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:499)at redis.clients.jedis.Jedis.auth(Jedis.java:1963)at testfinal.Test.main(Test.java:8)Caused by: java.net.SocketTimeoutException: Read timed outat java.net.SocketInputStream.socketRead0(Native Method)at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)at java.net.SocketInputStream.read(SocketInputStream.java:170)at java.net.SocketInputStream.read(SocketInputStream.java:141)at java.net.SocketInputStream.read(SocketInputStream.java:127)at redis.clients.util.RedisInputStream.fill(RedisInputStream.java:109)at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:45)at redis.clients.jedis.Protocol.process(Protocol.java:64)... 8 more
重點是:用用戶端就能正常串連。
真的,需要研究一下原因。
不知道有沒有知道的朋友可以指點一二。
關於Jedis串連redis出現問題