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


Reply via email to