From 99112d2ac1a04a8faca7c17ec59b586b126b65e0 Mon Sep 17 00:00:00 2001 From: Quyen Tran Date: Fri, 11 Jun 2021 17:11:08 +0700 Subject: [PATCH 01/11] add authenticate --- README.md | 8 ++++++++ docker-entrypoint.sh | 13 +++++++++++-- redis-cluster.tmpl | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7465ccc..60ba49e 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,14 @@ Unfortunately Docker does not handle IPv6 NAT so, when acceptable, `--network ho # Example using plain docker docker run -e "IP=::1" -e "BIND_ADDRESS=::" --network host grokzen/redis-cluster:latest +## Enable authentication +By default, authentication using a password is disabled. +This is configurable by an enviroment variable that specifies which a password string is required to authenticate itself using the AUTH command. + +| Environment variable | Default | +| -------------------- | ------------------------------------------ | +| `PASSWORD` | "" (requirepass/masterauth not configured) | + ## Build alternative redis versions diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 0b2e67f..241c8cd 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -56,7 +56,11 @@ if [ "$1" = 'redis-cluster' ]; then fi if [ "$port" -lt "$first_standalone" ]; then - PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} envsubst < /redis-conf/redis-cluster.tmpl > /redis-conf/${port}/redis.conf + if [ -n "$PASSWORD" ]; then + requirepass="requirepass '${PASSWORD}'" + masterauth="masterauth '${PASSWORD}'" + fi + PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} REQUIREPASS=${requirepass} MASTERAUTH=${masterauth} envsubst < /redis-conf/redis-cluster.tmpl > /redis-conf/${port}/redis.conf nodes="$nodes $IP:$port" else PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} envsubst < /redis-conf/redis.tmpl > /redis-conf/${port}/redis.conf @@ -88,7 +92,12 @@ if [ "$1" = 'redis-cluster' ]; then echo "yes" | eval ruby /redis/src/redis-trib.rb create --replicas "$SLAVES_PER_MASTER" "$nodes" else echo "Using redis-cli to create the cluster" - echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" "$nodes" + if [ -z "$PASSWORD" ]; then + echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" "$nodes" + password_arg="-a $PASSWORD" + else + echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" -a "$PASSWORD" "$nodes" + fi fi if [ "$SENTINEL" = "true" ]; then diff --git a/redis-cluster.tmpl b/redis-cluster.tmpl index 8205123..f634977 100644 --- a/redis-cluster.tmpl +++ b/redis-cluster.tmpl @@ -5,3 +5,5 @@ cluster-config-file nodes.conf cluster-node-timeout 5000 appendonly yes dir /redis-data/${PORT} +${REQUIREPASS} +${MASTERAUTH} \ No newline at end of file From c9fb47536e214ed8d6d4c1e7a2d7cf3fb47d433e Mon Sep 17 00:00:00 2001 From: Quyen Tran Date: Fri, 11 Jun 2021 17:16:14 +0700 Subject: [PATCH 02/11] add authenticate redis standalone --- docker-entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 241c8cd..5a6cbff 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -63,7 +63,10 @@ if [ "$1" = 'redis-cluster' ]; then PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} REQUIREPASS=${requirepass} MASTERAUTH=${masterauth} envsubst < /redis-conf/redis-cluster.tmpl > /redis-conf/${port}/redis.conf nodes="$nodes $IP:$port" else - PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} envsubst < /redis-conf/redis.tmpl > /redis-conf/${port}/redis.conf + if [ -n "$PASSWORD" ]; then + requirepass="requirepass '${PASSWORD}'" + fi + PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} REQUIREPASS=${requirepass} envsubst < /redis-conf/redis.tmpl > /redis-conf/${port}/redis.conf fi if [ "$port" -lt $(($INITIAL_PORT + $MASTERS)) ]; then From d8cb6ce6c1f9b68f0f22f1fc7693d117c35240d3 Mon Sep 17 00:00:00 2001 From: Quyen Tran Date: Fri, 11 Jun 2021 17:33:24 +0700 Subject: [PATCH 03/11] fix build docker --- redis.tmpl | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 redis.tmpl diff --git a/redis.tmpl b/redis.tmpl new file mode 100644 index 0000000..e06530a --- /dev/null +++ b/redis.tmpl @@ -0,0 +1,5 @@ +bind ${BIND_ADDRESS} +port ${PORT} +appendonly yes +dir /redis-data/${PORT} +${REQUIREPASS} \ No newline at end of file From 69063b99dd74081e199072209f19b47ad8531f35 Mon Sep 17 00:00:00 2001 From: Quyen Tran Date: Sat, 12 Jun 2021 11:58:55 +0700 Subject: [PATCH 04/11] add protected-mode --- README.md | 8 ++++++++ docker-entrypoint.sh | 10 ++++++++-- redis-cluster.tmpl | 3 ++- redis.tmpl | 3 ++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 60ba49e..76d913b 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,14 @@ This is configurable by an enviroment variable that specifies which a password s | -------------------- | ------------------------------------------ | | `PASSWORD` | "" (requirepass/masterauth not configured) | +## Protected mode +By default, Protected mode is enabled. +This is configurable by an enviroment variable that specifies which the system administator can still ignore the error given by Redis and just disable protected mode or manually bind all the interfaces. + +| Environment variable | Default | +| -------------------- | ------------------------------------------ | +| `PROTECTED_MODE` | "" (protected-mode is yes) | + ## Build alternative redis versions diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 5a6cbff..6f54a0d 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -54,19 +54,25 @@ if [ "$1" = 'redis-cluster' ]; then if [ -e /redis-data/${port}/appendonly.aof ]; then rm /redis-data/${port}/appendonly.aof fi + + if [ -z "$PROTECTED_MODE" -o "$PROTECTED_MODE" = "true" ]; then + protectedmode="prorected-mode 'yes'" + elif [ "$PROTECTED_MODE" = "false" ]; then + protectedmode="prorected-mode 'no'" + fi if [ "$port" -lt "$first_standalone" ]; then if [ -n "$PASSWORD" ]; then requirepass="requirepass '${PASSWORD}'" masterauth="masterauth '${PASSWORD}'" fi - PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} REQUIREPASS=${requirepass} MASTERAUTH=${masterauth} envsubst < /redis-conf/redis-cluster.tmpl > /redis-conf/${port}/redis.conf + PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} REQUIREPASS=${requirepass} MASTERAUTH=${masterauth} PROTECTED_MODE=${protectedmode} envsubst < /redis-conf/redis-cluster.tmpl > /redis-conf/${port}/redis.conf nodes="$nodes $IP:$port" else if [ -n "$PASSWORD" ]; then requirepass="requirepass '${PASSWORD}'" fi - PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} REQUIREPASS=${requirepass} envsubst < /redis-conf/redis.tmpl > /redis-conf/${port}/redis.conf + PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} REQUIREPASS=${requirepass} PROTECTED_MODE=${protectedmode} envsubst < /redis-conf/redis.tmpl > /redis-conf/${port}/redis.conf fi if [ "$port" -lt $(($INITIAL_PORT + $MASTERS)) ]; then diff --git a/redis-cluster.tmpl b/redis-cluster.tmpl index f634977..f1865b9 100644 --- a/redis-cluster.tmpl +++ b/redis-cluster.tmpl @@ -6,4 +6,5 @@ cluster-node-timeout 5000 appendonly yes dir /redis-data/${PORT} ${REQUIREPASS} -${MASTERAUTH} \ No newline at end of file +${MASTERAUTH} +${PROTECTED_MODE} diff --git a/redis.tmpl b/redis.tmpl index e06530a..de2256d 100644 --- a/redis.tmpl +++ b/redis.tmpl @@ -2,4 +2,5 @@ bind ${BIND_ADDRESS} port ${PORT} appendonly yes dir /redis-data/${PORT} -${REQUIREPASS} \ No newline at end of file +${REQUIREPASS} +${PROTECTED_MODE} From 0837083071a3ad23b1e505f12427c5962da1b6fb Mon Sep 17 00:00:00 2001 From: Quyen Tran Date: Sat, 12 Jun 2021 12:12:08 +0700 Subject: [PATCH 05/11] fix protected-mode --- docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 6f54a0d..9e5a9d8 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -56,9 +56,9 @@ if [ "$1" = 'redis-cluster' ]; then fi if [ -z "$PROTECTED_MODE" -o "$PROTECTED_MODE" = "true" ]; then - protectedmode="prorected-mode 'yes'" + protectedmode="prorected-mode yes" elif [ "$PROTECTED_MODE" = "false" ]; then - protectedmode="prorected-mode 'no'" + protectedmode="prorected-mode no" fi if [ "$port" -lt "$first_standalone" ]; then From ea20e40a1bb429c7b742ffa58237cb5e8d5d77db Mon Sep 17 00:00:00 2001 From: Quyen Tran Date: Sat, 12 Jun 2021 12:20:36 +0700 Subject: [PATCH 06/11] stupid --- docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 9e5a9d8..4cddfa7 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -56,9 +56,9 @@ if [ "$1" = 'redis-cluster' ]; then fi if [ -z "$PROTECTED_MODE" -o "$PROTECTED_MODE" = "true" ]; then - protectedmode="prorected-mode yes" + protectedmode="protected-mode yes" elif [ "$PROTECTED_MODE" = "false" ]; then - protectedmode="prorected-mode no" + protectedmode="protected-mode no" fi if [ "$port" -lt "$first_standalone" ]; then From 87220e4229044a7c341bc41421b36b089d331d69 Mon Sep 17 00:00:00 2001 From: QuyenTran93 Date: Mon, 27 Jun 2022 09:31:18 +0700 Subject: [PATCH 07/11] update flag RESET_DATAa --- docker-entrypoint.sh | 56 +++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4cddfa7..adc618d 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -42,17 +42,18 @@ if [ "$1" = 'redis-cluster' ]; then for port in $(seq $INITIAL_PORT $max_port); do mkdir -p /redis-conf/${port} mkdir -p /redis-data/${port} + if [ -z "$RESET_DATA" -o "$RESET_DATA" = "true" ]; then + if [ -e /redis-data/${port}/nodes.conf ]; then + rm /redis-data/${port}/nodes.conf + fi - if [ -e /redis-data/${port}/nodes.conf ]; then - rm /redis-data/${port}/nodes.conf - fi - - if [ -e /redis-data/${port}/dump.rdb ]; then - rm /redis-data/${port}/dump.rdb - fi + if [ -e /redis-data/${port}/dump.rdb ]; then + rm /redis-data/${port}/dump.rdb + fi - if [ -e /redis-data/${port}/appendonly.aof ]; then - rm /redis-data/${port}/appendonly.aof + if [ -e /redis-data/${port}/appendonly.aof ]; then + rm /redis-data/${port}/appendonly.aof + fi fi if [ -z "$PROTECTED_MODE" -o "$PROTECTED_MODE" = "true" ]; then @@ -94,25 +95,26 @@ if [ "$1" = 'redis-cluster' ]; then ## If it is below 5.0 then we use the redis-trib.rb to build the cluster # /redis/src/redis-cli --version | grep -E "redis-cli 3.0|redis-cli 3.2|redis-cli 4.0" + if [ -z "$RESET_DATA" -o "$RESET_DATA" = "true" ]; then + if [ $? -eq 0 ] + then + echo "Using old redis-trib.rb to create the cluster" + echo "yes" | eval ruby /redis/src/redis-trib.rb create --replicas "$SLAVES_PER_MASTER" "$nodes" + else + echo "Using redis-cli to create the cluster" + if [ -z "$PASSWORD" ]; then + echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" "$nodes" + password_arg="-a $PASSWORD" + else + echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" -a "$PASSWORD" "$nodes" + fi + fi - if [ $? -eq 0 ] - then - echo "Using old redis-trib.rb to create the cluster" - echo "yes" | eval ruby /redis/src/redis-trib.rb create --replicas "$SLAVES_PER_MASTER" "$nodes" - else - echo "Using redis-cli to create the cluster" - if [ -z "$PASSWORD" ]; then - echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" "$nodes" - password_arg="-a $PASSWORD" - else - echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" -a "$PASSWORD" "$nodes" - fi - fi - - if [ "$SENTINEL" = "true" ]; then - for port in $(seq $INITIAL_PORT $(($INITIAL_PORT + $MASTERS))); do - redis-sentinel /redis-conf/sentinel-${port}.conf & - done + if [ "$SENTINEL" = "true" ]; then + for port in $(seq $INITIAL_PORT $(($INITIAL_PORT + $MASTERS))); do + redis-sentinel /redis-conf/sentinel-${port}.conf & + done + fi fi tail -f /var/log/supervisor/redis*.log From f6ee25c47ba22c8903d749f8a6fa82e83d642f48 Mon Sep 17 00:00:00 2001 From: QuyenTran93 Date: Thu, 30 Jun 2022 16:19:38 +0700 Subject: [PATCH 08/11] fix flag RESET_DATA --- docker-entrypoint.sh | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index adc618d..2a72172 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -42,7 +42,16 @@ if [ "$1" = 'redis-cluster' ]; then for port in $(seq $INITIAL_PORT $max_port); do mkdir -p /redis-conf/${port} mkdir -p /redis-data/${port} + if [ -n "$RESET_DATA" -a "$RESET_DATA" = "false" ]; then + if [ ! -e /redis-data/${port}/nodes.conf ]; then + RESET_DATA="true" + fi + fi + done + + for port in $(seq $INITIAL_PORT $max_port); do if [ -z "$RESET_DATA" -o "$RESET_DATA" = "true" ]; then + echo "clear data" if [ -e /redis-data/${port}/nodes.conf ]; then rm /redis-data/${port}/nodes.conf fi @@ -55,7 +64,6 @@ if [ "$1" = 'redis-cluster' ]; then rm /redis-data/${port}/appendonly.aof fi fi - if [ -z "$PROTECTED_MODE" -o "$PROTECTED_MODE" = "true" ]; then protectedmode="protected-mode yes" elif [ "$PROTECTED_MODE" = "false" ]; then @@ -94,27 +102,27 @@ if [ "$1" = 'redis-cluster' ]; then ## Check the version of redis-cli and if we run on a redis server below 5.0 ## If it is below 5.0 then we use the redis-trib.rb to build the cluster # - /redis/src/redis-cli --version | grep -E "redis-cli 3.0|redis-cli 3.2|redis-cli 4.0" if [ -z "$RESET_DATA" -o "$RESET_DATA" = "true" ]; then - if [ $? -eq 0 ] - then - echo "Using old redis-trib.rb to create the cluster" - echo "yes" | eval ruby /redis/src/redis-trib.rb create --replicas "$SLAVES_PER_MASTER" "$nodes" + /redis/src/redis-cli --version | grep -E "redis-cli 3.0|redis-cli 3.2|redis-cli 4.0" + if [ $? -eq 0 ] + then + echo "Using old redis-trib.rb to create the cluster" + echo "yes" | eval ruby /redis/src/redis-trib.rb create --replicas "$SLAVES_PER_MASTER" "$nodes" + else + echo "Using redis-cli to create the cluster" + if [ -z "$PASSWORD" ]; then + echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" "$nodes" + password_arg="-a $PASSWORD" else - echo "Using redis-cli to create the cluster" - if [ -z "$PASSWORD" ]; then - echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" "$nodes" - password_arg="-a $PASSWORD" - else - echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" -a "$PASSWORD" "$nodes" - fi + echo "yes" | eval /redis/src/redis-cli --cluster create --cluster-replicas "$SLAVES_PER_MASTER" -a "$PASSWORD" "$nodes" fi + fi - if [ "$SENTINEL" = "true" ]; then - for port in $(seq $INITIAL_PORT $(($INITIAL_PORT + $MASTERS))); do - redis-sentinel /redis-conf/sentinel-${port}.conf & - done - fi + if [ "$SENTINEL" = "true" ]; then + for port in $(seq $INITIAL_PORT $(($INITIAL_PORT + $MASTERS))); do + redis-sentinel /redis-conf/sentinel-${port}.conf & + done + fi fi tail -f /var/log/supervisor/redis*.log From 66f66ac8cf37f260b7f8bf3c39937c390f0ce967 Mon Sep 17 00:00:00 2001 From: QuyenTran93 Date: Sat, 16 Jul 2022 08:19:37 +0700 Subject: [PATCH 09/11] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 76d913b..972ff79 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,14 @@ This is configurable by an enviroment variable that specifies which the system a | -------------------- | ------------------------------------------ | | `PROTECTED_MODE` | "" (protected-mode is yes) | +## Clean redis-data before start redis +By default, All file in folder redis-data will be remove before start redis. +This is configurable by an enviroment variable that specifies which the system administator can handle remove/keep all file in redis-data before start redis. + +| Environment variable | Default | +| -------------------- | ------------------------------------------ | +| `RESET_DATA` | "" (redis-data will be clean) | + ## Build alternative redis versions From 72ab2163f0957f71a3833cedc5ff5f106258dab8 Mon Sep 17 00:00:00 2001 From: QuyenTran93 Date: Thu, 30 Jun 2022 16:56:36 +0700 Subject: [PATCH 10/11] remove log --- docker-entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2a72172..7a945b9 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -51,7 +51,6 @@ if [ "$1" = 'redis-cluster' ]; then for port in $(seq $INITIAL_PORT $max_port); do if [ -z "$RESET_DATA" -o "$RESET_DATA" = "true" ]; then - echo "clear data" if [ -e /redis-data/${port}/nodes.conf ]; then rm /redis-data/${port}/nodes.conf fi From f1e5e64f9d58ac3925d8b5951a1a014527870871 Mon Sep 17 00:00:00 2001 From: QuyenTran93 Date: Mon, 22 Jul 2024 14:49:17 +0700 Subject: [PATCH 11/11] Add flag CLUSTER_PREFERED_ENDPOINT_TYPE to communicated cluster with hostname --- Dockerfile | 10 +++++----- README.md | 8 ++++++++ docker-entrypoint.sh | 8 +++++++- redis-cluster.tmpl | 4 +++- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index cafda1b..6bb6f52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,19 +4,19 @@ FROM redis@sha256:e422889e156ebea83856b6ff973bfe0c86bce867d80def228044eeecf92559 LABEL maintainer="Johan Andersson " # Some Environment Variables -ENV HOME /root -ENV DEBIAN_FRONTEND noninteractive +ENV HOME=/root +ENV DEBIAN_FRONTEND=noninteractive # Install system dependencies RUN apt-get update -qq && \ apt-get install --no-install-recommends -yqq \ - net-tools supervisor ruby rubygems locales gettext-base wget gcc make g++ build-essential libc6-dev tcl && \ + net-tools supervisor ruby rubygems locales locales-all gettext-base wget gcc make g++ build-essential libc6-dev tcl && \ apt-get clean -yqq # # Ensure UTF-8 lang and locale +ENV LANG=en_US.UTF-8 +ENV LC_ALL=en_US.UTF-8 RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LC_ALL en_US.UTF-8 # Necessary for gem installs due to SHA1 being weak and old cert being revoked ENV SSL_CERT_FILE=/usr/local/etc/openssl/cert.pem diff --git a/README.md b/README.md index 3f314de..b51033a 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,14 @@ This is configurable by an enviroment variable that specifies which a password s | -------------------- | ------------------------------------------ | | `PASSWORD` | "" (requirepass/masterauth not configured) | +## Announced hostname +By default, no announced hostname is set. +This is configurable by an enviroment variable that specifies which show hostname as additional metadata in the CLUSTER SLOTS command. This valus is communicated along the clusterbus to all nodes, setting it to an empty string will remove the hostname and also propagate the removal. + +| Environment variable | Default | +| -------------------- | ------------------------------------------ | +| `CLUSTER_ANNOUNCE_HOSTNAME` | "" (empty announced hostname) | + ## Protected mode By default, Protected mode is enabled. This is configurable by an enviroment variable that specifies which the system administator can still ignore the error given by Redis and just disable protected mode or manually bind all the interfaces. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7a945b9..696be88 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -69,12 +69,18 @@ if [ "$1" = 'redis-cluster' ]; then protectedmode="protected-mode no" fi + + if [ -n "$CLUSTER_ANNOUNCE_HOSTNAME" ]; then + clusterannouncehostname="cluster-announce-hostname '${CLUSTER_ANNOUNCE_HOSTNAME}'" + clusterpreferedendpointtype="cluster-preferred-endpoint-type hostname" + fi + if [ "$port" -lt "$first_standalone" ]; then if [ -n "$PASSWORD" ]; then requirepass="requirepass '${PASSWORD}'" masterauth="masterauth '${PASSWORD}'" fi - PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} REQUIREPASS=${requirepass} MASTERAUTH=${masterauth} PROTECTED_MODE=${protectedmode} envsubst < /redis-conf/redis-cluster.tmpl > /redis-conf/${port}/redis.conf + PORT=${port} BIND_ADDRESS=${BIND_ADDRESS} REQUIREPASS=${requirepass} MASTERAUTH=${masterauth} PROTECTED_MODE=${protectedmode} CLUSTER_ANNOUNCE_HOSTNAME=${clusterannouncehostname} CLUSTER_PREFERED_ENDPOINT_TYPE=${clusterpreferedendpointtype} envsubst < /redis-conf/redis-cluster.tmpl > /redis-conf/${port}/redis.conf nodes="$nodes $IP:$port" else if [ -n "$PASSWORD" ]; then diff --git a/redis-cluster.tmpl b/redis-cluster.tmpl index 481793a..6dc58a4 100644 --- a/redis-cluster.tmpl +++ b/redis-cluster.tmpl @@ -7,4 +7,6 @@ appendonly yes dir /redis-data/${PORT} ${REQUIREPASS} ${MASTERAUTH} -${PROTECTED_MODE} \ No newline at end of file +${PROTECTED_MODE} +${CLUSTER_ANNOUNCE_HOSTNAME} +${CLUSTER_PREFERED_ENDPOINT_TYPE} \ No newline at end of file