Re: Replication

Поиск
Список
Период
Сортировка
От Masahiko Sawada
Тема Re: Replication
Дата
Msg-id CAD21AoCdugbzq8Hc37f58T-8D8JCLYq=EBCxYYoYT+b61PZY0w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Replication  (Vik Fearing <vik@2ndquadrant.fr>)
Ответы Re: Replication  (Vik Fearing <vik@2ndquadrant.fr>)
Список pgsql-general
On Sat, Jun 4, 2016 at 10:58 PM, Vik Fearing <vik@2ndquadrant.fr> wrote:
> On 02/06/16 15:32, Bertrand Paquet wrote:
>> Hi,
>>
>> On an hot standby streaming server, is there any way to know, in SQL, to
>> know the ip of current master ?
>
> No.
>
>> The solution I have is to read the recovery.conf file to find
>> primary_conninfo,
>
> That is currently the only solution.  There are plans to allow SQL
> access to the parameters in recovery.conf (or to merge them into
> postgresql.conf) but that's not currently possible.
>

It might not be a right way but how about using pg_read_file()?
postgres(1)=# select regexp_replace(pg_read_file('recovery.conf'),
'.*primary_conninfo = (.*)', '\1');
                  regexp_replace
---------------------------------------------------
 'host=localhost port=5550 application_name=node1'+

(1 row)

You can get the master server information via SQL from standby server.

Regards,

--
Masahiko Sawada


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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: WAL's listing in pg_xlog by some sql query
Следующее
От: Vik Fearing
Дата:
Сообщение: Re: Replication