postgressql Startup and Shutdown

POSTGRESSQL can start and stop the database service by the way, POSTGRESSQL command-line tools for starting and stopping.

1. There SERVICE the way

Start the database service command as follows *:

#service postgressql-10 start

Check the status of the database running the following command

#service postgressql-10 status

Stop database command shown in the following

2. Use PG_CTL manage

     pg_ctl POSTGRESQL is initialized data directory, start, stop, restart, reload database services, database services or to view the status of the tool, compared SERVICE or SYSTECTL management style, PG_CTL provides a wealth of controls that need to execute operating system commands PG_CTL SU user command to switch to POSTGRES user.

(1) Start the database

#/usr/local/pgsql/bin/pg_ctl -D /data/10/data start server started

(2) to view the running state database

#/usr/local/pgsql/bin/pg ctl - D /data/10/data status
(3) Stop the database
pg ctl stop [ D DATADIR] [ - m SHUTDOWN- MODE] [ - W] [ - t SECS] [ - s]
"-S" parameter message output on the opening and closing of the screen; "- SECS" timeout parameter, exceeds SECS
Timeout value is set to automatically withdraw them
Kind of database support stop mode smart fast immediate, the default mode is fast
After the smart mode waits for active transactions submitted to the end, and waits for client interrupts the connection is closed database
 After the fast mode rolls back the transaction for all activities, and to forcibly disconnect client database connection is closed
 immediate mode terminates all server processes, the next time the database is started it will first enter recovery
Complex state, is generally not recommended
When the write command, this value can be abbreviated as "-ms" "-mf" "- mi", such as using smart mode
Stop database command shown in the following
# /usr/local/pgsql/bin/ pg ctl - D /pgdata/10/data - ms stop
(More practical part of the first chapter switched POSTGRESSQL)
 

 

Guess you like

Origin www.cnblogs.com/flamechan1981/p/11576775.html