You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
... the documentation does not mention anything about my problem
... there are no open or closed issues that are related to my problem
Description
I have a working set-up using redis sentinel. I wanted to implement distributed poller set-up with redis using sentinel as the locking mechanism. Implementing redis-sentinel was not easy, but getting it to work with librenms was even harder as the docs is lacking.
I had some issues with dispatcher container not connecting to my redis-sentinel host and it it turns out having both the environment variable REDIS_HOST & REDIS_SENTINEL variable will cause issues.
So, the main issue as it is today is that both the dispatcher service (python) and librenms (php) requires redis backend. While the dispatcher service supports redis sentinel for discovering redis-master, the librenms application does not. See issue librenms/librenms#16792
The default for all docker services is to include the librenms.env as an env_file effectively setting all the variables defined in the file as environment variables inside the service. While this is handy, this will also cause issues when you want to use the REDIS_SENTINEL environment variable. The issue is that the env-variable REDIS_HOST is preferred over REDIS_SENTINEL as it happens in this IF-case here:
The log-line Setting Redis is the hint we need that tells us sentinel is not being used for locking mechanism! So, instead we can modify the compose.yml and override REDIS_HOST by setting it manually in environment-section to an empty value:
So now the dispatcher service can connect to the sentinel host to get true master :)
If you so happens to have a password protected redis-host for the master and replica nodes (which you should BTW!), the password stored in REDIS_SENTINEL_PASSWORD will not used to connect to the true replica master.
The password specified in the varaible REDIS_SENTINEL_PASSWORD will only be used for connecting to the sentinel hosts to get true master. It will not be used for the actual redis hosts. It so happens that you can have different passwords for sentinel and actual redis hosts! For the dispatcher to connect to the redis master it also needs to password which is set in environment variable REDIS_PASSWORD.
In the end this is what my dispatcher-service config looks like in compose:
Support guidelines
I've found a bug and checked that ...
Description
I have a working set-up using redis sentinel. I wanted to implement distributed poller set-up with redis using sentinel as the locking mechanism. Implementing redis-sentinel was not easy, but getting it to work with librenms was even harder as the docs is lacking.
I had some issues with dispatcher container not connecting to my redis-sentinel host and it it turns out having both the environment variable
REDIS_HOST
&REDIS_SENTINEL
variable will cause issues.So, the main issue as it is today is that both the dispatcher service (python) and librenms (php) requires redis backend. While the dispatcher service supports redis sentinel for discovering redis-master, the librenms application does not. See issue librenms/librenms#16792
The default for all docker services is to include the
librenms.env
as an env_file effectively setting all the variables defined in the file as environment variables inside the service. While this is handy, this will also cause issues when you want to use theREDIS_SENTINEL
environment variable. The issue is that the env-variableREDIS_HOST
is preferred overREDIS_SENTINEL
as it happens in this IF-case here:docker/rootfs/etc/cont-init.d/05-svc-dispatcher.sh
Line 97 in 1d7c972
So if the user sets the environment-variables as specified in the docs for distributed poller configuration inside the
.env
:and then include the variables in the compose.yml file:
it will simply not work and you will see errors in the logs
docker compose logs
The log-line
Setting Redis
is the hint we need that tells us sentinel is not being used for locking mechanism! So, instead we can modify the compose.yml and overrideREDIS_HOST
by setting it manually in environment-section to an empty value:So now the dispatcher service can connect to the sentinel host to get true master :)
If you so happens to have a password protected redis-host for the master and replica nodes (which you should BTW!), the password stored in
REDIS_SENTINEL_PASSWORD
will not used to connect to the true replica master.The password specified in the varaible
REDIS_SENTINEL_PASSWORD
will only be used for connecting to the sentinel hosts to get true master. It will not be used for the actual redis hosts. It so happens that you can have different passwords for sentinel and actual redis hosts! For the dispatcher to connect to the redis master it also needs to password which is set in environment variableREDIS_PASSWORD
.In the end this is what my dispatcher-service config looks like in compose:
Expected behaviour
.
Actual behaviour
.
Steps to reproduce
.
Docker info
Docker Compose config
.
Logs
Additional info
.
The text was updated successfully, but these errors were encountered: