Table of Contents | ||||
---|---|---|---|---|
|
Requirements
In each facility you have a database server up and running with Postgres installed.
Create primary database server
...
Code Block |
---|
vim /var/lib/pgsql/daselement-munich/postgres.conf # uncomment and change the line: listen_addresses = '*' # and change the port to 5433 to avoid conflicts with production port 5432 port = 5433 # start the databasePostgres server pg_ctl -D /var/lib/pgsql/daselement-data start |
...
Code Block |
---|
# create replication user
psql -- port 5433 postgres
[local]:5433 postgres=# create user repuser replication; |
...
Code Block |
---|
vim /var/lib/pgsql/daselement-data/pg_hba.conf # TYPE DATABASE USER CIDR-ADDRESS METHOD # IPv4 local connections host all repuser localhost trust # restart the databasePostgres server pg_ctl -D /var/lib/pgsql/daselement-munich restart |
...
Code Block |
---|
# create the replica databasePostgres server # this command pg_basebackup copies the files from the primary database pg_basebackup -h db-munich -U repuser --checkpoint=fast -D /var/lib/pgsql/daselement-munich-replica/ -R --slot=daselement_munich -C --port 5433 |
...
contains information to connect to the primary server
Now start the replica server
Code Block |
---|
# start the Postgres server
pg_ctl -D /var/lib/pgsql/daselement-munich-replica |