pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedNetwork Card Not Listening at Startup
3+ messages / 2 participants
[nested] [flat]
* Network Card Not Listening at Startup
@ 2022-02-09 16:32 Ludwig Isaac Lim <ludz_lim@yahoo.com>
2022-02-09 17:49 ` Re: Network Card Not Listening at Startup Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Ludwig Isaac Lim @ 2022-02-09 16:32 UTC (permalink / raw)
To: pgsql-general
Hello:
I'm running postgresql 12.9 on Amazon Linux in AWS.
My listen_addresses in postgresql.conf is configured like below:
listen_addresses = '172.17.1.57,localhost'
However, postgresql does not listen on 172..17.1.57. I can reproduce the phenomenon by simply rebooting the server and then run netstat -tulpn
[root@ip-172-17-1-206 data]# netstat -tulpn | grep 5432
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 2605/postgres
And there's nothing abnormal in the logs:
2022-02-09 15:59:36.906 UTC [2663] LOG: database system was shut down at 2022-02-09 15:59:20 UTC
2022-02-09 15:59:36.930 UTC [2605] LOG: database system is ready to accept connections
I had to run:
systemctl restart postgresql
For 172.17.1.57 to listen
[root@ip-172-17-1-206 data]# netstat -tulpn | grep 5432
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 4289/postgres
tcp 0 0 172.17.1.57:5432 0.0.0.0:* LISTEN 4289/postgres
Note that 172.17.1.57 is not the primary network interface. I created the network interface and attached it to the EC2 instance.
My systemd config file for postgresql (/etc/systemd/system/postgresql.service) was copied from 18.3. Starting the Database Server
18.3. Starting the Database Server
18.3. Starting the Database Server 18.3.1. Server Start-up Failures 18.3.2. Client Connection Problems Before an...
Extra information
------------------------------
postgres=# select version();
version
--------------------------------------------------------------------------------
PostgreSQL 12.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (R
(1 row)
How do make sure that NIC will be listening every time I started/restarted the server?
Thanks in advance,
Ludwig Lim
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Network Card Not Listening at Startup
2022-02-09 16:32 Network Card Not Listening at Startup Ludwig Isaac Lim <ludz_lim@yahoo.com>
@ 2022-02-09 17:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-02-10 11:45 ` Re: Network Card Not Listening at Startup Ludwig Isaac Lim <ludz_lim@yahoo.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2022-02-09 17:49 UTC (permalink / raw)
To: Ludwig Isaac Lim <ludz_lim@yahoo.com>; +Cc: pgsql-general
Ludwig Isaac Lim <ludz_lim@yahoo.com> writes:
> How do make sure that NIC will be listening every time I started/restarted the server?
You need to tell systemd not to start the postgresql service
until the network is up.
In basic cases, you can edit the postgresql.service file,
or maybe better create an add-on config file something like this:
$ cat /etc/systemd/system/postgresql.service.d/delay_start.conf
[Unit]
After=network-online.target
Wants=network-online.target
(The add-on file name doesn't matter, the directory name does.)
I'm not certain that this will wait for custom NICs if you are
doing something nonstandard to configure those, but for me
it works for alternate IPs configured in
/etc/sysconfig/network-scripts/ifcfg-whatever.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Network Card Not Listening at Startup
2022-02-09 16:32 Network Card Not Listening at Startup Ludwig Isaac Lim <ludz_lim@yahoo.com>
2022-02-09 17:49 ` Re: Network Card Not Listening at Startup Tom Lane <tgl@sss.pgh.pa.us>
@ 2022-02-10 11:45 ` Ludwig Isaac Lim <ludz_lim@yahoo.com>
0 siblings, 0 replies; 3+ messages in thread
From: Ludwig Isaac Lim @ 2022-02-10 11:45 UTC (permalink / raw)
To: pgsql-general
> On Thursday, February 10, 2022, 01:49:10 AM GMT+8, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Ludwig Isaac Lim <ludz_lim@yahoo.com> writes:
>> How do make sure that NIC will be listening every time I started/restarted the server?
> You need to tell systemd not to start the postgresql service
> until the network is up.
> In basic cases, you can edit the postgresql.service file,
> or maybe better create an add-on config file something like this:
> $ cat /etc/systemd/system/postgresql.service.d/delay_start.conf
> [Unit]
> After=network-online.target
> Wants=network-online.target
> (The add-on file name doesn't matter, the directory name does.)
> I'm not certain that this will wait for custom NICs if you are
> doing something nonstandard to configure those, but for me
> it works for alternate IPs configured in
> /etc/sysconfig/network-scripts/ifcfg-whatever.
> regards, tom lane
Thanks Tom. It works.
Regards,
Ludwig
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2022-02-10 11:45 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 16:32 Network Card Not Listening at Startup Ludwig Isaac Lim <ludz_lim@yahoo.com>
2022-02-09 17:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-02-10 11:45 ` Ludwig Isaac Lim <ludz_lim@yahoo.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox