Ran the following for a fresh install.

yum install postgresql-server postgresql-contrib
postgresql-setup initdb
systemctl start postgresql

With standard config, no changes or anything.

Nov 02 10:33:17 xxx.org pg_ctl[87482]: LOG:  could not bind IPv4 socket: Address already in use
Nov 02 10:33:17 xxx.org pg_ctl[87482]: HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.

But it actually has binded to fine. I ran netstat -anp before postgres started and 5432 port isn't in use. After I started postgresl I can see it has binded to 5432 successfully.

netstat -anp | grep 5432
tcp        0      0*               LISTEN      12421/postgres      
unix  2      [ ACC ]     STREAM     LISTENING     46516    12421/postgres       /tmp/.s.PGSQL.5432
unix  2      [ ACC ]     STREAM     LISTENING     46514    12421/postgres       /var/run/postgresql/.s.PGSQL.5432

I installed it on another identical server last week with the same image and it is perfectly fine. I compared the pg version and the /etc/hosts file and they are the same. I even copied the same postgres conf over and it still gave me the same problem. Postgresql is started and I can connect fine! just annoying that it is throwing up that message when it starts.

listen_addresses = '*'
port = 5432

Turns out that you need this in postgresql.conf. Even though by default, it binds to that port!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.