PostgreSQL Start-Stop and create

Source: Internet
Author: User
Tags postgresql

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.