JedisConnectionException: java.net.SocketTimeoutException: connect timed out

diya picture diya · Nov 10, 2011 · Viewed 22.7k times · Source

I'm using jedis for simple key-value data store... My code is as follows

private static final String HOST = "50.30.35.9"; 
private static final int PORT = 2863;    
Jedis jedis = new Jedis(HOST, PORT); 

  try { 
      jedis.set("foo", "bar"); 
      jedis.get("foo"); 
  } catch (Exception e) { 
      System.err.println("Unable to connect to Redis"); 
      e.printStackTrace(); 
  } 

When i test redis server with jedis client, i got the following exception.

 redis.clients.jedis.exceptions.JedisConnectionException: 
 java.net.SocketTimeoutException: connect timed out 
         at redis.clients.jedis.Connection.connect(Connection.java:124) 
         at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:  54) 
         at redis.clients.jedis.Connection.sendCommand(Connection.java:  77) 
         at redis.clients.jedis.BinaryClient.set(BinaryClient.java:71) 
         at redis.clients.jedis.Client.set(Client.java:21) 
         at redis.clients.jedis.Jedis.set(Jedis.java:48)

Can someone please help?

Answer

tolitius picture tolitius · Nov 10, 2011

The question is:

The answer is:

Because you cannot connect to the host and port you have in your code, since you cannot telnet 50.30.35.9 2863 to it.

The follow up question is:

  • I am unable to reach the Redis instance hosted by Redis4you even via telnet, even though the Redis4you portal claims it is running. How do I debug the root cause of this issue?

The answer is:

Contact Redis4You, and find out. From Redis4You contact page:

=> You can contact us with questions or for support issues at following email: redis (@) e-nick . org In case of problems with status of the servers, please follow our Twitter account: redis4you. You can also post comments and questions there, but email will be easier and faster way.


Also looking at their Twitter feed on October 17th they "have upgraded the system to newly released Redis 2.4.0. You need to stop and then start your instance so the upgrade to happen for you."