Patroni로 수동 페일오버 수행
PostgreSQLPatroni명령어
# Manual failover while the leader is unhealthy (candidate is mandatory):
patronictl -c /etc/patroni/patroni.yml failover <cluster> --candidate <member> --force
# Verify the result and the new timeline:
patronictl -c /etc/patroni/patroni.yml list <cluster>
patronictl -c /etc/patroni/patroni.yml history <cluster>하는 일
leader의 상태와 관계없이 지정한 replica를 승격한다. 자동 페일오버가 일어나지 않았거나 잘못된 노드를 선택한 경우를 위한 것이다.
사용 시점
leader에 접근할 수 없거나 비정상인데 자동 페일오버가 동작하지 않았을 때(예: pause 모드), 또는 특정 노드로 강제 이동해야 할 때.
주의
비동기 복제에서는 후보가 아직 수신하지 못한 트랜잭션이 손실된다(RPO > 0). leader가 정상이면 페일오버 대신 스위치오버를 사용한다. 이전 leader가 복귀하면 pg_rewind(use_pg_rewind가 활성화된 경우)나 reinit이 필요할 수 있다.