Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 테이블목록
- ST_InvDistWeight4ma
- posgresql
- 데이터비교
- posgtresql
- table비교
- shp내려받기
- psql
- 테이블리턴
- 하위디렉토리
- shape내려받기
- postgis
- PostgreSQL
- postgrest
- table
- 네이버클라우드
- Python
- rc.local
- tablewidget
- SQL
- 순댓국밥
- Openlayers
- idw
- 공주페이
- pygqis
- HP스펙터x360
- HP스펙터
- qgis
- 와콤뱀부슬레이트
- 테이블 중복조회
Archives
- Today
- Total
오픈소스의 일상
#10. PostgRest 설치 및 확인 본문
1. 설치
참고 : https://postgrest.org/en/stable/tutorials/tut0.html#step-3-install-postgrest
Tutorial 0 - Get it Running — PostgREST 9.0.0 documentation
Welcome to PostgREST! In this pre-tutorial we’re going to get things running so you can create your first simple API. PostgREST is a standalone web server which turns a PostgreSQL database into a RESTful API. It serves an API that is customized based on
postgrest.org
참고 : https://github.com/PostgREST/postgrest/releases/tag/v9.0.0
Release v9.0.0 · PostgREST/postgrest
Added #1783, Include partitioned tables into the schema cache. Allows embedding, UPSERT, INSERT with Location response, OPTIONS request and OpenAPI support for partitioned tables - @laurenceisla #...
github.com
[root@flas /]# cd /home
[root@flas home]# wget https://github.com/PostgREST/postgrest/releases/download/v9.0.0/postgrest-v9.0.0-linux-static-x64.tar.xz
...
HTTP request sent, awaiting response... 200 OK
Length: 3251052 (3.1M) [application/octet-stream]
Saving to: ‘postgrest-v9.0.0-linux-static-x64.tar.xz’
100%[==================================================================>] 3,251,052 --.-K/s in 0.02s
2022-01-06 09:26:44 (140 MB/s) - ‘postgrest-v9.0.0-linux-static-x64.tar.xz’ saved [3251052/3251052]
--압축풀기
[root@flas home]# tar xJf postgrest-v9.0.0-linux-static-x64.tar.xz
--실행파일 생성확인
[root@flas home]# ll
total 19100
-rwxr-xr-x 1 1001 121 16305296 Nov 27 05:04 postgrest
--실행파일 실행
--정상적인 동작 확인
[root@flas home]# ./postgrest
Usage: postgrest [-e|--example] [--dump-config | --dump-schema] FILENAME
PostgREST 9.0.0 / create a REST API to an existing Postgres database
Available options:
-h,--help Show this help text
-e,--example Show an example configuration file
--dump-config Dump loaded configuration and exit
--dump-schema Dump loaded schema as JSON and exit (for debugging,
output structure is unstable)
FILENAME Path to configuration file (optional with PGRST_
environment variables)
To run PostgREST, please pass the FILENAME argument or set PGRST_ environment
variables.
--Path폴더로 이동
[root@flas home]# mv /home/postgrest /usr/local/bin
2. 스키마, 계정 및 권한 설정
create schema api;
create table api.todos (
id serial primary key,
done boolean not null default false,
task text not null,
due timestamptz
);
insert into api.todos (task) values
('finish tutorial 0'), ('pat self on back');
create role web_anon nologin;
grant usage on schema api to web_anon;
grant select on api.todos to web_anon;
create role authenticator noinherit login password 'mysecretpassword';
grant web_anon to authenticator;
3. 접속정보 및 자동실행 설정
-- turorial.conf 생성
db-uri = "postgres://authenticator:mysecretpassword@localhost:5432/postgres"
db-schema = "api"
db-anon-role = "web_anon"
-- 서버 부팅시 자동실행
[root@flas bin]# cd /etc/rc.d
[root@flas rc.d]# vi rc.local
...
cd /usr/local/bin;
./postgrest tutorial.conf;
--재부팅
[root@flas rc.d]# reboot
4. 결과확인
Token 기능은 기본셋팅이 완료되면 작성예정
728x90
'오픈소스 > PostgreSQL' 카테고리의 다른 글
PostgreSQL 테이블 목록 조회 (0) | 2022.02.15 |
---|---|
PostgreSQL Fucntion 리턴값을 테이블 구조로 받기 (0) | 2022.01.26 |
PostgreSQL 데이터 중복조회 (0) | 2018.11.23 |
PostgreSQL 대량삽입(INSERT) (0) | 2018.11.22 |
PostgreSQL EXCEPT(차집합) - 테이블비교 (0) | 2018.11.21 |