본문 바로가기

PostgreSQL

patroni- standby cluster

standby cluster란?

patroni에서는 cascading replication 운영을 지원함.

standby cluster를 이용해서 다른 datacentor(region)에 cascading replicaiton을 구성할 수 있음.

특징

 

cascading replication이란?

 

26.2. Log-Shipping Standby Servers

26.2. Log-Shipping Standby Servers # 26.2.1. Planning 26.2.2. Standby Server Operation 26.2.3. Preparing the Primary for Standby Servers 26.2.4. Setting Up …

www.postgresql.org

 

 

standby cluster 구성 

  • cluster leader와 별도로 DCS를 구성할 것.
  • standby cluster 내에서 standby leader는 leader lock을 잡거나 update함.
  • cascade replicas는 standbys 중에 다른 leader를 선택하기 위해 election을 수행함.
  • standby cluster와 primary cluster간 DCS를 공유하지 않으므로 양쪽 cluster간 복제 정보외에는 다른 cluster라고 보면 됨.
  • 따라서 primary cluster를 patronictl list로 조회해보면 standby cluster는 조회되지 않음.

standby cluster의 patroni yaml파일에 포함해야할 정보

  • host에 primary cluster의 primary server 정보를 넣는다.
  • 만약,  primary cluster의 multiple hosts를 standby_clustere.host에 등록하고 싶다면 아래 절차를 추가로 해줘야 함.
    • standby cluster의 standby leader에 primary_conninfo를 설정할 때 target_session_attrs=read-write을 넣어줘야 함.
    • pg_rewind를 실행할 때 필요.
bootstrap:
    dcs:
        standby_cluster:
            host: 1.2.3.4        ==> primary clsuter에서 복제할 primary or secondary host정보
            port: 5432              
            primary_slot_name: patroni ==> primary cluster의 primary server에 복제 slot을 사용할 경우 지정
            create_replica_methods:  ==> 복제할 때 사용할 method
            - basebackup

 

참고

https://patroni.readthedocs.io/en/latest/standby_cluster.html

 

'PostgreSQL' 카테고리의 다른 글

patroni - DCS Failsafe Mode  (0) 2025.07.24
patroni 관련 간단 용어 정리  (0) 2025.07.11
Serial Types 과 Identity Columns  (0) 2025.07.07
JIT(Just-in-Time Compilation)  (0) 2025.07.07
PREPARE statement  (1) 2025.07.07