I would like to be able to configure postgres to listen on specific interfaces, rather than '*', but one of them is virtual IP (VIP).
If I configure listen_addresses in postgresql.conf with the IP addresses of the interfaces, it works properly except for the VIP - postgres does not actually listen on the VIP.
However, if I configure listen_addresses to listen on '*', then when the VIP becomes active on the local machine, postgres picks it up and listens on that interface as expected.
Is there some option I am overlooking, maybe?
Thanks!
Codifying my (apparently helpful) answer from the comments:
Assuming this is Linux, you may need to set net.ipv4.ip_nonlocal_bind
so PostgreSQL can bind to the VIP whether or not it's active at startup.