Postgresql using lxd faild to find address

Started by Scottixover 9 years ago2 messagesgeneral
Jump to latest
#1Scottix
scottix@gmail.com

Hi I am using postgresql 9.5 in lxd container on Ubuntu. Using the stock
64bit 16.04 ubuntu image. Postgres is working just fine within the
container, but when I try to assign the ip address associated to the
container it fails to recognize it at boot. When I restart postgresql it
recognizes it just fine. So it seems like it is not getting the ip address,
maybe it is a little bit slower. Anyway to delay the boot time?

Steps to reproduce:
1. Setup lxd container
2. Install postgresql-9.5
3. Configure ip address in the config
4. restart container

Symptoms:
1. postgresql running fine
2. No ip address assigned to postgresql

Logs:
2016-10-10 14:40:33 UTC [143-1] LOG: could not bind IPv4 socket: Cannot
assign requested address
2016-10-10 14:40:33 UTC [143-2] HINT: Is another postmaster already
running on port 5432? If not, wait a few seconds and retry.
2016-10-10 14:40:33 UTC [143-3] WARNING: could not create listen socket
for "10.0.3.51"
2016-10-10 14:40:33 UTC [144-1] LOG: database system was shut down at
2016-10-07 23:05:34 UTC
2016-10-10 14:40:33 UTC [144-2] LOG: MultiXact member wraparound
protections are now enabled
2016-10-10 14:40:33 UTC [143-4] LOG: database system is ready to accept
connections
2016-10-10 14:40:33 UTC [148-1] LOG: autovacuum launcher started

#systemctl restart postgresql

2016-10-10 15:17:33 UTC [2353-1] LOG: database system was shut down at
2016-10-10 15:17:32 UTC
2016-10-10 15:17:33 UTC [2353-2] LOG: MultiXact member wraparound
protections are now enabled
2016-10-10 15:17:33 UTC [2352-1] LOG: database system is ready to accept
connections
2016-10-10 15:17:33 UTC [2357-1] LOG: autovacuum launcher started

Thanks

#2Scott Mead
scottm@openscg.com
In reply to: Scottix (#1)
Re: Postgresql using lxd faild to find address

On Mon, Oct 10, 2016 at 11:25 AM, Scottix <scottix@gmail.com> wrote:

Hi I am using postgresql 9.5 in lxd container on Ubuntu. Using the stock
64bit 16.04 ubuntu image. Postgres is working just fine within the
container, but when I try to assign the ip address associated to the
container it fails to recognize it at boot. When I restart postgresql it
recognizes it just fine. So it seems like it is not getting the ip address,
maybe it is a little bit slower. Anyway to delay the boot time?

Steps to reproduce:
1. Setup lxd container
2. Install postgresql-9.5
3. Configure ip address in the config
4. restart container

Symptoms:
1. postgresql running fine
2. No ip address assigned to postgresql

Logs:
2016-10-10 14:40:33 UTC [143-1] LOG: could not bind IPv4 socket: Cannot
assign requested address
2016-10-10 14:40:33 UTC [143-2] HINT: Is another postmaster already
running on port 5432? If not, wait a few seconds and retry.
2016-10-10 14:40:33 UTC [143-3] WARNING: could not create listen socket
for "10.0.3.51"

Set your listen_addresses='*'
This means, any and all available IP addresses. If you hardcode the IP
in the config, you'll get this type of error. This way, no matter what
interfaces you have, you'll get a bind. The downside is that it will
listen on ALL network interfaces you have in the box. Sometimes you
explicitly don't want a certain interface to be listening. You can fix
this with a firewall or pg_hba.conf however.

--Scott

2016-10-10 14:40:33 UTC [144-1] LOG: database system was shut down at
2016-10-07 23:05:34 UTC
2016-10-10 14:40:33 UTC [144-2] LOG: MultiXact member wraparound
protections are now enabled
2016-10-10 14:40:33 UTC [143-4] LOG: database system is ready to accept
connections
2016-10-10 14:40:33 UTC [148-1] LOG: autovacuum launcher started

#systemctl restart postgresql

2016-10-10 15:17:33 UTC [2353-1] LOG: database system was shut down at
2016-10-10 15:17:32 UTC
2016-10-10 15:17:33 UTC [2353-2] LOG: MultiXact member wraparound
protections are now enabled
2016-10-10 15:17:33 UTC [2352-1] LOG: database system is ready to accept
connections
2016-10-10 15:17:33 UTC [2357-1] LOG: autovacuum launcher started

Thanks

--
--
Scott Mead
Sr. Architect
*OpenSCG <http://openscg.com&gt;*
http://openscg.com