1

Bascially I am trying to setup a single Redis-sentinel docker instance and want to make calls from my app container. The issue I am running is this - the redis-sentinel container is linked to the app container.

So, initially the app asks the sentinel process about the redis master. The sentinel then says it is "127.0.0.1". But the app container assumes that it is local to the container. This can be overcome with announce-ip/announce-port parameters passed at the start of sentinel process. However, the issue is this -

the redis-sentinel container tries to start up before the link is being established. So even during the time of sentinel process launch the network interface hence the link IP is not available.

One solution I could think of is to busy wait till the network interface is established. So, the question then boils down to "how can source container discover its newly established network interface? Is there anything docker sets on the source container for it to discover different links?"

The linking is all managed in docker-compose file.

If there is any other simple solution, I am welcome to try that as well.

user1489580
  • 45
  • 2
  • 5

3 Answers3

0

There is no need for a custom sentinel image, or messing with the network. See my redis-ha-learning project using Spring Data Redis, bitnami/redis and bitnami/redis-sentinel images. The Docker Compose file is here. My code auto detects the sentinels based on the Docker Compose container names.

Abhijit Sarkar
  • 21,927
  • 20
  • 110
  • 219
0

I have this configuration example here using docker compose that can be of help.

https://github.com/oneyottabyte/redis_sentinel

-1

So, the solution that worked for me is simply reading the /etc/hosts file on the source container. I busy wait till the link is established and then use that network interface IP to start the sentinel process. This is just a stop gap solution and it is not scalable. Redis-sentinel is still not production ready in dockerizable format as confirmed in this post. So I decided to install Redis/sentinel on the physical hosts.

Community
  • 1
  • 1
user1489580
  • 45
  • 2
  • 5