"Could not create IPv6 socket" postgresql standby error
Solution 1
This happens when IPv6 is not enabled in the kernel but IPv6 addresses are advertised somewhere.
Sometimes localhost
in /etc/hosts
designates both 127.0.0.1
(IPv4) and ::1
(IPv6). In which case you may remove the IPv6 alias to avoid that kind of error.
The stats collector (a separate process launched by PostgreSQL) uses the hard-coded name localhost
, so this problem would make it fail to start with the mentioned error message. However, this shouldn't prevent PostgreSQL itself to start.
If *
happens to include problematic IPv6 addresses, you may solve the problem by being selective in listen_addresses
(which is good practice anyway):
listen_addresses=127.0.0.1,10.10.10.1 # add other interfaces if needed
Solution 2
To disable the IPv6 error, you have to do following steps.
paste the following code in this file (/etc/sysctl.conf)
net.ipv6.conf.all.disable_ipv6 = 1
In postgresql.conf file change the listen address to 0.0.0.0
listen_address ='0.0.0.0'
That's it and restart the postgreSQL service.
Related videos on Youtube
Comments
-
Alex over 1 year
I'm trying to create Postgresql 9.1 hot-standby using following steps:
- Configured 2 virtual linux machines. Master's ip: 10.10.10.1, Standby's ip: 10.10.10.2. Ping test passed.
- Restored the same db backup on both.
Edited pg_hba on master. Added line:
host replication postgres 10.10.10.2/32 md5
Edited Master's postgresql.conf:
listen_address = '*' wal_level = hot_standby max_wal_senders = 3
Created recovery.conf on Standby:
standby_mode = 'on' primary_conninfo = 'host=10.10.10.1'
After adding recovery.conf I fail to start Standby server. In startup log I get an error:
> could not create IPv6 socket
Did I missed something?
-
Otheus almost 9 yearsThanks for your answer, Daniel. My system has no IPv6 enabled anywhere, nor are there ipv6 addresses in the hosts file or elsewhere, yet I still see this. I don't want to set
listen_addresses
for a variety of reasons. Any ideas where the IPv6 is getting picked up?