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?
source share