I am reinstalling Apache Age and when i am following the Age github doucmentation guide to install Apache Age. Everthing is working fine till that command.
cd age/
install
sudo make PG_CONFIG=/home/imran/age_installation/pg/postgresql-11.18/bin/pg_config install
install check
make PG_CONFIG=/home/imran/age_installation/pg/postgresql-11.18/bin/pg_config installcheck
cd postgresql-11.18/
intitialization
bin/initdb demo
After the intiliaztion command, i am getting this output.
Success. You can now start the database server using: bin/pg_ctl -D demo -l logfile start
Now when i run this command:
bin/pg_ctl -D demo -l logfile start
I am getting this unexpected output:
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.
While i am expecting this output that the server will be started.
The log file is as follows:
023-04-14 20:24:19.807 PKT [23717] LOG: could not bind IPv4 address "127.0.0.1": Address already in use
2023-04-14 20:24:19.807 PKT [23717] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2023-04-14 20:24:19.807 PKT [23717] WARNING: could not create listen socket for "localhost"
2023-04-14 20:24:19.807 PKT [23717] FATAL: could not create any TCP/IP sockets
2023-04-14 20:24:19.807 PKT [23717] LOG: database system is shut down
2023-04-14 20:25:11.149 PKT [23724] LOG: could not bind IPv4 address "127.0.0.1": Address already in use
2023-04-14 20:25:11.149 PKT [23724] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2023-04-14 20:25:11.150 PKT [23724] WARNING: could not create listen socket for "localhost"
2023-04-14 20:25:11.150 PKT [23724] FATAL: could not create any TCP/IP sockets
2023-04-14 20:25:11.150 PKT [23724] LOG: database system is shut down
2023-04-14 20:25:58.465 PKT [23733] LOG: could not bind IPv4 address "127.0.0.1": Address already in use
2023-04-14 20:25:58.465 PKT [23733] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2023-04-14 20:25:58.465 PKT [23733] WARNING: could not create listen socket for "localhost"
2023-04-14 20:25:58.465 PKT [23733] FATAL: could not create any TCP/IP sockets
2023-04-14 20:25:58.465 PKT [23733] LOG: database system is shut down
4
Answers
I can see that the issue is persisting because the server cannot be started since the port which youre trying to bind to is already in the use . So I recommend you to do following things:
After you have stopped it , you can then try to start AGE server again.
What this will do it will start the server on the designated 5433 port than on 5432
I hope these recommendations solve your issue.
This error is because, the port 5432 is occupied. To free up that port, find the process ID (PID) running on port 5432 as below:
This will return all the processes running on 5432 along with their PIDs. Next, kill the process(es) by running:
Run the server again
This error occurs when another process is already using the port you are trying to use (5432 by default). The most likely reason is that you have already started the Postgres sever before and trying to start again.
You can find which process is using the port using the following command.
You can then kill them directly using
kill PID
orpkill PROCESS_NAME
orkillall PROCESS_NAME
command, but this may result in some other process to misbehave so it is best to close the processes properly.As a temporary solution, you can also try to run the server on a different port. You can use one of these commands to run postgres on a different port.
And if you want to run the server permanently on a different port, you can change the port number in
postgresql.conf
file. There should be a line likeChange that to whatever you want, and try to start again.
From the log file, another postmaster or postgres server is running on the port 5432. You should stop that server but if you cannot remember starting a server then you can run
lsof -i :5432
; this shows you the process running on that port. After then, kill that process by usingsudo pkill PID
(PID is the process id which is returned on the command line after running the initial command). Now you can run the command to start the server again. If this doesn’t work, you should consider starting the server on another port number.