Table of contents
1. An error is reported when the sentinel starts: Can`t resolve instance hostnames
1. An error is reported when the sentinel starts: Can`t resolve instance hostnames
Analysis of the cause of the error:
Only sentinel versions above 6.2 can resolve hostnames, but it is not enabled by default.
solution:
The sentinel.conf configuration file adds:
sentinel resolve-hostnames yes
sentinel announce-hostname yes
2. In sentinel mode, the slave node cannot be switched to the master node after the master node collapses
Cause Analysis:
When the container is deployed, the network is disconnected and the instance address cannot be obtained (two wrong addresses are displayed)
参考:Redis master is getting wrong ip, port of slave in kubernetes redis-sentinel - Stack Overflow
solution:
reference:
Master detects wrong IP for the slave nodes · Issue #248 · docker-library/redis · GitHub
How does Redis-Sentinel enable domain name resolution - Programmer Sought
① Enable resolve-hostnames and announce-hostnames in sentinel.conf
sentinel resolve-hostnames yes
sentinel announce-hostnames yes
② Add replica-announce-ip and replica-announce-port to each instance configuration file (redis.conf /redis_slave.conf)
replica announce-ip <ip>
replica announce-port <port>
Reference: How Redis-Sentinel enables domain name resolution - Nuggets