Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
initdb -D /var/lib/pgsqlpostgresql/daselement-munich

Configure primary server

...

change postgres.conf to enable networking

Code Block
vim /var/lib/pgsqlpostgresql/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 Postgres server
pg_ctl -D /var/lib/pgsqlpostgresql/daselement-data start

create a replication user

...

add line to allow access for the replication user

Code Block
vim /var/lib/pgsqlpostgresql/daselement-data/pg_hba.conf

# TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD
# IPv4 local connections
host    all             repuser             localhost               trust

# restart the Postgres server
pg_ctl -D /var/lib/pgsqlpostgresql/daselement-munich restart

...

Info

Now we are at a database server in a different facility. E.g. Vancouver

Code Block
breakoutModefull-width
# create the replica Postgres server
# this command pg_basebackup copies the files from the primary database

pg_basebackup -h db-munich -U repuser --checkpoint=fast -D /var/lib/pgsqlpostgresql/daselement-munich-replica/ -R --slot=daselement_munich -C --port 5433

...

Code Block
# start the Postgres server
pg_ctl -D /var/lib/pgsqlpostgresql/daselement-munich-replica

...