Linux下postgres9.4 版本的单机版安装小笔记

1.添加RPM
yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-redhat94-9.4-3.noarch.rpm
2.安装
sudo yum install postgresql94
sudo yum install postgresql94-server
3.初始化数据库
rpm -qa|grep postgresql
rpm -qal|grep postgresql
postgresql94-setup initdb
4.设置开机自启动
/usr/lib/systemd/system/
systemctl enable postgresql-9.4.service
5.启动服务
systemctl start postgresql-9.4.service
psql --version

6.登录操作
/var/lib/pgsql/9.4/data

cat postgresql.conf | grep -n listen_addresses
vim postgresql.conf- >listen_adreess
systemctl restrat postgresql-9.4.service

su - postgres
$1$jZUV5ccl$FLIBMZnCZzBKWDPxDz5y.0
psql -U postgres
passwd postgres(可以不操作)

select * from pg_roles;
select * from pg_user;

 

yum install https://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/repmgr94-4.1.1-1.rhel7.1.x86_64.rpm
yum install repmgr*

cd /usr/pgsql-9.4/share/

pg 安装小笔记:
ps -ef|grep postgres--找到配置文件\data
vim pg_hba.conf--local all all peer-->trust
systemctl restart postgresql-9.4.service
#su - postgres
psql -d postgres -U postgres -p 1523
#create a new superuser
create user pgdba superuser password 'pgdba';
#change user postgres passwd
alter role postgres password 'postgres';
#Create dispatcher user and grant dispatcher_db permissions to it
CREATE user dispatcher with password 'dispatcher';
#name: Create dispatcher database
CREATE DATABASE dispatcher owner dispatcher;
#Alter configure file
vim pg_hba.conf-->host {{ item.name }} {{ item.user }} 0.0.0.0/0 md5"
vim pg_hba.conf-->host dispatcher dispatcher 0.0.0.0/0 md5"
#Add db new_superuser client control policy
vim pg_hba.conf-->host all {{ new_superuser }} 0.0.0.0/0 md5
vim pg_hba.conf-->host all pgdba 0.0.0.0/0 md5'
name: Add db old_superuser client control policy
vim pg_hba.conf-->host all postgres 0.0.0.0/0 md5'
Change ansible config replace
vim pg_hba.conf-->trust -->md5
systemctl restart postgresql-9.4.service

/var/lib/pgsql/9.4/data
/usr/pgsql-9.4/bin
psql -d postgres -U postgres -p 1523
select * from pg_roles;
select * from pg_user;

转载于:https://www.cnblogs.com/ppp1314520818/p/10398543.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值