📚 PostgreSQL Promote STB To PRD¶
🔍 Prepare:¶
## Preparing the Master and Slave Server:
Environment name Version IP Folder OS Rocky Linux 9.x Master DB(PSDBDEV01) PostgreSQL 16.X 10.38.36.110 /pgdata/SID Slave DB(PSDBDEV02) PostgreSQL 16.X 10.38.36.111 /pgdata/SID
1. Promote PostgreSQL¶
-
1.1 Modify postgresql.conf on Master DB server
-
1.2 Modify postgresql.conf on Standby DB server
Notice: ADD PRD/STB IP For future failover convenience
-
1.3 Stop the DB service for PSDBDEV01
-
1.4 Execute the SQL for PSDBDEV02
Note:pg_promote(wait boolean DEFAULT true, wait_seconds integer DEFAULT 60)
-
1.5 Make sure PSDBDEV02 in Master or not
In production mean Master
-
1.6 Go to PSDBDEV01 to touch the standby.signal file
-
1.7 Start DB service for PSDBDEV01
-
1.8 Make sure PSDBDEV01 in Slave or not
In archive recovery mean Slave
-
1.9 Check pg_stat_replication in PSDBDEV02
Means data has transmitted to PSDEV01 successfully
2. Promote Back(Switch over)¶
-
2.1 Stop the DB service for PSDBDEV02
-
2.2 Execute the SQL for PSDBDEV01
-
2.3 Make sure PSDBDEV01 in Master or not
In production mean Master
-
2.4 Go to PSDBDEV02 to touch the standby.signal file
-
2.5 Go to PSDBDEV02 to touch the standby.signal file
-
2.6 Make sure PSDBDEV02 in Slave or not
In archive recovery mean Slave
-
2.7 Check pg_stat_replication in PSDBDEV01
Means data has transmitted to PSDEV02 successfully















