CentOS6.9使用PostgREST

1 下载postgrest的二进制release包

   地址:http://postgrest.org/en/v6.0/

    CentOS6.9使用PostgREST

CentOS6.9使用PostgREST

   在图中3处右键复制链接地址,在Linux中使用wget进行下载,或者直接下载再上传到Linux

 2 解压并使用

    因为是二进制文件,所以解压的文件就一个,并且可以直接使用,但是需要简单的配置

    将解压的文件单独放到一个新建的postgrest文件夹中,并在此文件夹中新建bin,conf,log这三个文件夹

    bin中存放解压的二进制文件,conf中新建一个配置文件default.conf,配置文件的内容如下:

     db-uri ="postgres://postgres:[email protected]:5432/bjwhy"
     db-schema = "public" # this schema gets added to the search_path of every request
     db-anon-role = "postgres"
     db-pool = 10
     db-pool-timeout = 10

     server-host = "!4"
     server-port = 8088

    之前在网上看过其他配置都是让新建postgrest用户,并赋予查询权限什么,本人弄了半天也没弄好

    最后无奈就直接使用posgres这个原生用户,数据库以及表和数据都已经建好了

   配置完成之后就可以启动postgrest了

        /usr/local/postgrest/bin/postgrest /usr/local/postgrest/conf/default.conf 

          CentOS6.9使用PostgREST

3 使用curl测试访问或者通过浏览器访问都可以

   curl -X GET "http://49.235.78.250:8088/sys_user?limit10"

CentOS6.9使用PostgREST

CentOS6.9使用PostgREST