Describe the bug
I try to run a redis sentinel in k8s that there is a environgment variables in config file to set the master's hostname. Then I will show a error "Can't resolve master instance hostname";
To reproduce
Version: 5.0.12
Some of yaml:
....
env:
- name: REDIS_MASTER_IP
value: "alink-redis"
ports:
- containerPort: 6379
.....
alink-redis is a name of svc which is point to this deployment.
My sentinel config file:
port 6380
daemonize yes
protected-mode no
pidfile "/data/redis/sentinel.pid"
dir "/data/redis"
logfile "/data/redis/sentinel.log"
sentinel myid 577f953b52f42c08e85ffb2b48024520154209a9
sentinel deny-scripts-reconfig yes
sentinel monitor mymaster $REDIS_MASTER_IP 6379 2
sentinel auth-pass mymaster rrDs5KYV3
sentinel config-epoch mymaster 0
sentinel leader-epoch mymaster 0
sentinel current-epoch 0
When I use echo $REDIS_MASTER_IP it can print alink-redis.
When I use ping alink-redis and it reutn the ip of this svc.
But when I run redis-server it print:
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 27
>>> 'sentinel monitor mymaster $REDIS_MASTER_IP 6379 2'
Can't resolve master instance hostname.
But if I change $REDIS_MASTER_IP to alink-redis in config file.
It can run successfully.
Expected behavior
support variables
Additional information
Any additional information that is relevant to the problem.
Comment From: yossigo
Hi @lystormenvoy, this is not a bug - Redis configuration files don't support expansion of environment variables.
Comment From: lystormenvoy
Hi @lystormenvoy, this is not a bug - Redis configuration files don't support expansion of environment variables.
ok I get it.