public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pratik Pandit <[email protected]>
To: Stelios Malathouras <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Does PostgreSQL listen_addresses='*' Dynamically Detect New Interfaces
Date: Mon, 5 May 2025 16:49:39 +0530
Message-ID: <CAFchsDXPDTf_4FQi2Q2sfrQ-E=uoT4Xz5wYZZ7jJmjCK61uSMw@mail.gmail.com> (raw)
In-Reply-To: <PAWPR05MB10431391F889466D240403A988D8E2@PAWPR05MB10431.eurprd05.prod.outlook.com>
References: <PAWPR05MB10431391F889466D240403A988D8E2@PAWPR05MB10431.eurprd05.prod.outlook.com>

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 <
[email protected]> 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*
>
>
>


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Does PostgreSQL listen_addresses='*' Dynamically Detect New Interfaces
  In-Reply-To: <CAFchsDXPDTf_4FQi2Q2sfrQ-E=uoT4Xz5wYZZ7jJmjCK61uSMw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox