postgresql 8.4 daemon wants a port that is busy

Asked by John Winterton

In attempting to initiate the postgres daemon using the postgres -D <dirname> command I find that the default port 5432 is busy and the daemon refuses to initiate. Other than picking another port, how can I close that port before I try the initiation.

What is initiating port 5432 on TCP? I don't do it except when trying to get the postgres daemon up.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu postgresql Edit question
Assignee:
No assignee Edit question
Solved by:
Kenny Meyer
Solved:
Last query:
Last reply:
Revision history for this message
Best Kenny Meyer (knny-myer) said :
#1

Port 5432 may be busy, because you may have already a PostgreSQL instance running on the same port. If you did a default install with apt-get, PostgreSQL initiates (starts) every time you boot your Ubuntu box and listening (by default) on port 5432 as a daemon.

You can make it stop listening by typing the following in a terminal:
`sudo /etc/init.d/postgresql stop`

Check out the wiki at https://help.ubuntu.com/community/PostgreSQL

I hope I could bring some light into the darkness.

Revision history for this message
John Winterton (jwinterton) said :
#2

It turns out that the command needed is:
sudo /etc/init.d/postgresql-m.n stop

where: m = version and n = subversion. In my case -8.4

Also, you need to fix permisions in the /var/locks directory to allow the system to set a file lock.

Thanks, Kenny. I am an old sweat at this, but sometimes the vagaries of developers does defeat me. I am not very good at RFM.

John.