리더 선출
여러 인스턴스 중 하나를 리더로 선출해 조정을 맡기는 패턴
구조와 동작 원리
구성 요소와 배치 원칙 (조사 기반 개념 설명 · 연결 순서나 토폴로지는 특정하지 않음)
후보 노드, 만료되는 리스, 강한 일관성 저장소, 리더 갱신으로 구성
etcd와 제어면을 함께 배치하거나 외부 etcd로 분리 배치
공유 자원 경합, 충돌, 인스턴스 간 간섭 방지
기대 효과
효율성 향상, 조정 단순화, 아키텍처·운영 단순화
트레이드오프
새로운 장애 모드와 확장 병목을 유발할 수 있음
전체 데이터센터 장애나 상관 장애에는 선출만으로 대응 불가
운영 및 적용 가이드
종합 설명 · 원문 인용으로 검증된 항목과 구분됩니다. 실제 적용 전 확인이 필요합니다.
언제 사용하는가
복제 DB의 단일 쓰기 리더, 분산 작업 스케줄러의 중복 실행 방지 코디네이터, 샤드/파티션 소유권 관리에 사용한다.
시나리오
일 1억 건 주문을 처리하는 이커머스가 6개 노드의 주문 상태 반영 서비스를 운영한다. 중복 결제·재고 갱신을 막기 위해 리더만 쓰기와 스케줄링을 수행하고, 리더 장애 시 15초 리스 만료 후 새 리더를 선출해야 한다. 네트워크 분할 시 이중 쓰기가 발생하지 않도록 펜싱 토큰과 단일 장애점 점검을 요구한다.
배치 원칙
- 리스는 etcd·ZooKeeper 같은 강한 일관성 저장소에 둔다
- 워커는 여러 노드/영역에 분산하고 리더만 쓰기 경로를 갖게 한다
- K8s에서는 제어면과 etcd를 co-located 또는 외부 etcd로 분리 배치한다
- 데이터 복제본은 리더 쓰기 후 팔로워로 전파되도록 배치한다
온프레미스
온프레미스에서는 제어면·etcd를 홀수 노드로 구성하고 전원/랙/네트워크 장애를 분리한다. 배포 시 고정 쿼럼과 리스 시간을 검증하고, 운영 중 선출 빈도·하트비트 지연·복제 지연을 모니터링하며 수동 페일오버 절차를 준비한다.
클라우드
클라우드에서는 가용 영역을 분산한 관리형 일관성 저장소나 DB 리스를 활용한다. 오토스케일링으로 후보가 늘어도 리더는 하나만 유지되도록 리스 TTL과 갱신 주기를 조정하고, 리전 장애는 별도 DR로 다룬다.
Kubernetes
Kubernetes에서는 컨트롤러/스케줄러의 리더 선출과 Leader Migration을 이해하고, Lease 리소스 기반 선출을 사용한다. HA 클러스터는 etcd를 외부화하거나 stacked로 구성하며, 업그레이드 시 선출 전략과 버전 스큐를 검증한다.
장애 대응
대표 장애는 네트워크 분할로 인한 스플릿브레인, 리더 플래핑, 리스 만료 지연, 구 리더의 인플라이트 쓰기다. 절차: 선출/하트비트/복제 지표 확인 → 구 리더 펜싱 또는 쓰기 차단 → 쿼럼·타임아웃 조정 → 새 리더 선출 및 구 리더 인플라이트 작업 롤백 확인 → 재발 방지 위해 분할·지연·노드 동시 장애를 테스트한다.
14개 관점별 근거
조사 당시 근거 보유 여부입니다. 출처의 정확성과 최신성을 별도로 판단하세요.
정의·개요근거 있음
여러 인스턴스 중 하나를 리더로 선출해 조정을 맡기는 패턴
Coordinate collaborating instances in a distributed application by electing one instance as the leader.해결하는 문제근거 있음
공유 자원 경합, 충돌, 인스턴스 간 간섭 방지
The leader manages coordination to help prevent conflicts, contention for shared resources, and interference between instances.주요 구성 컴포넌트·리소스근거 있음
후보 노드, 만료되는 리스, 강한 일관성 저장소, 리더 갱신으로 구성
Candidates try to acquire a lease (a lock with an expiry) in a strongly consistent store.데이터·에셋 배치 원칙근거 있음
etcd와 제어면을 함께 배치하거나 외부 etcd로 분리 배치
With stacked control plane nodes. This approach requires less infrastructure. The etcd members and control plane nodes are co-located.대표 유스케이스근거 있음
복제 DB/키값 저장소의 단일 쓰기 리더, 작업 스케줄러 조정자
replicated relational databases such as MySQL, or distributed key-value stores such as Apache Zookeeper, choose a leader시나리오 예시근거 있음
분산 작업 스케줄러에서 중복 실행을 막기 위해 단일 조정자 선출
Distributed job schedulers need a single coordinator to prevent duplicate task execution.부적합 상황·주의근거 있음
전체 데이터센터 장애나 상관 장애에는 선출만으로 대응 불가
When a datacenter loses power, all nodes fail simultaneously. Leader election can't help; design for complete DC failure separately.온프레미스 관점(개발·배포·운영)미확인
확인된 원문 근거가 없습니다. 부적합하다는 의미는 아닙니다.
클라우드 관점(개발·배포·운영)근거 있음
클라우드 애플리케이션의 다수 태스크 조정에 적용
A cloud application can have many tasks that need coordination.Kubernetes 관점(개발·배포·운영)근거 있음
Kubernetes 조정 리더 선출은 베타 기능이며 기본 비활성화
Coordinated Leader Election Feature state: Beta since Kubernetes v1.33; disabled by default장애 대응 관점근거 있음
불안정 네트워크에서 빠른 페일오버는 리더 플래핑을 유발할 수 있음
Prefer stability over speed — Fast failover sounds good but causes 'flapping' when network is unstable.장점근거 있음
효율성 향상, 조정 단순화, 아키텍처·운영 단순화
Leader election is a powerful tool for improving efficiency, reducing coordination, simplifying architectures, and reducing operations.단점·트레이드오프근거 있음
새로운 장애 모드와 확장 병목을 유발할 수 있음
leader election can introduce new failure modes and scaling bottlenecks.대표 기술·도구근거 있음
Raft 기반 구현, Kubernetes 네이티브, DB 락 등
Raft-based | Strong consistency needs, custom implementations추가 참고 문헌 (21)
- Leader Election Pattern - Azure Architecture Center | Microsoft Learn ↗
- Leader Election in Distributed Systems ↗
- Implementing leader election on Google Cloud Storage ↗
- System Design: Leader Election Algorithms | Application Architect ↗
- Google SRE: Distributed Consensus algorithms and CAP Theorem ↗
- Building Stateful Services with Kubernetes | Kevin Sookocheff ↗
- Leader election — concept · LevelCode ↗
- How to Create Leader Election Patterns ↗
- Coordinated Leader Election | Kubernetes ↗
- Creating Highly Available Clusters with kubeadm | Kubernetes ↗
- Migrate Replicated Control Plane To Use Cloud Controller Manager | Kubernetes ↗
- Production environment | Kubernetes ↗
- Controller Manager Leader Migration | Kubernetes Contributors ↗
- Implementation details | Kubernetes ↗
- Reference Architecture: GKE Enterprise hybrid environment - part 2 - Dec '24 - Google Docs ↗
- Lesson 12.8 — Raft step by step: leader election | System Design From First Principles ↗
- Leader Election in Distributed Systems — System Design | Engineering with Intent ↗
- CS 425 / ECE 428 Distributed Systems Fall 2026 ↗
- Leader Election in Distributed Systems: Algorithms, Fencing Tokens, and Production Pitfalls — Let's Build ↗
- Choosing QuePaxa, an unusual consensus algorithm | Cloudflare Blog ↗
- Leader Election in Practice — Leader Election | OneNoughtOne ↗