postgres服务

2019-10-10 14:20   | Post by:   | in 行业知识

cd postgresql-11.1
./configure --prefix=/data/postgresql
make make install

# useradd postgres
# groupadd postgres
mkdir /data/postgresql/data
chown postgres.postgres /data/postgresql/data
su - postgres

#数据库初始化


/data/postgresql/bin/initdb -D /data/postgresql/data
#配置允许ip访问
vim /data/postgresql/data/pg_hba.conf


# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.137.3/24 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
host all all * md5

 #修改监听地址和连接端口

  vim /data/postgresql/data/postgresql.conf 

listen_addresses = '*'
port = 5432 

#启动

/data/postgresql/bin/pg_ctl -D /data/postgresql/data -l /data/postgresql/data/logfile start

#重新加载配置
/data/postgresql/bin/pg_ctl -D /data/postgresql/data reload



 

最新新闻