jedis问题之1--connect time out

jedis问题之1–connect time out:
java redis
错误代码:

xubo@xubo:~/cloud/redis/clients/jedis/target/classes$ java forn
Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed out
    at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:201)
    at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
    at redis.clients.jedis.Protocol.process(Protocol.java:141)
    at redis.clients.jedis.Protocol.read(Protocol.java:205)
    at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297)
    at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:196)
    at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:85)
    at redis.clients.jedis.Connection.sendCommand(Connection.java:100)
    at redis.clients.jedis.Connection.sendCommand(Connection.java:91)
    at redis.clients.jedis.BinaryClient.auth(BinaryClient.java:538)
    at redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2012)
    at forn.main(forn.java:5)
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:152)
    at java.net.SocketInputStream.read(SocketInputStream.java:122)
    at java.net.SocketInputStream.read(SocketInputStream.java:108)
    at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:195)
    ... 11 more

修改连接时间:

Jedis test =new Jedis("localhost",6379,100000);

默认是2000,改为100000为100s,可根据需求改。

参考:pool = new JedisPool(config, host, port, 100000);
为尝试,可以试试

你可能感兴趣的:(java,redis,jedis)