cannot connect to new redis cluster

i have the following code, but cannot connect to redis after redis cluster creation:

    public static void main(String[] args) {
        // Connect to Redis server running on localhost
          Jedis jedis = new Jedis("45-56-82-40.ip.linodeusercontent.com", 6379);


        // Close the connection
        jedis.close();
    }

error:
Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: Failed to connect to any host resolved for DNS name.
at redis.clients.jedis.DefaultJedisSocketFactory.connectToFirstSuccessfulHost(DefaultJedisSocketFactory.java:63)
at redis.clients.jedis.DefaultJedisSocketFactory.createSocket(DefaultJedisSocketFactory.java:87)
at redis.clients.jedis.Connection.connect(Connection.java:195)
at redis.clients.jedis.Connection.sendCommand(Connection.java:167)
at redis.clients.jedis.Connection.executeCommand(Connection.java:136)
at redis.clients.jedis.Jedis.set(Jedis.java:4893)
at RedisConnection.main(RedisConnection.java:13)
Suppressed: java.net.SocketTimeoutException: Connect timed out

1 Reply

According to this public forum, it was suggested that you check if Redis is running on port 6379 by checking whether the Redis service is up and whether the port is open. I recommend checking if port 6379 is open in case this is blocking you from accessing your Redis cluster. We have a great guide that can walk you through on troubleshooting your firewalls and this other guide can walk you through troubleshooting your connection:

I was also able to find Redis's general guide on troubleshooting Redis clusters that may prove useful to you:

Additionally, my colleague wrote up this great post on checking your databases services that can provide some basic troubleshooting steps. She goes in depth about ensuring your services are enabled, how to view your service logs, and provides additional resources on how to narrow down the root issue:

Lastly, if you're still encountering difficulties with accessing your cluster, a great place for follow-up questions who may be experts in using Redis is Redis's official forum:

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct