postgresql9.2.24安装

1、yum安装

 

yum install -y postgresql-server postgresql-contrib

 

2、初始化

 

postgresql-setup initdb

 

3、挂载数据盘

 

ln -s /data/pgsql /var/lib/pgsql

chown -R postgres:postgres pgsql

 

4、修改配置文件

pg_hba.conf

 

local   all             all                                     peer
host    all             all             0.0.0.0/0               md5
host    all             all             ::1/128                 ident

 

postgresql.conf

listen_addresses = "*"
max_connections = 200
shared_buffers = 3000MB
work_mem = 100MB
maintenance_work_mem = 1000MB
effective_cache_size = 6000MB
constraint_exclusion = partition
logging_collector = on
log_filename = "postgresql-%a.log"
log_truncate_on_rotation = on
log_rotation_age = 1d
log_rotation_size = 0
log_timezone = "PRC"
datestyle = "iso, mdy"
timezone = "PRC"
lc_messages = "en_US.UTF-8"
lc_monetary = "en_US.UTF-8"
lc_numeric = "en_US.UTF-8"
lc_time = "en_US.UTF-8"
default_text_search_config = "pg_catalog.english"


#新增
wal_level=hot_standby
archive_mode=on
archive_command = "cp %p /var/lib/postgresql/pg_bak/%f"
max_wal_senders=4


5、启动

systemctl start postgresql

systemctl enable postgresql

 

原文地址:https://www.cnblogs.com/52shaidan/p/17442359.html