mirror of
https://github.com/librenms/docker.git
synced 2026-08-03 07:13:11 +00:00
add redis sentinel support (#141)
* add redis sentinel support * update redis requirement warning to include REDIS_SENTINEL * update docs
This commit is contained in:
parent
d933e76783
commit
0c3e84d931
2 changed files with 23 additions and 7 deletions
|
|
@ -22,6 +22,8 @@
|
|||
* `DISPATCHER_NODE_ID`: Unique node ID for your dispatcher service
|
||||
* `DISPATCHER_ARGS`: Additional args to pass to the [dispatcher service](https://github.com/librenms/librenms/blob/master/librenms-service.py)
|
||||
* `REDIS_HOST`: Redis host for poller synchronization
|
||||
* `REDIS_SENTINEL`: Redis Sentinel host for high availability Redis cluster
|
||||
* `REDIS_SENTINEL_SERVICE`: Redis Sentinel service name (default `librenms`)
|
||||
* `REDIS_PORT`: Redis port (default `6379`)
|
||||
* `REDIS_PASSWORD`: Redis password
|
||||
* `REDIS_DB`: Redis database (default `0`)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ SIDECAR_DISPATCHER=${SIDECAR_DISPATCHER:-0}
|
|||
|
||||
#REDIS_HOST=${REDIS_HOST:-localhost}
|
||||
REDIS_PORT=${REDIS_PORT:-6379}
|
||||
#REDIS_SENTINEL=${REDIS_SENTINEL:-localhost}
|
||||
REDIS_SENTINEL_SERVICE=${REDIS_SENTINEL_SERVICE:-librenms}
|
||||
file_env 'REDIS_PASSWORD'
|
||||
REDIS_DB=${REDIS_DB:-0}
|
||||
|
||||
|
|
@ -85,18 +87,30 @@ if [ -n "$DISPATCHER_NODE_ID" ]; then
|
|||
sed -i "s|^NODE_ID=.*|NODE_ID=$DISPATCHER_NODE_ID|g" "${LIBRENMS_PATH}/.env"
|
||||
fi
|
||||
|
||||
# Redis
|
||||
if [ -z "$REDIS_HOST" ]; then
|
||||
>&2 echo "ERROR: REDIS_HOST must be defined"
|
||||
exit 1
|
||||
fi
|
||||
echo "Setting Redis"
|
||||
cat >> ${LIBRENMS_PATH}/.env <<EOL
|
||||
# Redis Sentinel
|
||||
if [ -n "REDIS_SENTINEL" ]; then
|
||||
echo "Setting Redis Sentinel"
|
||||
cat >> ${LIBRENMS_PATH}/.env <<EOL
|
||||
REDIS_SENTINEL=${REDIS_SENTINEL}
|
||||
REDIS_SENTINEL_SERVICE=${REDIS_SENTINEL_SERVICE}
|
||||
REDIS_PORT=${REDIS_PORT}
|
||||
REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
REDIS_DB=${REDIS_DB}
|
||||
EOL
|
||||
else
|
||||
# Redis
|
||||
if [ -z "$REDIS_HOST" ]; then
|
||||
>&2 echo "ERROR: REDIS_HOST or REDIS_SENTINEL must be defined"
|
||||
exit 1
|
||||
fi
|
||||
echo "Setting Redis"
|
||||
cat >> ${LIBRENMS_PATH}/.env <<EOL
|
||||
REDIS_HOST=${REDIS_HOST}
|
||||
REDIS_PORT=${REDIS_PORT}
|
||||
REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
REDIS_DB=${REDIS_DB}
|
||||
EOL
|
||||
fi
|
||||
|
||||
# Create service
|
||||
mkdir -p /etc/services.d/dispatcher
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue