First, start-stop method
Two methods
1, directly run Postgres process start;
2. Start with the Pg_ctl command
Postgres-d/home/osdba/pgdata &
Ii. three modes of stopping a database
Smart shutdown: Intelligent shutdown mode. Do not accept new connections, and then close the database when all existing connections are complete.
Fast shutdown: Quick shutdown mode, does not allow new connections, sends sigterm signals to all active service processes, lets them exit immediately, and then waits for all child processes to end and close the database. If the database is in a backup state, terminate the backup immediately.
Immediate shutdown: Shutdown mode immediately, all processes exit immediately, and does not properly shut down the database system, the next time you start the database replay the Wal log for recovery. Use when in emergencies.
Sigterm: This signal smart shutdown shutdown mode
Sigint:fast Shutdown shutdown mode
Sigquit:immediate Shutdown shutdown mode
Pg_ctl stop- D datadir-m Smart pg_ctl stop- D datadir-m fastpg_ctl stop- d datadir-m Immediate
Second, Pg_ctl function
1. Initialize the Postgressql DB instance.
2. Start, stop, or restart
3. View service Status
4. Let the database instance read the configuration file again
Initialize the PostgreSQL db instance command:
Pg_ctl INIT[DB] [-S] [-D datadir] [-O options]
-S prints error and warning messages only
-D DataDir: Specify the Data directory for the DB instance
-O options: For parameters that are passed directly to the INITDB command, the Help for the INITDB command is visible.
-C increases the server's soft limit (ulimit-c) and attempts to allow the DB instance to generate an Coredump file during an exception for problem locating and fault analysis.
Pg_ctl Start- W- D /home/osdba/pgdata
Third, the command to start the Postgressql database is as follows:
Pg_ctl start [-W] [-t seconds] [-S] [-D datadir] [-l filename] [-O options] [-P path] [-c]
-W waits for the start to complete.
-T waits for the number of seconds to start to complete by default 60s
-S only prints error and warning messages and does not print informational information.
-D DataDir: Specifies the data directory for the DB instance.
-l APPEND the server log output to the filename file and create it if it does not exist.
-O options: Declaring options to be passed directly to Postgres
-P Path: Specifies the location of the Postgres executable file. The default execution file and pg_ctl the same directory.
Iv. Stop the PostgreSQL database command as follows:
Pg_ctl stop [-W] [-t seconds] [-S] [-D datadir] [-M s[mart] | F[ast] | I[mmediate]]
-W waits for the database to stop, and the command returns
-M Specify stop mode
V. The command to have the database instance reread the configuration file is as follows:
Pg_ctl Reload [-S] [-D DataDir]
Vi. commands to query the status of a DB instance:
PG_CTL Status [-D DataDir]
PostgreSQL Start-Stop and create