-
Notifications
You must be signed in to change notification settings - Fork 10
PostgreSQL Slave Configuration
Install PostgreSQL like you did for the Master server.
Don't worry if you already started this machine as a Master, you simply have to stop the server and delete the data folder so open up your trusty terminal and do:
sudo service postgresql-9.4 stop
sudo rm -rf /var/lib/pgsql/9.4/data
Now we need to replicate the database from the Master to our new slave:
-
sudo su postgres
-
pg_basebackup -D /var/lib/pgsql/9.4/data -h 192.168.1.1 -U replicador
(change the IP address to your Master server's address)
As the postgres user open the folder /var/lib/pgsql/9.4/data
and create inside it the file recovery.conf , with the following contents:
standby_mode=on
trigger_file='/tmp/promotedb'
primary_conninfo='host=192.168.1.1 port=5432 user=replicador application_name=postgresql1'
recovery_target_timeline='latest'
primary_conninfo is the Master server, so set the IP address and port accordingly, 5432 is the default port. application_name is the name you want this machine to identify itself as to the Master.
On a terminal run:
sudo service postgresql-9.4 start
- Home
- Overview
- Requirements
- Setup
- Summary and Quick Start
- Database (PostgreSQL) 1. PostgreSQL Installation 2. Configuring the Master 3. Configuring the Slaves 4. Testing Replication 5. Manual Failover
- Load Balancing (PgPool II) 1. PgPool II Installation 2. Configuration 3. Managing and Testing
- Automatic Failover 1. Setting it up 2. Testing
- Troubleshooting
- References