当前位置:Gxlcms > 数据库问题 > CentOS7 PostgreSQL 主从配置

CentOS7 PostgreSQL 主从配置

时间:2021-07-01 10:21:17 帮助过:3人阅读

安装
使用yum安装 (找源 http://yum.postgresql.org/)

yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
yum install postgresql95-server postgresql95-contrib


设置开机启动 (centos 服务安装位置 cd /usr/lib/systemd/system/*.service)
systemctl enable postgresql-9.5.service


启动服务
systemctl start postgresql-9.5.service
systemctl status resql-9.5.service


初始化数据库
/usr/pgsql-9.5/bin/postgresql95-setup initdb


开启远程访问
/var/lib/pgsql/9.5/data/postgresql.conf

listen_addresses =‘*‘
/var/lib/pgsql/9.5/data/pg_hba.conf

# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.117.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust


修改用户密码

su postgres
psql -U postgres
ALTER USER postgres WITH PASSWORD ‘postgres‘
\q

CentOS7 PostgreSQL 主从配置

标签:

人气教程排行