Re: Does PostgreSQL listen_addresses='*' Dynamically Detect New Interfaces

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

 



Hi Stelios,

Yes, this behavior is typical for PostgreSQL when listen_addresses is set to '*'. When PostgreSQL is configured to listen on all available network interfaces (via listen_addresses = '*'), it dynamically detects new interfaces and IP addresses without requiring a restart or service reload. So, as long as listen_addresses is '*' and the necessary network interfaces are configured correctly in the OS, PostgreSQL should continue functioning as expected without requiring a restart.

Why it is safe (under normal conditions) : -

  1. OS handles the interfaces: PostgreSQL trusts the OS to expose valid network interfaces. If the OS assigns a new IP, PostgreSQL bound to '*' can accept connections immediately — no corruption or instability risks.

  2. No restart required: As you observed, PostgreSQL doesn't need to rebind or restart because it's already listening on the wildcard interface (0.0.0.0 or :: for IPv6).

  3. Used in production setups: Many production systems with HA setups (e.g., floating IPs or VIPs) rely on this behavior during failover


Thanks,
Pratik Pandit

On Mon, May 5, 2025 at 2:26 PM Stelios Malathouras <s.malathouras@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi,

We've scheduled for an IP change for one of our dedicated PostgreSQL servers, running on version 13.8.
Our local tests, with listen_addresses = '*',  show that the postgres listener accepts connections immediately to the new IP.
The same behavior is observed when adding a new network interface.  Postgres accepts connections to the new network interface (and IP) immediately without requiring a restart.

Is it safe to assume this is the default behaviour ? How does the instance detect new interfaces and their IP(s) and begin listening on them without needing a service reload or restart?  

Thanks,

Stelios

 


[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux