I have a server with 2 networking interfaces - global on eth0, and local on eth1 with IP like 10.181.xx.xx. Running Ubuntu 16.04.
I set up PostgreSQL to listen on this local address, so another server from the network can access it.
The issue is when I reboot DB server, PostgreSQL can not bind to this local address. Having this in postgresql.log:
2016-07-01 15:06:09 GMT LOG: could not bind IPv4 socket: Cannot assign requested address
2016-07-01 15:06:09 GMT HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2016-07-01 15:06:09 GMT WARNING: could not create listen socket for "10.181.xx.xx"
After doing service postgresql restart
all is working.
How can I make Postgres wait until eth1 is up after reboot and bind to it?