LOG: database system was shut down at 13:11:04 PDT LOG: database system is ready to accept connections LOG: record with zero length at 0/274FA10 Log output after pg-stop LOG: database system was interrupted last known up at 10:51:08 PDT Pg_ctl -D /usr/local/var/postgres stop -s -m fast For Reference # psqlĪlias pg-start='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'Īlias pg-stop='pg_ctl -D /usr/local/var/postgres stop -s -m fast' pid file, instead I used a pg-stop alias I had created in my. After checking the postmaster.pid file's pid, I noticed I had no process running. I had this same issue after a hard reboot. (And really, shouldn't Postgres be smart enough to realize that there is no process with PID 933 and remove the bogus pid file on its own?) (or at least that's what I just saw after I did the above :-) ) LOG: database system was not properly shut down automatic recovery in progress LOG: database system was interrupted last known up at 09:41:32 PDT HINT: Is another postmaster (PID 933) running in data directory "/usr/local/var/postgres"? You should see FATAL: lock file "postmaster.pid" already exists Then run tail -f /usr/local/var/postgres/server.log To find out if another process is running on that port, you can do ps wax | grep `head -1 /usr/local/var/postgres/postmaster.pid` rm /usr/local/var/postgres/postmaster.pid So if another process - or none at all - is running on that port, just delete the pid file, e.g. This solution is not for a production system, and you should really make sure the postgres daemon is not running, but I use my laptop for coding and I'm not worried about needing to regenerate my databases. This happens to me when my laptop's battery dies. (You must also verify that the postmaster.pid is not on shared storage where the server could be running on some other VM/host).Īnother possibility is that you had a hard shutdown and the postgres process died without cleaning up its pid file. If the pid is not that of a postgres postmaster, manually kill any postgres backends that may still be running, verify that they are no longer running, and only then remove postmaster.pid. Again, do not use kill -9 or kill -KILL, just use a plain kill, i.e. Kill the postmaster process with the following command, replacing 'PID' with the number you have noted down. Verify with ps that the pid is that of a postgres postmaster. Note down the number on the first line, which is the pid of the postmaster. It is highly likely that you will experience conflicts down the track unless you uninstall the other older version of PostgreSQL.Ĭat /usr/local/var/postgres/postmaster.pid You will then be able to start a new server in the datadir against the freshly initdb'd data. Kill the postmaster (do not use kill -9, just an ordinary kill will do) and the rest will shut down too. You can't use pg_ctl to shut the server down like normal because you've deleted the cluster datadir, so you must simply kill the processes. So you now have some orphan PostgreSQL server processes that are managing data files that've been deleted, so they're no longer accessible in the file system and will be fully deleted when the last open file handle to them is closed. You already had PostgreSQL installed, and you deleted the data dir without stopping the running server. Public service announcement: never delete postmaster.pid. ![]() Now when I look at my Activity Monitor I can see 6 instances of postgress. HINT: Is another postmaster (PID 13731) running in data directory "/usr/local/var/postgres"? So, I ran that command and got: postgres -D /usr/local/var/postgresįATAL: lock file "postmaster.pid" already exists You can now start the database server using: So, I rm -rf the postgres folder and ran it again: initdb /usr/local/var/postgres -E utf8 With an argument other than "/usr/local/var/postgres". The directory "/usr/local/var/postgres" or run initdb If you want to create a new database system, either remove or empty ![]() Initdb: directory "/usr/local/var/postgres" exists but is not empty ![]() The default text search configuration will be set to "english". The database cluster will be initialized with locale "en_US.UTF-8". This user must also own the server process. I ran initdb /usr/local/var/postgres -E utf8 but got this: The files belonging to this database system will be owned by user "atal421". I just reinstalled postgres via brew install postgres
0 Comments
Leave a Reply. |