I'm trying to create Postgresql 9.1 hot-standby using following steps:

  1. Configured 2 virtual linux machines. Master's ip:, Standby's ip: Ping test passed.
  2. Restored the same db backup on both.
  3. Edited pg_hba on master. Added line:

    host   replication   postgres   md5
  4. Edited Master's postgresql.conf:

    listen_address = '*'
    wal_level = hot_standby
    max_wal_senders = 3
  5. Created recovery.conf on Standby:

    standby_mode = 'on'
    primary_conninfo = 'host='

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?


This happens when IPv6 is not enabled in the kernel but IPv6 addresses are advertised somewhere.

Sometimes localhost in /etc/hosts designates both (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=, # add other interfaces if needed

  • Thanks 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? – Otheus Jul 19 '15 at 20:09

To disable the IPv6 error, you have to do following steps.

  1. paste the following code in this file (/etc/sysctl.conf)

    net.ipv6.conf.all.disable_ipv6 = 1

  2. In postgresql.conf file change the listen address to

    listen_address =''

That's it and restart the postgreSQL service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.