JedisConnectionException: java.net.SocketTimeoutException: connection timeout

I use jedis for a simple data store with a key ... 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 the redis server with the 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 anybody help?

+4
source share
2 answers

Question:

Answer:

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

Next question:

  • I cannot get to the Redis instance hosted by Redis4you, even via telnet, although the Redis4you portal claims to be running. How to debug the root cause of this problem?

Answer:

Contact Redis4You and find out. On the Redis4You contact page:

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


Also looking at their Twitter feed on October 17, they β€œupgraded the system to the recently released Redis 2.4.0. You need to stop and then start your instance for the update to happen for you.”

+3
source

if ubuntu: sudo ufw allows 2863 / tcp or close the firewall

-1
source

Source: https://habr.com/ru/post/1380515/


All Articles