Postgres database is not running after OSX crash
Every one might have face the problem that Postgres id not running after OSX is crashed. Every time you try to start the Postgres server it will say : -
another server might be running; trying to start server anyway
You can follow the below steps to get rid of the problem.
Step 1: Open your terminal and run
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
It will Say
pg_ctl: another server might be running; trying to start server anyway
Step 2: Check the log
$ tail -f /usr/local/var/postgres/server.log
It will print something like this
FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 326) running in data directory "/usr/local/var/postgres"?
FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 326) running in data directory "/usr/local/var/postgres"?
Step 3: Delete the PID file.
$ rm /usr/local/var/postgres/postmaster.pid
Step 4: Run the pg_ctl manually
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Step 5: Check if the postgres is running fine or not
$ ps x | grep postgres
It will print something like this
8352 ?? S 0:00.02 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
8354 ?? Ss 0:00.00 postgres: checkpointer process
8355 ?? Ss 0:00.03 postgres: writer process
8356 ?? Ss 0:00.01 postgres: wal writer process
8357 ?? Ss 0:00.00 postgres: autovacuum launcher process
8358 ?? Ss 0:00.00 postgres: stats collector process
That's it, your problem has been fixed.
another server might be running; trying to start server anyway
You can follow the below steps to get rid of the problem.
Step 1: Open your terminal and run
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
It will Say
pg_ctl: another server might be running; trying to start server anyway
Step 2: Check the log
$ tail -f /usr/local/var/postgres/server.log
It will print something like this
FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 326) running in data directory "/usr/local/var/postgres"?
FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 326) running in data directory "/usr/local/var/postgres"?
Step 3: Delete the PID file.
$ rm /usr/local/var/postgres/postmaster.pid
Step 4: Run the pg_ctl manually
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Step 5: Check if the postgres is running fine or not
$ ps x | grep postgres
It will print something like this
8352 ?? S 0:00.02 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
8354 ?? Ss 0:00.00 postgres: checkpointer process
8355 ?? Ss 0:00.03 postgres: writer process
8356 ?? Ss 0:00.01 postgres: wal writer process
8357 ?? Ss 0:00.00 postgres: autovacuum launcher process
8358 ?? Ss 0:00.00 postgres: stats collector process
That's it, your problem has been fixed.
Comments
Post a Comment