요약
항목 내용
| 발생일 | 2026-05-27 |
| 환경 | Spring Cloud 기반 MSA / Podman |
| 영향 범위 | Config Server, Gateway (Spring Cloud Bus 사용 전체) |
| 근본 원인 | RabbitMQ 4.3.0에서 queue_master_locator deprecated feature 기본 차단 |
| 정상 버전 | RabbitMQ 4.2.5 이하 |
| 문제 버전 | RabbitMQ 4.3.0 |
| 해결 방법 | rabbitmq.conf에 deprecated_features.permit.queue_master_locator = true 추가 |
증상
- Config Server 또는 Spring Cloud Gateway 기동 시 RabbitMQ 채널 에러 반복 발생
- Channel error on connection → queue.declare not_found 무한 반복
- RabbitMQ status 확인 시 Connection count: 1, Queue count: 0 (연결은 되나 큐 생성 실패)
에러 로그 (RabbitMQ)
Feature 'queue_master_locator' is deprecated.
By default, this feature is not permitted anymore.
Error on AMQP connection → operation queue.declare caused a connection exception internal_error:
"Feature 'queue_master_locator' is deprecated..."
에러 로그 (Config Server / Gateway)
QueuesNotAvailableException: Cannot prepare queue for listener.
Either the queue doesn't exist or the broker will not allow us to use it.
Failed to declare queue(s): [springCloudBus.anonymous.<uuid>]
ShutdownSignalException: channel error; protocol method:
reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.<uuid>'
원인 분석
발생 메커니즘
- rabbitmq:management 이미지 태그가 latest를 따라가면서 RabbitMQ 4.3.0이 pull됨
- RabbitMQ 4.3.0에서 queue_master_locator feature가 기본 차단 (not permitted)
- Spring Cloud Bus (spring-rabbit 3.2.7)가 큐 declare 시 queue_master_locator 옵션 사용
- RabbitMQ가 이를 거부하며 connection 자체를 강제 종료 (channel 에러가 아님)
- connection 종료 → exclusive + autoDelete anonymous 큐 즉시 삭제
- Spring AMQP 재연결 → 기존 큐명으로 queueDeclarePassive 시도 → NOT_FOUND 반복
왜 4.2.5에서는 문제 없었나
- 4.2.x까지는 queue_master_locator가 deprecated 경고만 출력하고 동작은 허용
- 4.3.0부터 기본 차단으로 변경 → permit 설정 없으면 connection exception 발생
해결
적용한 방법: rabbitmq.conf 파일 마운트
# rabbitmq.conf
deprecated_features.permit.queue_master_locator = true
Podman 환경
# conf 파일 생성
cat > /path/to/rabbitmq.conf << 'EOF'
deprecated_features.permit.queue_master_locator = true
EOF
# 기존 컨테이너 정리 + 볼륨 초기화
podman stop rabbitmq && podman rm rabbitmq
rm -rf /path/to/rabbitmq-data/*
# 재실행 (conf 마운트 추가)
podman run -d \
--name rabbitmq \
--userns=keep-id \
--restart always \
-e RABBITMQ_DEFAULT_USER="admin" \
-e RABBITMQ_DEFAULT_PASS="admin" \
-v /path/to/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro \
-v /path/to/rabbitmq-data:/var/lib/rabbitmq/ \
-v /path/to/rabbitmq-log:/var/log/rabbitmq/ \
-p 5672:5672 \
-p 15672:15672 \
rabbitmq:management
Docker 환경
docker run -d \
--name rabbitmq \
--restart always \
-e RABBITMQ_DEFAULT_USER="admin" \
-e RABBITMQ_DEFAULT_PASS="admin" \
-e RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-rabbit deprecated_features [{permit,queue_master_locator}]" \
-v /path/to/rabbitmq-data:/var/lib/rabbitmq/ \
-p 5672:5672 \
-p 15672:15672 \
rabbitmq:management
Docker에서는 환경변수 방식도 정상 동작한다.
적용 확인
# conf 파일 확인
podman exec rabbitmq cat /etc/rabbitmq/rabbitmq.conf
# feature 허용 여부 확인 (true 출력되면 성공)
podman exec rabbitmq rabbitmqctl eval 'rabbit_deprecated_features:is_permitted(queue_master_locator).'
Podman에서 환경변수 방식이 실패하는 이유
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS로 Erlang args를 전달할 때, [{, }] 등의 특수문자가 shell → Podman 전달 과정에서 escape가 깨진다. Docker에서는 정상 반영되지만, Podman 환경에서는 conf 파일 마운트가 확실한 방법이다.
docker 에서는 반영 잘 됨을 확인했다.
-e RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-rabbit deprecated_features [{permit,queue_master_locator}]" \
#적용 확인(true)
docker exec rabbitmq rabbitmqctl eval 'rabbit_deprecated_feautres:is_permitted(queue_master_locator).'
true
대안: 이미지 버전 고정
image: rabbitmq:3.13-management
이미지 태그를 rabbitmq:3.13-management로 고정하면 해당 이슈 자체가 발생하지 않는다. Spring Cloud Bus가 RabbitMQ 4.x를 공식 지원하는 spring-rabbit 버전으로 업그레이드되면 conf 설정 없이도 해결될 수 있으나, spring-rabbit 버전 업그레이드는 Spring Boot 메이저 버전 업을 수반하므로 시점을 확인하고 진행할 필요가 있다.
교훈
- rabbitmq:management 같은 latest 추종 태그는 운영 환경에서 위험 → 버전 고정 권장
- Podman 환경에서 Erlang args 같은 복잡한 설정은 환경변수보다 conf 파일 마운트가 안전
- RabbitMQ 볼륨(/var/lib/rabbitmq/)에 이전 Mnesia DB가 남아있으면 RABBITMQ_DEFAULT_USER 등 환경변수가 무시됨 → 깨끗한 시작 시 볼륨 초기화 필요
'etc' 카테고리의 다른 글
| Docker 로그로 가득 찬 디스크 정리 기록 (1) | 2025.07.21 |
|---|---|
| Windows Server Docker 지원 현황 (2) | 2025.06.13 |
| bash_profile 꾸미기 (0) | 2025.01.30 |