I have 2 sentineles and 2 redis servers. I want to configure sentinels using hostnames of redis servers. Currently, I define each hostname in hosts file like this.
10.22.20.156 clsupport1
10.22.20.157 clsupport2
And I try to configure sentinel like this.
daemonize yes
pidfile "/var/run/redis_sentinel_26379.pid"
loglevel notice
logfile "/var/log/redis_sentinel_26379.log"
port 26379
dir "/tmp"
sentinel monitor redis-prod clsupport2 6379 1
sentinel config-epoch redis-prod 3
sentinel leader-epoch redis-prod 4
sentinel known-slave redis-prod clsupport1 6379
After I started my sentinel, It automatically replaces hostnames with ip addresses. After restart.
daemonize yes
pidfile "/var/run/redis_sentinel_26379.pid"
loglevel notice
logfile "/var/log/redis_sentinel_26379.log"
port 26379
dir "/tmp"
sentinel monitor redis-prod 10.22.20.157 6379 1
sentinel config-epoch redis-prod 3
sentinel leader-epoch redis-prod 4
sentinel known-slave redis-prod 10.22.20.156 6379
# Generated by CONFIG REWRITE
...
But I want to keep hostnames. How can I achieve that?