2

I have PostgreSQL 9.3, and I'm trying to set it up on CentOS. One part that has been driving me nuts is the listen_addresses setting.

I set it to * inside postgresql.conf:

listen_addresses = '*'

but when I look inside psql, I see it as localhost:

postgres=# show listen_addresses;
listen_addresses
-----------------
 localhost
(1 row)

I do restart the postgresql instance after changing postgresql.conf. Also, show config_file verifies that I'm changing the right postgresql.conf file. Moreover, I run ps aux | grep postgres and make sure that there are no rogue command line parameters (like -i or -c) but only -D to set up the data directory.

When I do select name,source,sourcefile,sourceline,setting from pg_settings where name like '%listen%'; I see that source is default, sourcefile and sourceline are empty for listen_addresses (the setting is, as I said above, localhost)

When I do netstat -na | grep 15432 (15432 is my PostgreSQL port, I set it up inside postgresql.conf and also as an environment variable PGPORT), I see something like following:

tcp 0 0 127.0.0.1:15432 0.0.0.0:* LISTEN

I think if listen_addresses were * I'd have 0:0:0:0:15432 rather than 127.0.0.1:15432

So, how can I solve this problem?

Relevant questions:

listen_addresses set to '*' in postgresql.conf disappears every reboot of Ubuntu

Howto disable Postgres listening on TCP?

http://postgresql.1045698.n5.nabble.com/pg-ctl-stop-failure-td5755968.html

How to connect to an remote PostgreSQL database on Ubuntu using pgAdmin3?

Edit 1 When I start postgres with -i option and do show listen_addresses;, I do see *.

  • You did remove the comment character at the start of the line? Just checking! – Colin 't Hart Aug 28 '14 at 17:06
  • Yes, I did remove the # =) – kolistivra Aug 28 '14 at 17:12
  • Is it possible that you have another listen_address line in this file? It might be overriding your setting – mvp Aug 31 '14 at 1:47
  • Are you sure ps aux is showing you all, and not just the first so many characters? Also, look for a systemd config file. Or just build your own postgres from scratch, then you won't have to fight the packagers decisions. – jjanes Aug 31 '14 at 3:30

Your Answer

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

Browse other questions tagged or ask your own question.