PostgreSQL query is not terminated, the service postgreSQL is not started after reboot

In my work, I am running a complex query. I canceled it and went home yesterday. It is impossible to terminate the query later this morning. There is also a “after termination” “End” function. A colleague of mine restarted the host where postgres was installed. After the machine restarted, the postgres database server could not be started.

In my log file, I see an error:

‘pg_ctl: this data directory appears to be running a pre-existing postmaster’

I don’t know how to deal with this Problem. I can try to fix it or try to infer data from the saved file. What is the most logical step and do you know how to solve this problem?

Before it gave this error message:

2016-01-28 15:52:33 GMT FATAL: lock file “postmaster .pid” already exists
2016-01-28 15:52:33 GMT HINT: Is another postmaster (PID 2100) running in data directory “C:/PostgreSQL/9.1/data”?

Update…I found the file postmaster.pid and deleted it. Now I am restarting the computer and hope it will start.

Update…It works now. I restarted the computer and started postgres immediately . I was very happy when I was young, but at the same time, I was not satisfied with the following forum: https://superuser.com/questions/553045/fatal-lock-file-postmaster-pid-already-exists. It is stated here that postmaster.pid should never be deleted, because it may There is data corruption. Therefore, I will back up all the databases I have in postgres.

So if someone can share my ICT adventure today, I will be very satisfied. That’s why I won’t Said that this question has been answered because I don’t know what went wrong, and maybe I will encounter this problem again one day.

The explanation is very simple. PostgreSQL writes the process ID to a file named postmaster.pid – the existence of this file should indicate that the server is running. When PostgreSQL shuts down cleanly, it deletes the postmaster.pid file.

However, when your colleague restarted the host, the PostgreSQL server was killed without a chance to delete the postmaster.pid file. Therefore, when you try to start PostgreSQL, the existence of the file makes It seems to complain that the server is already running.

This answer provides more complete advice. In general, you should never delete postmaster.pid for no good reason, because it should help prevent both The server runs on the same data file at the same time. However, if you If the process indicated by the postmaster.pid file has died, you must manually delete the obsolete PID file.

In my work, I am running a complex query. I canceled it and went home yesterday. It is impossible to terminate the query later this morning, and there is also a “terminate backend” function. A colleague of mine restarted the host with postgres installed. After the machine restarted, the postgres database server Unable to start.

In my log file, I see an error:

‘pg_ctl: this data directory appears to be running a pre-existing postmaster’

I don’t know how to deal with this problem. I can try to fix it or try to infer data from the saved file. What is the most logical step for you Any idea how to solve this problem?

Before it gave this error message:

2016-01-28 15:52:33 GMT FATAL: lock file “postmaster .pid” already exists
2016-01-28 15:52:33 GMT HINT: Is another postmaster (PID 2100) running in data directory “C:/PostgreSQL/9.1/data”?

Update…I found the file postmaster.pid and deleted it. Now I am restarting the computer and hope it will start.

Update…It works now. I restarted the computer and started postgres immediately . I was very happy when I was young, but at the same time, I was not satisfied with the following forum: https://superuser.com/questions/553045/fatal-lock-file-postmaster-pid-already-exists. It is stated here that postmaster.pid should never be deleted, because it may There is data corruption. Therefore, I will back up all the databases I have in postgres.

So if someone can share my ICT adventure today, I will be very satisfied. That’s why I won’t Said that this question has been answered because I don’t know what went wrong, and maybe I will encounter this problem again one day.

The explanation is very simple. PostgreSQL will process ID is written into a file named postmaster.pid – the presence of this file should indicate that the server is running. When PostgreSQL shuts down cleanly, it deletes the postmaster.pid file.

But when you When my colleague restarted the host, the PostgreSQL server was killed without a chance to delete the postmaster.pid file. Therefore, when you try to start PostgreSQL, the existence of the file makes it appear to complain that the server is already running.

This answer provides more complete suggestions. In general, you should never delete postmaster.pid for no good reason, because it should help prevent two servers from running on the same data file at the same time. However, If you are sure that the process indicated by the postmaster.pid file has died, then you must manually delete the obsolete PID file.

Leave a Comment

Your email address will not be published.