Thread: listening on an address other than 'localhost'?
per the documentation to listen for client connections on a given IP address you set listen_addresses to a commaspearated list of IP addresses in postgresql.conf
That line is commented out in the default conf file, when I uncomment it, and add the address, then do sudo systemctl restart postgresql the postgres processes are not running afterwards.
root@dhbpostgres:/home/johnson# ps -aux | grep postgres
root 1452 0.0 0.0 6608 2364 pts/1 S+ 19:07 0:00 grep --color=auto postgres
root@dhbpostgres:/home/johnson# vi /etc/postgresql/15/main/postgresql.conf <<commented out listen_addresses
root@dhbpostgres:/home/johnson# systemctl restart postgresql
root@dhbpostgres:/home/johnson# ps -aux | grep postgres
postgres 1461 0.2 0.1 219220 30568 ? Ss 19:08 0:00 /usr/lib/postgresql/15/bin/postgres -D /opt/data/pgdata -c config_file=/etc/postgresql/15/main/postgresql.conf
postgres 1462 0.0 0.0 219352 7028 ? Ss 19:08 0:00 postgres: 15/main: checkpointer
postgres 1463 0.0 0.0 219220 7024 ? Ss 19:08 0:00 postgres: 15/main: background writer
postgres 1465 0.0 0.0 219220 7032 ? Ss 19:08 0:00 postgres: 15/main: walwriter
postgres 1466 0.0 0.0 220816 9508 ? Ss 19:08 0:00 postgres: 15/main: autovacuum launcher
postgres 1467 0.0 0.0 220792 9444 ? Ss 19:08 0:00 postgres: 15/main: logical replication launcher
root 1480 0.0 0.0 6608 2276 pts/1 S+ 19:08 0:00 grep --color=auto postgres
If I comment that line out as it was in the beginning, and restart, it runs.
the syslog gives me the error
Sep 6 19:06:01 dhbpostgres postgresql@15-main[1538]: 2023-09-06 19:06:01.181 GMT [1543] LOG: syntax error in file "/etc/postgresql/15/main/postgresql.conf" line 63, near token ".206"
which corresponds to the listen_addresses line in the config file and is part of the address…
#listen_addresses = 10.128.206.109 # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
What am I missing? (postgresql 15.4 running on Ubuntu 22.04), installed via postgresql.org apt repo.
--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group
Institutions do not have opinions, merely customs
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group
Institutions do not have opinions, merely customs
> On 6 Sep 2023, at 21:23, Johnson, Bruce E - (bjohnson) <Johnson@pharmacy.arizona.edu> wrote: > What am I missing? (postgresql 15.4 running on Ubuntu 22.04), installed via postgresql.org apt repo. The value should be within '', so listen_addresses = '10.128.206.109' should work just fine. -- Daniel Gustafsson
On 06/09/2023 21:23 CEST Johnson, Bruce E - (bjohnson) <johnson@pharmacy.arizona.edu> wrote: > Sep 6 19:06:01 dhbpostgres postgresql@15-main[1538]: 2023-09-06 19:06:01.181 GMT [1543] LOG: syntax error in file "/etc/postgresql/15/main/postgresql.conf"line 63, near token ".206" > > #listen_addresses = 10.128.206.109# what IP address(es) to listen on; > # comma-separated list of addresses; > # defaults to 'localhost'; use '*' for all > # (change requires restart) Put the entire list of addresses in quotes, e.g. 'localhost,10.128.206.109'. -- Erik
On 9/6/23 12:23, Johnson, Bruce E - (bjohnson) wrote: > per the documentation to listen for client connections on a given IP > address you set listen_addresses to a commaspearated list of IP > addresses in postgresql.conf > > #listen_addresses = 10.128.206.109# what IP address(es) to listen on; > # comma-separated list of addresses; > # defaults to 'localhost'; use '*' for all > # (change requires restart) > > > What am I missing? (postgresql 15.4 running on Ubuntu 22.04), installed > via postgresql.org <http://postgresql.org> apt repo. The other replies have indicated how you should format the value. For future reference the postgresql.conf configuration docs: https://www.postgresql.org/docs/current/runtime-config.html tell you what is expected. In this case: https://www.postgresql.org/docs/current/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS listen_addresses (string) vs port (integer) > > > -- > Bruce Johnson > University of Arizona > College of Pharmacy > Information Technology Group > > Institutions do not have opinions, merely customs > -- Adrian Klaver adrian.klaver@aklaver.com