Wednesday, April 7, 2021

Using pg_ctl command Start and Stop Postgres database in Linux






[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$ pg_ctl -D /pgdatabase/data/ -l /pglog/db_logs/start.log status

pg_ctl: no server running

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$ pg_ctl -D /pgdatabase/data/ -l /pglog/db_logs/start.log start

pg_ctl: another server might be running; trying to start server anyway

waiting for server to start.... done

server started

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$


[postgres@pgsql ~]$

[postgres@pgsql ~]$ pg_ctl -D /pgdatabase/data/ -l /pglog/db_logs/start.log status

pg_ctl: server is running (PID: 4119)

/opt/PostgreSQL_10/bin/postgres "-D" "/pgdatabase/data"

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$ ps -ef | grep -i pg

avahi      770     1  0 15:28 ?        00:00:00 avahi-daemon: running [pgsql.local]

postgres  4119     1  0 16:45 ?        00:00:00 /opt/PostgreSQL_10/bin/postgres -D /pgdatabase/data

postgres  4129  3900  0 16:46 pts/1    00:00:00 grep --color=auto -i pg

[postgres@pgsql ~]$ ps -ef | grep -i pgsql

avahi      770     1  0 15:28 ?        00:00:00 avahi-daemon: running [pgsql.local]

postgres  4139  3900  0 16:46 pts/1    00:00:00 grep --color=auto -i pgsql

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$ psql

psql (12.6)

Type "help" for help.


postgres=# 

postgres'#

postgres'#

postgres'#




[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$ pg_ctl -D /pgdatabase/data/ -l /pglog/db_logs/start.log stop

waiting for server to shut down.... done

server stopped

[postgres@pgsql ~]$

[postgres@pgsql ~]$


[postgres@pgsql ~]$

[postgres@pgsql ~]$ pg_ctl -D /pgdatabase/data/ -l /pglog/db_logs/start.log stop -m fast

waiting for server to shut down.... done

server stopped

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$

[postgres@pgsql ~]$ pg_ctl -D /pgdatabase/data/ -l /pglog/db_logs/start.log status

pg_ctl: no server running

[postgres@pgsql ~]$

[postgres@pgsql ~]$



No comments:

Post a Comment