Some configurations after PostgreSQL installation is complete

Source: Internet
Author: User
Tags postgresql

Set the data directory, generally use the environment variable PGDATA to point to the root directory of the data directory.
The initialization of the directory is done using initdb, followed by -D with the path to the custom directory.

Initdb -D /tmp/testpostgres2/data


After completion, some configuration files will be generated in the set directory.

Configuration log:
PostgreSQL has three kinds of logs, namely pg_log (database running log), pg_xlog (WAL log, redo log), pg_clog (transaction commit log, which records transaction metadata)

Pg_log is turned off by default, you need to set the parameters to enable this log.
Edit postgresql.conf

Log_statement = ‘all‘
Logging_collector = on
Log_directory = ‘pg_log‘
Log_filename = ‘postgresql-%Y-%m-%d_%H%M%S.log‘
Log_rotation_age = 1d
Log_rotation_size = 100MB
Log_min_messages = info
# Record execution slow SQL
Log_min_duration_statement = 60
Log_checkpoints = on
Log_connections = on
Log_disconnections = on
Log_duration = on
Log_line_prefix = ‘%m‘
# Monitor long locks in the database
Log_lock_waits = on
# Record DDL operations
Log_statement = ‘ddl‘


Restart PostgreSQL after saving to see the newly generated log under $pgdata/pg_log/


Pg_ctl stop-m fastpg_ctl start
or use the following command
Pg_ctl restart
The command to re-read the configuration file for the DB instance is as follows:
Pg_ctl Reload [-S] [-D DataDir]
Start the database service
pg_ctl-d PGDATA Start


Detailed explanation of the specific parameters View the official documentation:


http://www.postgres.cn/docs/9.4/runtime-config-logging.html
Some configurations after PostgreSQL installation is complete



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.