Re: Create a standby server

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: Create a standby server
Дата
Msg-id Ze71eTN6uCCPDzZF@tamriel.snowman.net
обсуждение исходный текст
Ответ на Create a standby server  (normandavis1990 <normandavis1990@proton.me>)
Ответы Re: Create a standby server
Список pgsql-general
Greetings,

* normandavis1990 (normandavis1990@proton.me) wrote:
> I have a master and tow standby servers. I want to create another one. These servers are made by someone else and I
ama 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
Standbyservers, 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

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Mateusz Henicz
Дата:
Сообщение: Re: Create a standby server
Следующее
От: Michał Kłeczek
Дата:
Сообщение: Re: Pgxs - How to reference another extension