CLOUD

OpenStack Kolla Redis Sentinel 인증 오류 디버깅 가이드

92Hoonhee 2025. 8. 13. 15:02

OpenStack Kolla Redis Sentinel 인증 오류 디버깅 가이드

🎯 대상: Redis를 coordination backend로 사용하는 OpenStack 관리자
적용 서비스: Cinder, Keystone, Nova, Neutron 등 tooz 라이브러리를 사용하는 모든 OpenStack 서비스

문제 상황

OpenStack 서비스들(Cinder, Keystone 등)에서 다음과 같은 에러가 발생:

tooz.coordination.ToozConnectionError: No master found for 'kolla' : 
<redis.client.Redis(host=10.0.2.110,port=26379)> - AuthenticationError('Authentication required.')

에러 분석

1. 에러의 의미

  • Tooz: OpenStack의 분산 협조 라이브러리
  • Redis Sentinel: Redis 클러스터의 고가용성을 위한 모니터링 시스템
  • AuthenticationError: Redis Sentinel에 접근할 때 인증이 필요하다는 의미

2. 에러 발생 원인

  • OpenStack 서비스들: Cinder, Keystone, Nova, Neutron 등이 분산 잠금(distributed locking)을 위해 tooz 라이브러리 사용
  • Redis Sentinel: Kolla 환경에서 Redis 클러스터의 고가용성을 위한 모니터링 시스템
  • 이중 인증 구조: Sentinel과 Redis Master 모두에 패스워드가 설정되어 있지만, OpenStack 설정에서 Sentinel 인증 정보만 누락된 상황

3. 영향받는 서비스

  • Cinder: 볼륨 관리 시 분산 잠금
  • Keystone: 토큰 발급/검증 시 coordination
  • Nova: 인스턴스 스케줄링 시 리소스 잠금
  • Neutron: 네트워크 리소스 할당 시 coordination
  • 기타: tooz coordination을 사용하는 모든 OpenStack 서비스

체계적 디버깅 방법

단계 1: 네트워크 연결 확인

# Sentinel 포트 연결 테스트
telnet 10.0.2.110 26379

단계 2: Sentinel 상태 확인

# Sentinel에 직접 연결하여 마스터 정보 확인
redis-cli -h 10.0.2.110 -p 26379 SENTINEL masters
  • 연결이 성공하면 Sentinel 자체는 정상
  • 'kolla' 마스터 정보가 표시되면 Sentinel 설정도 정상

단계 3: 인증 요구사항 확인

# Sentinel INFO 명령어로 인증 필요 여부 확인
redis-cli -h 10.0.2.110 -p 26379 INFO
  • NOAUTH Authentication required. 응답이 나오면 Sentinel에 패스워드 설정됨

단계 4: 패스워드 확인 및 테스트

# Kolla 패스워드 파일에서 Redis 패스워드 확인
grep redis_password /etc/kolla/passwords.yml

# 패스워드로 Sentinel 인증 테스트
redis-cli -h 10.0.2.110 -p 26379 -a <password> INFO

단계 5: Redis Master 연결 테스트

# Sentinel을 통해 마스터 주소 확인
redis-cli -h 10.0.2.110 -p 26379 -a <password> SENTINEL get-master-addr-by-name kolla

# 마스터에 직접 연결 테스트
redis-cli -h <master_ip> -p 6379 -a <password> PING

단계 6: Python 라이브러리 레벨 테스트

import redis.sentinel

# Sentinel 패스워드 없이 테스트
sentinel = redis.sentinel.Sentinel([('10.0.2.110', 26379)])
master = sentinel.master_for('kolla', password='<redis_password>')
print(master.ping())  # 실패할 것

# Sentinel 패스워드 포함하여 테스트
sentinel = redis.sentinel.Sentinel([('10.0.2.110', 26379)], 
                                   sentinel_kwargs={'password': '<sentinel_password>'})
master = sentinel.master_for('kolla', password='<redis_password>')
print(master.ping())  # 성공해야 함

해결 방법

현재 설정 (문제 있음)

[coordination]
backend_url = redis://default:zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es@10.0.2.110:26379?sentinel=kolla&sentinel_fallback=10.0.2.111:26379&sentinel_fallback=10.0.2.112:26379&db=0&socket_timeout=60&retry_on_timeout=yes

수정된 설정 (해결)

[coordination]
backend_url = redis://default:zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es@10.0.2.110:26379?sentinel=kolla&sentinel_fallback=10.0.2.111:26379&sentinel_fallback=10.0.2.112:26379&db=0&socket_timeout=60&retry_on_timeout=yes&sentinel_password=zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es

핵심: 왜 &sentinel_password= 파라미터가 필요한가?

Redis 아키텍처 이해

  1. Redis Master: 실제 데이터를 저장하는 서버 (포트 6379)
  2. Redis Sentinel: 마스터를 모니터링하고 장애 시 failover하는 서비스 (포트 26379)

인증 구조

Application (Cinder)
    ↓
Redis Sentinel (26379) ← 첫 번째 인증 지점
    ↓ (마스터 주소 조회)
Redis Master (6379) ← 두 번째 인증 지점

Tooz 라이브러리의 동작 방식

  1. 1단계: Sentinel에 연결하여 'kolla' 마스터의 실제 주소 조회
  2. 2단계: 조회된 마스터 주소로 Redis 연결
  3. 문제: 1단계에서 Sentinel 인증 실패로 마스터 주소를 얻지 못함

URL 파라미터 의미

  • redis://default:패스워드@host:port: Redis Master 인증 정보
  • ?sentinel=kolla: Sentinel을 통해 'kolla' 서비스 조회
  • &sentinel_password=패스워드: Sentinel 자체 인증 정보 ← 이것이 핵심!

다양한 OpenStack 서비스 적용 방법

Keystone 설정 수정 예시

# Keystone 설정 파일 생성
mkdir -p /etc/kolla/config/keystone/
cat > /etc/kolla/config/keystone/coordination.conf << 'EOF'
[coordination]
backend_url = redis://default:zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es@10.0.2.110:26379?sentinel=kolla&sentinel_fallback=10.0.2.111:26379&sentinel_fallback=10.0.2.112:26379&db=0&socket_timeout=60&retry_on_timeout=yes&sentinel_password=zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es
EOF

Nova 설정 수정 예시

# Nova 설정 파일 생성
mkdir -p /etc/kolla/config/nova/
cat > /etc/kolla/config/nova/coordination.conf << 'EOF'
[coordination]
backend_url = redis://default:zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es@10.0.2.110:26379?sentinel=kolla&sentinel_fallback=10.0.2.111:26379&sentinel_fallback=10.0.2.112:26379&db=0&socket_timeout=60&retry_on_timeout=yes&sentinel_password=zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es
EOF

전체 서비스 일괄 적용

# 여러 서비스에 동일한 coordination 설정 적용
for service in cinder keystone nova neutron; do
    mkdir -p /etc/kolla/config/${service}/
    cat > /etc/kolla/config/${service}/coordination.conf << 'EOF'
[coordination]
backend_url = redis://default:zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es@10.0.2.110:26379?sentinel=kolla&sentinel_fallback=10.0.2.111:26379&sentinel_fallback=10.0.2.112:26379&db=0&socket_timeout=60&retry_on_timeout=yes&sentinel_password=zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es
EOF
done
mkdir -p /etc/kolla/config/cinder/
cat > /etc/kolla/config/cinder/coordination.conf << 'EOF'
[coordination]
backend_url = redis://default:zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es@10.0.2.110:26379?sentinel=kolla&sentinel_fallback=10.0.2.111:26379&sentinel_fallback=10.0.2.112:26379&db=0&socket_timeout=60&retry_on_timeout=yes&sentinel_password=zBbKOdvpZEfqHoqvYwETxFIxvezGGo064wiVf1es
EOF

Reconfigure 실행

# 특정 서비스만 reconfigure (예: Keystone 배포 시)
kolla-ansible -i inventory reconfigure --tags keystone

# 여러 서비스 동시 reconfigure
kolla-ansible -i inventory reconfigure --tags cinder,keystone,nova,neutron

# 전체 reconfigure
kolla-ansible -i inventory reconfigure

서비스별 확인 방법

Keystone 확인

docker logs keystone | grep -i coordination
docker exec keystone_fernet grep coordination /etc/keystone/keystone.conf

Cinder 확인

docker logs cinder_volume | grep -i coordination
docker exec cinder_volume grep coordination /etc/cinder/cinder.conf

Nova 확인

docker logs nova_compute | grep -i coordination
docker exec nova_compute grep coordination /etc/nova/nova.conf

디버깅 체크리스트

  • [ ] 네트워크 연결 (telnet)
  • [ ] Sentinel 응답 확인 (redis-cli)
  • [ ] 인증 요구사항 확인 (INFO 명령어)
  • [ ] 패스워드 확인 (passwords.yml)
  • [ ] Master 연결 테스트
  • [ ] Python 라이브러리 테스트
  • [ ] 설정 파일 수정
  • [ ] 서비스 재시작
  • [ ] 로그 확인

주요 교훈 (OpenStack 관리자용)

  1. Redis Sentinel ≠ Redis Master: 각각 별도의 인증이 필요할 수 있음
  2. Tooz URL 구조 이해: sentinel_password 파라미터가 Sentinel 인증용임을 이해
  3. 단계별 디버깅: 네트워크 → Sentinel → Master → Application 순서로 테스트
  4. Python 레벨 테스트: 실제 라이브러리 동작 확인으로 문제 재현
  5. OpenStack 전체 영향: 하나의 coordination 문제가 여러 서비스에 동시에 영향
  6. Kolla-Ansible 활용: 설정 파일 기반으로 영구적이고 체계적인 문제 해결

⚠️ 주의사항

  • 보안: Redis 패스워드가 URL에 평문으로 노출되므로 설정 파일 권한 관리 중요
  • 일관성: 모든 OpenStack 서비스에서 동일한 Redis 설정 사용 권장
  • 모니터링: 각 서비스 로그에서 coordination 관련 에러 정기적 확인 필요

이 사례는 Redis coordination을 사용하는 모든 OpenStack 환경에서 흔히 발생할 수 있는 인증 설정 누락 문제로, 체계적인 디버깅 접근법과 서비스 간 설정 일관성의 중요성을 보여줍니다.