PostgreSQL server: auto vaccum not running and log entry ‘could not bind socket for statistics collector’

I recently had quite a bit of trouble with a PostgreSQL 9.3 server under linux.

Auto-vaccum was not running even though it was enabled in the config file. The log file under /var/lib/pgsql/data/pg_log/ had the following entry:

2014-12-02 15:27:36 CET LOG: could not bind socket for statistics
collector: Cannot assign requested address
2014-12-02 15:27:36 CET LOG: disabling statistics collector for lack of
working socket
2014-12-02 15:27:36 CET WARNING: autovacuum not started because of
2014-12-02 15:27:36 CET HINT: Enable the "track_counts" option.

(But track_counts was enabled in postgresql.conf.)

It turned out that a weird /etc/hosts file was responsible. PostgreSQL tries to bind an address on whatever localhost resolves to, according to /etc/hosts.

The /etc/hosts file listed the following line for localhost:

::1 localhost ipv6-localhost ipv6-loopback

This maps IPv6 ::1 to localhost. I changed the line, and added another line, like this: localhost
::1 ipv6-localhost ipv6-loopback

Restarting the postgresql server with pg_ctl restart -m fast then resulted in the following log entries:

2014-12-03 17:17:53 CET LOG: database system is ready to accept connections
2014-12-03 17:17:53 CET LOG: autovacuum launcher started

Yay, it is working!

My thanks go out to Tom Lane on the postgres-general mailing list, who helped my fix this.


About dfspspirit

PhD student in bioinformatics, interested in photography, level design, digital image manipulation, architecture and, of course, bioinformatics.
This entry was posted in databases, IT and computers, linux, troubleshooting and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s