
이것은 Serverfault 또는 Stack Overflow 질문일 수 있지만 아직 확실하지 않습니다.
Redis Sentinel을 사용하여 장애 조치를 관리하는 마스터 노드와 복제본 노드 2개로 구성된 간단한 3개 노드 Redis 시스템을 설정했습니다. Redis 및 Sentinel 네트워크 트래픽은 Redis 내장 TLS 지원 및 일반 CA 발급 인증서를 사용하여 보호됩니다.
각 Sentinel 인스턴스는 호스트 이름을 알리고 DNS를 확인하도록 구성됩니다.
sentinel resolve-hostnames yes
sentinel announce-hostnames yes
sentinel announce-ip "redistest2.mydomain.com"
Sentinel 인스턴스에 연결하기 위해 Servicestack을 사용하는 웹 서비스가 있습니다. TLS 인증서와 호스트 이름을 검증하지 않는 한 모든 것이 잘 작동합니다. 웹 서비스는 Redis Sentinel 리스너를 볼 수 있으며 현재 마스터를 종료하면 Redis 클러스터는 새 마스터에 투표하고 웹 서비스는 새로운 쓰기 가능한 Redis 노드.
그러나 원래 마스터 노드는 FQDN을 사용하여 보고하지만 두 백업 노드는 해당 IP 주소를 사용하여 ServiceStack에 다시 보고하는 것으로 보입니다.
Sentinel 로그 발췌문은 백업 노드가 호스트 이름을 사용하는 것으로 나타납니다.
28011:X 15 Feb 2023 15:23:10.817 * +sentinel sentinel <hex-string> redistest2.mydomain.com 26379 @ redistest redistest1.mydomain.com 6379
28011:X 15 Feb 2023 15:23:10.821 * Sentinel new configuration saved on disk
28011:X 15 Feb 2023 15:23:10.897 * +sentinel sentinel <other-hex-string> redistest3.mydomain.com 26379 @ redistest redistest1.mydomain.com 6379
28011:X 15 Feb 2023 15:23:10.901 * Sentinel new configuration saved on disk
그러나 ServiceStack은 서버 그룹으로부터 서버 IP 주소만 다시 수신한다고 주장합니다.
Starting with sentinel.
Sentinel hosts: redistest1.mydomain.com:26379?ssl=true, redistest2.mydomain.com:26379?ssl=true, redistest3.mydomain.com:26379?ssl=true
Sentinel created
Host filter set.
Hostfilter: redistest1.mydomain.com:6379
Hostfilter: 10.100.60.72:6379
Hostfilter: 10.100.60.73:6379
RedisManager started.
Redis sentinel info: redistest primary: redistest1.mydomain.com:6379, replicas: 10.100.60.72:6379, 10.100.60.73:6379
Hostfilter: 10.100.60.72:6379
Hostfilter: 10.100.60.73:6379
Ping error with read only client: ServiceStack.Redis.RedisException: [14:23:47.626] Unable to Connect: sPort: 0, Error: One or more errors occurred.
(...)
---> System.AggregateException: One or more errors occurred. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
사용된 인증서의 유효성을 올바르게 검사할 수 있도록 ServiceStack이 Redis 노드의 실제 호스트 이름을 수신하도록 Redis 및/또는 Sentinel 구성 측면에서 수행할 수 있는 작업이 더 있습니까?
답변1
ServiceStack 로그에는 무엇이 잘못되었는지에 대한 필요한 단서가 포함되어 있습니다. Sentinel은 해야 할 일을 정확하게 수행했지만 Redis 백업 노드는 IP 주소로 참조되었습니다.
Sentinel이 구성 명령문에서 FQDN이 포함된 문자열을 반환하는 방법과 유사하게 sentinel announce-ip
Redis는 구성 명령문을 사용하여 동일한 작업을 수행할 수 있습니다 replica-announce-ip
.
해결책은 모든 백업 호스트의 Redis 구성 파일에 다음 줄을 추가하는 것이었습니다.
replica-announce-ip servername.mydomain.com
물론 이 경우 서버 이름은 이 특정 백업 노드를 실행하는 머신의 호스트 이름입니다.