Some configurations after PostgreSQL installation is complete

Source: Internet
Author: User

Tags: sage command statement blank STP database service tar target technology share


设置数据目录,一般使用环境变量 PGDATA 指向数据目录的根目录。
目录的初始化是使用 initdb 来完成的,-D 后面加上自定义目录的路径
Initdb-d/tmp/testpostgres2/data

完成后在设置的目录下就会生成一些配置文件。

配置日志:
PostgreSQL有3种日志,分别是pg_log(数据库运行日志)、pg_xlog(WAL 日志,即重做日志)、pg_clog(事务提交日志,记录的是事务的元数据)

pg_log默认是关闭的,需要设置参数启用此日志。



Log_statement = ' All '
Logging_collector=onlog_directory='Pg_log'Log_filename='Postgresql-%y-%m-%d_%h%m%s.log'Log_rotation_age=1dlog_rotation_size=100mblog_min_messages=info# record execution slow sqllog_min_duration_statement= -log_checkpoints=onlog_connections=onlog_disconnections=onlog_duration=Onlog_line_prefix='%m'# Monitor long-time lock log_lock_waits in database=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
具体参数的详细解释查看官方文档:
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.

Tags Index: