Redis HA with Sentinel

a year ago

Description: Redis replica set with Sentinel for automated failover

Category: Storage

URL: https://railway.app/template/ha-redis

5 Replies

siltonnPRO

8 months ago

How do I connect to this redis cluster using the redis client, which doesn't seem to be supported by the current configuration?


8 months ago

Hi siltonn, you can find an example client config here using ioredis: https://github.com/railwayapp-templates/redis-ha-sentinel/blob/main/exampleApps/node/server.js

What client are you implementing?


siltonnPRO

8 months ago

Hi siltonn, you can find an example client config here using ioredis: https://github.com/railwayapp-templates/redis-ha-sentinel/blob/main/exampleApps/node/server.js

What client are you implementing?

I'm trying to use https://redis.tinycraft.cc/ to connect to redis to manage and view details, to it seems like it's not supported right now. I'm developing the backend with nestjs and I've seen examples of nodejs which is well supported in railway. But there are times when we need to view and manage the key in the manager client.


8 months ago

Hey! I'm so sorry, I didn't get a notification for your response. I will look into this and get back to you!


7 months ago

Hey @siltonn! I have to apologize again for the delay. I was finally able to dig in here and found a solution that seems to work.

The Tiny RDM documentation leaves much to be desired around connection information, and there doesn't appear to be a way to connect to all sentinels, but perhaps you can take this information further..

To connect via Tiny RDM -

  • enable the TCP Proxy on one of the Sentinel nodes

  • set the TCP Port to 26379 (this is the port that Sentinel listens on)

  • Redeploy the Sentinel service

  • deploy a Tailscale service to enable tunneling into the private network, which is how the nodes communicate to each other.

  • create a new connection in Tiny RDM, using the TCP Proxy domain and port that you created above.

    • be sure to set the Redis password (should be the REDIS_PASSWORD value in the sentinel service's variables in Railway)

  • within the Sentinel menu in Tiny RDM, check "As Sentinel Node" and set the appropriate master redis password (you can find this in the service variables within Railway as REDIS_MASTER_PASSWORD)

Let me know if you have any problems, I'm
happy to continue troubleshooting with you