If your Redis cluster is hosted somewhere on the cloud and you are wondering whether you can connect to your Redis cluster or not, here I will show you how you can quickly check if your Redis Remote Server is running and accepting connections.
Prerequisites
- Redis Cluster
- sudo privileges
- redis-cli installed
Solution
- Telnet should be the first and the easiest thing that you can try. You can change your Redis port and endpoint accordingly.
telnet redis.endpoint.com 6379
If the connection is successfully established you will get:
Trying 10.140.110.121... Connected to redis.endpoint.com. Escape character is '^]'.
- Another proper way is to use
redis-cli
.redis-cli -h redis.endpoint.com -p 6379
Output:
10.140.110.121>PING PONG
- If you don’t receive the above outputs, probably your Redis Cluster either has a firewall that blocks you, it’s within a private network or the cluster is down.
Conclusion
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.