postgresql安装及发布,请参考上一篇博文:
下载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发起测试