일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- LattePanda
- haproxy
- CentOS 8
- Rocky Linux 8
- openstack
- 자작 NAS
- podman
- Openstack Rocky
- PostgreSQL
- LattePanda NAS
- Rocky Linux
- CentOS
- MySQL
- Windows 10 Home
- RDP Wrap
- RHEL 8
- ubuntu
- LattePanda Ubuntu
- WireGuard
- MariaDB
- Packstack
- 라떼판다
- 라떼판다 우분투
- 라떼판다 NAS
- MSA
- nextcloud
- centos 7
- RHEL 7
- Kubernetes
- RHEL
Archives
- Today
- Total
간마늘작업소
[PGSQL] PostgreSQL 11 – 02.Replication(복제) 설정 본문
0.개요
- PostgreSQL 11 이중화 중 Replication 설정.
- PostgreSQL 12 이상 버전에서의 Replication 설정은 다른 방법으로 진행됨.
1.사전 환경.
- Master 1대 - Standby 1대로 구성할 것을 가정.
2.Master Node 설정
su - postgres
cd /data/pgdata/
mkdir archive
vi postgresql.conf
(전략)
wal_level = hot_standby
archive_mode = on
archive_command = 'cp %p /data/pgdata/archive/%f'
max_wal_senders = 10
max_replication_slots = 10
- postgresql.conf 파일 하단에 내용 추가.
vi pg_hba.conf
(전략)
host replication all [Master Node IP]/32 trust
host replication all [Standby Node IP]/32 trust
- pg_hba.conf 파일 하단에 위치한 '# replication privilege.' 부분에 내용 추가 후 저장.
psql
ALTER USER postgres WITH PASSWORD 'postgres';
\du
exit
pg_ctl restart -mf
- PostgreSQL 콘솔 접속 후, 'postgres' 계정의 비밀번호를 설정.
- PostgreSQL 재시작.
3.Standby Node 설정
su - postgres
cd /data
rm -rf pgdata
- 데이터 디렉토리의 상위 디렉토리로 이동.
- 이름이 중복되어 있을 수 있으므로 사전에 확인 후 정리해야함.
pg_basebackup -h [Master Node IP] -D /data/pgdata/ -P -v -X stream
- pg_basebackup 명령어를 이용하여 Master Node의 데이터 디렉토리를 복제.
cd /data/pgdata
vi recovery.conf
standby_mode = on
primary_conninfo = 'host=[Master DB IP] port=5432 user=postgres password=postgres'
- recovery.conf 파일 작성 후 저장.
chmod -R 0750 /data/pgdata
pg_ctl start
- 데이터 디렉토리 권한 조정.
- PostgreSQL 시작.
'Linux > 31.PostgreSQL' 카테고리의 다른 글
[PGSQL] PostgreSQL 이중화 구성 – Repmgr 이용 (0) | 2022.12.21 |
---|---|
[PGSQL] PostgreSQL 14 – 02.Replication(복제) 설정 (0) | 2022.07.04 |
[PGSQL] PostgreSQL 15 – 01.설치 (0) | 2022.07.04 |
Comments