Re: Network Card Not Listening at Startup

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ludwig Isaac Lim <ludz_lim(at)yahoo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Network Card Not Listening at Startup
Date: 2022-02-09 17:49:03
Message-ID: 1433798.1644428943@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ludwig Isaac Lim <ludz_lim(at)yahoo(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Hardy 2022-02-09 18:11:45 DELETING then INSERTING record with same PK in the same TRANSACTION
Previous Message Ludwig Isaac Lim 2022-02-09 16:32:23 Network Card Not Listening at Startup