Create primary database server
initdb -D /var/lib/pgsql/daselement-data
Configure primary server
change postgres.conf to enable networking
create a replication user
allow remote access in pg_hba.conf
change postgres.conf to enable networking
vim /var/lib/pgsql/daselement-data/postgres.conf # uncomment and change the line: listen_addresses = '*' # and change the port to 5433 port = 5433 # start the database pg_ctl -D /var/lib/pgsql/daselement-data start
create a replication user
# create replication user psql -- port 5433 postgres [local]:5433 postgres=# create user repuser replication;
allow remote access in pg_hba.conf
add line to allow access for the replication user
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 database pg_ctl -D /var/lib/pgsql/daselement-data restart
The primary system is now ready. Let’s move on to the replica system!