centos7安装及配置postgrest及postgresql

postgresql安装及发布,请参考上一篇博文:

centos7安装postgresql10_2022软件专业-应届生的博客-优快云博客PostgreSQL: Linux downloads (Red Hat family)https://www.postgresql.org/download/linux/redhat/修改默认密码 配置远程访问1.修改postgresql.conf文件输入找到listen_addresses ,将该条解释,并且修改为 * 即可 (输入i进入编辑)编辑完成后,按Esc键,输入:wq并回车。 2. 修改pg_hba.conf文件回车,https://blog.youkuaiyun.com/fangjial/article/details/125129667?spm=1001.2014.3001.5501

下载postgrest

链接:https://pan.baidu.com/s/11regAmVJ1OdQHnHrazmEzg?pwd=r0s9 
提取码:r0s9

解压

xz -d postgrest-v9.0.0.20220531-linux-static-x64.tar.xz
tar -xvf  postgrest-v9.0.0.20220531-linux-static-x64.tar

配置postgresql的pg_hba.conf

vi /var/lib/pgsql/10/data/pg_hba.conf

在pg_hba.conf最后一行添加以下配置: 

host all all 127.0.0.1/0 md5

 

重新启动postgresql

systemctl restart postgresql-10.service

创建postgrest.conf文件

cat > postgrest.conf << EOF
db-uri = "postgres://postgres:postgres@192.168.0.10:5432/eth" 
db-schema = "public" 
db-anon-role = "postgres"  
server-host = "0.0.0.0" 
server-port = 4000
EOF

修改postgrest.conf文件

ip地址一定要填外网地址,不能填localhost或者127.0.0.1

vi postgrest.conf

后台运行postgrest

sudo nohup ./postgrest postgrest.conf>./postgrest.log &

开启端口,若为腾讯云服务器,直接编辑防火墙即可

 新建一张users表

 

使用postman发起测试

 

至此,安装完毕 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值