- Initialize the database folder “/var/lib/pgsql/10/data” using the following command. Please keep in mind that the Linux user “postgres” has the data directory already configured as an environment variable called “$PGDATA”:
sudo -u postgres /usr/pgsql-10/bin/initdb -D /var/lib/pgsql/10/data
- Change the following configurations in the “/var/lib/pgsql/10/data/postgresql.conf” configuration file as follows: (Make sure to remove the comments #)
wal_level = replica
archive_mode = on
archive_command = ‘/bin/true’
max_wal_senders = 10
wal_sender_timeout = 3600s
max_replication_slots = 10
hot_standby = on
hot_standby_feedback = on
autovacuum = on
work_mem = 24MB
shared_buffers = 12GB
max_connections = 1000
listen_addresses = ‘*’
shared_preload_libraries = ‘repmgr’
wal_log_hints = on
If you want more information on these parameters, please look here:
The parameter descriptions you can find in this link:
https://www.postgresql.org/docs/10/runtime-config.html
https://www.postgresql.org/docs/10/runtime-config-replication.html – (for Replication)
Note that the configuration above is for VM with 12 CPUs and 32GB RAM and is based on the following:
VM Type | shared_buffers | work_mem | max_worker_processes |
---|---|---|---|
2 CPU \ 8GB RAM | 2GB | 4MB | 2 |
8 CPU \ 16GB RAM | 3GB | 6MB | 8 |
12 CPU \ 32GB RAM | 12GB | 24MB | 8 |
- Next, we need to add more rule to the “/var/lib/pgsql/10/data/pg_hba.conf” file to accept all connections from all sources. Note that Siemplify recommends typing it into the file and not copy/pasting it.
IPv4 local connections:
host all all 0.0.0.0/0 md5
host replication all 0.0.0.0/0 md5
- Finally, we need to add “postgres” as a sudoer for the “system_start_command” in repmgr as follows. Add a new text file “/etc/sudoers.d/postgres” which contains the following:
Defaults:postgres !requiretty postgres ALL = NOPASSWD: /usr/bin/systemctl stop postgresql-10,/usr/bin/systemctl start postgresql-10,/usr/bin/systemctl restart postgresql-10,/usr/bin/systemctl reload postgresql-10
Need more help with this?
Click here to open a Support ticket