티스토리 뷰

정리

Arch Postgresql 업그레이드

가은서현 2020. 1. 6. 11:35

노트북에 설치한 WSL Arch의 postgresql이 자동 업그레이드 되면서 11에서 12로 메이저 업그레이드가 되었음. 희안한것은 데이터 업그레이드를 자동으로 안해주고 에러를 발생함. Postgresql은 서비스 서버에서는 자동 업그레이드하면 매우 위험한 것으로 판단됨

현재의 Postgresql 버전 확인

# cat /var/lib/postgres/data/PG_VERSION

Arch에서 자동 업그레이드를 막는 방법

/etc/pacman.conf
...
IgnorePkg = postgresql postgresql-libs
...

Arch pg_upgrade를 통한 업그레이드 방법

1. Postgresql 서비스 종료

# systemctl stop postgresql.service
# systemctl status postgresql.service

2. Postgresql 업그레이드

# pacman -S postgresql postgresql-libs postgresql-old-upgrade

3. 업그레이드 준비

# mv /var/lib/postgres/data /var/lib/postgres/olddata
# mkdir /var/lib/postgres/data /var/lib/postgres/tmp
# chown postgres:postgres /var/lib/postgres/data /var/lib/postgres/tmp
[postgres]$ cd /var/lib/postgres/tmp
[postgres]$ initdb --locale=ko_KR.UTF-8 -E UTF8 -D /var/lib/postgres/data

4. 업그레이드 

[postgres]$ pg_upgrade -b /opt/pgsql-PG_VERSION/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data

업그레이드 과정에서 에러가 많이 발생한다. 내 경우는 로케일이 일치하지 않아서 발생하였고 업그레이드 이후 실행할 때 설치와 똑같은 권한 문제가 발생하였음. 

# mkdir /run/postgresql
# chown postgres.postgres /run/postgresql

 

참고

https://wiki.archlinux.org/index.php/PostgreSQL#Upgrading_PostgreSQL

 

PostgreSQL - ArchWiki

PostgreSQL is an open source, community driven, standard compliant object-relational database system. Installation Install the postgresql package. It will also create a system user called postgres. Warning: See #Upgrading PostgreSQL for necessary steps bef

wiki.archlinux.org

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
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 29 30 31
글 보관함