DBAtlas · 데이터베이스 운영 아틀라스

replication slot 생성 및 삭제

PostgreSQL복제

명령어

SELECT pg_create_physical_replication_slot('replica_slot_1'); -- To drop: SELECT pg_drop_replication_slot('replica_slot_1');

하는 일

standby가 확인할 때까지 primary가 필요한 WAL을 제거하지 않도록 보장하는 물리 slot을 생성한다. 두 번째 명령은 slot을 제거한다.

사용 시점

짧은 장애 중에 standby가 WAL을 잃지 않도록 하기 위해.

주의

사용되지 않거나 방치된 slot은 WAL 누적과 디스크 가득 참으로 이어진다. slot 상태 모니터링: SELECT slot_name, active, pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)) AS retained FROM pg_replication_slots; 활성 slot은 삭제할 수 없다.

DBAtlas에서 열기 →

관련 항목