Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 520 Vote(s) - 3.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I fix stale postmaster.pid file on Postgres?

#1
I went to view a postgres schema on my local (MacOS 11) database, and was not able to view my schemas.
Connection Refused in PGSQL Editor! (DBeaver specifically)

[![connection refused DBeaver][1]][1]

So I opened my Postgres desktop application, and got the warning message, "Stale postmaster.pid file"


How can I fix this?

(This example is Postgres 12, but i'm sure this fix will work on later versions)

[![stale Postmaster.pid postgres 12 dashboard screenshot][2]][2]


[1]:

[2]:
Reply

#2
In my case I used the code `rm var-13/postmaster.pid` and solved.
Reply

#3
The problem is that the postmaster.pid file needs to be removed manually and regenerated by postgres, and these are the steps to do it. (Keep in mind the version might change, var-12, might be var-13 etc)

1. Open your terminal, and cd into the postgres directory: `cd /Users/$USER/Library/Application\ Support/Postgres`
2. Make sure you're in the right place, `ls` you should see something like `var-12` or `var-<version #>`
3. Verify the file is there, `ls var-12` (keep in mind the `var-XX` is equivalent to your PGSQL version)
4. Verify the Postgres server is not running by viewing desktop app

Version might change so could be var-12, var-13, etc etc depending on age of this article.
```
Library/Application Support/Postgres
➜ ls var-12
PG_VERSION pg_hba.conf pg_replslot pg_subtrans postgresql.auto.conf
base pg_ident.conf pg_serial pg_tblspc postgresql.conf
global pg_logical pg_snapshots pg_twophase postgresql.log
pg_commit_ts pg_multixact pg_stat pg_wal postmaster.opts
pg_dynshmem pg_notify pg_stat_tmp pg_xact postmaster.pid <----
```
1. Then remove postmaster.pid, `rm var-12/postmaster.pid`
2. or `rm var-<PG version #>/postmaster.pid`
3. Go back to your console, start your postgres server, and it should be functioning again, and you should have full access to your schemas.

Reply

#4
cd /Users/<UserName>/Library/Application\ Support/Postgres/

ls

Then we may view any of the directory names, such as var-9, var-10, var-11, etc... depending on which PostgreSQL version we have installed.

Following that, if we can see var-11,

cd var-11
rm postmaster.pid

Reply

#5
Since the question was using the desktop app, I thought I'd just add to the answers here with a version independent non-bash approach:

1. Open `Postgres` desktop app

2. Click `Server Settings...`

3. Click `Show` on the data directory

[![Show data directory][1]][1]

4. Rename or delete `postmaster.pid`

[![Delete or rename postmaster.pid][2]][2]

5. Click `Start` in the desktop app again.

[![Start SQL server][3]][3]


[1]:

[2]:

[3]:
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through