Hey,
Check your parameter primary_conninfo on any standby server, you should find here information about the user used for replication and its password or path to .pgpass file, where the password is stored. If there is no password or .pgpass file defined, then you do not need any password most likely, and you are likely using the "trust" authentication method in your pg_hba.conf for replication.
To create a replica pretty much all you have to do is to add your new standby server to pg_hba.conf, so you are allowed to connect and run on your new standby:
pg_basebackup -h <primary IP address> -U <replicator_user> -R -D /data_pg -X stream
pg_basebackup -h <primary IP address> -U <replicator_user> -R -D /data_pg -X stream
and then start it using
pg_ctl -D /data_pg start
There can be some parameters that need to be adjusted, like listen_addresses for example, unless you are using "*" for it. And maybe max_wal_senders/max_replication_slots can be too low and you may have to increase it, but if there is any problem and you will try to start your new replica it will just fail and you will get information about what was wrong to your logfile, so it is easy to find.
By adding -R to pg_basebackup you will get your replication configuration generated automatically to postgresql.auto.conf and -X will stream all WAL files generated during pg_basebackup execution to your new replica server.
If you prefer to use replication slots you may also add -C -S <slot_name> to get a replication slot created automatically by pg_basebackup.
Good luck!
Cheers,
Mateusz
pon., 11 mar 2024 o 12:51 normandavis1990 <normandavis1990@xxxxxxxxx> napisał(a):
Hello,
I have a master and tow standby servers. I want to create another one. These servers are made by someone else and I am a newbie in PostgreSQL.
I found the following two tutorials:
https://linuxconfig.org/how-to-create-a-hot-standby-with-postgresql
https://github.com/GoogleCloudPlatform/community/blob/master/archived/setting-up-postgres-hot-standby.md
A) Which on is better and easier?
B) In these articles, to create a Standby server, a user is created in the database. Because there are already two Standby servers, this user is probably created. How can I find it? Can I use that user to build a third server?
Cheers.