TransWikia.com

Is there any unique identifier for PostgreSQL? How can the master identify its slave unqiuely?

Database Administrators Asked by manvith on January 1, 2021

Is there any way to have more than one PostgreSQL slave servers in the same system.

If yes, how come a master detect each server as different slaves from the below query

select * from pg_stat_replication;

will give one row for each slave which are connected to it, with PID, IP-address/client_address, client_port, etc..

If two servers are running in the same machine gives the same IP-address so it is not a unique identifier.

If slave got restarted then both client_port and PID will change so these are also cant be a unique identifier.

So, what is the unique identifier used by Postgres master to identify each slave server uniquely? Or how it is finding its slave servers differently?

One Answer

The master does not "find" the replicas. The replicas find the master.

The master identifies the replicas by either their slot_name, or their application_name, or not at all, depending on the context.

What are you trying to do?

Answered by jjanes on January 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP