Search Postgresql Archives

Re: Create a standby server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings,

* normandavis1990 (normandavis1990@xxxxxxxxx) wrote:
> 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:

[...]

> A) Which on is better and easier?

One referred to 9.2, which is extremly old and no longer supported, and
the other said it was archived ... so I'm not sure either is really
great to be used today.

> 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?

If those systems are connected to the primary, you can query the view
pg_stat_replication and see what user they are connected with:

SELECT * FROM pg_stat_replication;

You should be able to use the existing user to create a new standby.
I'd recommend using pg_basebackup to create it with a command along
these lines:

pg_basebackup -h existing.server.com -U username -D /destination/directory -c fast -C -S standbyslotname -R -P -v

Running pg_basebackup this way will:
- Have pg_basebackup connect to 'existing.server.com' (should be your
  primary)
- Connect as user 'username' (pull this from the 'usename' field in
  pg_stat_replication)
- Store the data files for the new system into /destination/directory on
  the system where pg_basebackup is run
- Start the backup immediately by doing a 'fast' checkpoint
- Create a replication slot to use to make sure the WAL is kept on the
  primary until the new standby system collects it (you should monitor
  this though- if you destroy this new system, WAL could build up on the
  primary).
- Use 'standbyslotname' as the name of the slot that's created
- Instructs pg_basebackup to write out the connection information to
  connect to the primary and start streaming when it starts up.
- Enabled progress reporting from pg_basebackup
- Enables verbose mode of pg_basebackup

Full documentation of pg_basebackup is here:

https://www.postgresql.org/docs/current/app-pgbasebackup.html

Thanks!

Stephen

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux