상황 : EOL 버전을 굳이 설치하여 쓰다가 json-b 를 사용하기 위하여 업그레이드 해야함.
버전 :
cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
################################################
pg_config --version
PostgreSQL 9.2.24
JSON-B가 뭐야? :
JSON-B is a standard binding layer for converting Java objects to/from JSON messages. It defines a default mapping algorithm for converting existing Java classes to JSON, while enabling developers to customize the mapping process through the use of Java annotations.
JSON-B는 Java 객체를 JSON 메시지로 또는 JSON 메시지에서 변환하기위한 표준 바인딩 레이어입니다. 기존 Java 클래스를 JSON으로 변환하기위한 기본 맵핑 알고리즘을 정의하는 동시에 개발자는 Java 어노테이션을 사용하여 맵핑 프로세스를 사용자 정의 할 수 있습니다.
현재 스프링부트로 Postgres 용 API를 개발하려하니 이러한 지원을 받기 위해 버전업을 해야겠네요.
작업 순서 :
1 일단 멈추공 ~ postgres 9.2 stop
systemctl stop postgresql.service
2 근데 pg_hba.conf 확인하여 비슷한 설정으로 다시 올리기 위해 복사해놓기.
어딨는지 모른다면. locate pg_hba.conf
3 옛날꺼 지운다. yum remove postgresql
4 yum 으로 설치 https://www.postgresql.org/download/linux/redhat/
(이 과정에서 제대로 설치가 되지 않았는지, 한번 지우고 다시 설치함.)
5 데이터를 부어줄 DB와 계정 생성은 아래와 같이 해준다.
sudo -u postgres psql
postgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;
ALTER USER myuser WITH SUPERUSER; (https://www.postgresql.org/docs/current/sql-alteruser.html)
ALTER DATABASE target_database OWNER TO new_onwer; (https://www.postgresqltutorial.com/postgresql-alter-database/)
참고 https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e
6 pg_hba.conf 를 기존 설정에서 복사해뒀던 것으로 덮어쓴다.
7 필요에 따라 postgres.conf (디폴트 경로는 /var/lib/pgsql/12/data/postgresql.conf) 에서 listen_address 를 수정해준다.
8 데이터를 DB에 적재합니다. sudo psql -u postgres --dbname 디비이름 -f 준비한파일.sql
9 postgis 도 설치하라는 팀장님의 팁이 있었음.
yum 으로 설치. postgres 디비버전을 확인하고 stable 버전 확인하여 설치
yum install postgis내가원하는버전
10 systemctl restart postgresql 탭탭
11 sudo psql -U postgres -d atlasdb
atlasdb=# CREATE EXTENSION postgix;
CREATE EXTENSION
(하단 참고)
postgis extension을 추가하여 간단한 지리 연산을 함수를 통해 할 수 있게 되었다
'내가 당면한 문제와 해결방안' 카테고리의 다른 글
git (0) | 2020.01.28 |
---|---|
term 정리 (0) | 2020.01.22 |
postgis spatial query (0) | 2020.01.21 |
jpa db config 수정 @SpringBootApplication (0) | 2020.01.10 |
docker pgadmin 이미지 사용시 server connection 심어주기 (0) | 2020.01.06 |