docs(worklog): Apache AGE 설치 기록 및 PostgreSQL 18 업그레이드 완료 기록

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
happybell80 2026-03-22 22:59:03 +09:00
parent 1afe8fd4ce
commit 4cdf31a4da
2 changed files with 66 additions and 0 deletions

View File

@ -53,3 +53,4 @@
## 3. 관련 문서
- `0_VALUE/20_Governance/system-and-infrastructure-overview.md` § 4), § 6)
- `robeing/DOCS/journey/research/rag/260320_PostgreSQL_그래프확장_설계_리서치.md`
- [51123 PostgreSQL 18 업그레이드 및 호환 확장 전환 완료](./260321_51123_postgresql18_업그레이드_및_호환확장_전환완료.md)

View File

@ -0,0 +1,65 @@
---
tags: [infra, postgres, postgresql-18, age, pgvector, timescaledb, worklog, 51123]
---
# 51123 PostgreSQL 18 업그레이드 및 호환 확장 전환 완료
## 상위 원칙
- `0_VALUE/20_Governance/infrastructure-ssot-principle.md`
- `0_VALUE/20_Governance/project-artifacts-ssot.md`
- `0_VALUE/20_Governance/writing-principles.md`
## 관련 문서
- [51123 Apache AGE 설치 및 PG14 EOL 기술부채 기록](./260320_51123_apache_age_설치_및_pg14_eol_기술부채_기록.md)
- [non-RDB 계층 PostgreSQL 통일 1차 실행 완료](./260317_nonrdb_계층_postgresql_통일_1차_실행완료.md)
- [non-RDB 계층 PostgreSQL 통일 계획](../plans/260317_nonrdb_계층_postgresql_통일_계획.md)
## 완료 요약
- 51123 호스트 PostgreSQL을 `14.22`에서 `18.3`으로 전환했습니다.
- 운영 포트는 `18/main -> 5432`, 기존 `14/main -> 5434`로 재배치해 롤백 여지를 남겼습니다.
- `main_db`의 확장은 `age 1.5.0 -> 1.7.0`, `vector 0.7.0 -> 0.8.2`로 올라갔고, metrics DB 두 개의 `timescaledb``2.19.3 -> 2.25.2`로 전환했습니다.
## 적용 내용
- 백업
- `/home/admin/postgres-backups/20260321_115931_pg14_to_pg18/`
- `globals.sql`, DB별 custom dump, `postgresql14_config/` 백업 생성
- `/home/admin/postgres-backups/20260321_120132_cluster_full.sql` 전체 SQL 백업 추가 생성
- 패키지
- PGDG 저장소 추가 후 `postgresql-18`, `postgresql-client-18`, `postgresql-server-dev-18`, `postgresql-18-age`, `postgresql-18-pgvector` 설치
- Timescale 패키지 저장소에서 `timescaledb-2-postgresql-18`, `timescaledb-toolkit-postgresql-18` 설치
- 업그레이드 방식
- 1차로 `pg_upgradecluster 14 main`을 시도했으나 `reg*` 타입 컬럼 검사에서 실패
- 원인: `AGE``TimescaleDB`가 가진 시스템 OID 기반 메타데이터가 `pg_upgrade` 제약에 걸림
- 데이터 규모가 작아 `18/main(5433)` 신규 클러스터 생성 후 논리 복원 방식으로 전환
- 복원
- 일반 DB(`gitea`, `giteadb`, `main_db`, `main_db3`, `rb8001_db`, `postgres`)는 custom dump 복원
- `main_db`는 복원 과정에서 `age 1.7.0`, `vector 0.8.2`로 자연 승격 확인
- `robeing_metrics`, `robing_metrics`는 TimescaleDB 내부 카탈로그 차이로 custom restore가 깨져 수동 재구성
- `robeing_metrics.public.emotion_readings`, `robing_metrics.public.system_metrics``TimescaleDB 18` 기준 hypertable로 다시 만들고, 14 클러스터에서 CSV 논리 복사로 데이터 이관
- 설정
- 18 클러스터에 `listen_addresses='*'`, `max_connections=100`, `shared_buffers=7505MB`, `min_wal_size=512MB`, `max_wal_size=1GB`, `shared_preload_libraries='timescaledb'` 적용
- `pg_hba.conf`, `pg_ident.conf`는 14 설정을 기준으로 18에 반영
## 검증 결과
- 클러스터 상태
- `18/main` online on `5432`
- `14/main` online on `5434`
- 확장 버전
- `main_db`: `age:1.7.0`, `vector:0.8.2`
- `robeing_metrics`: `timescaledb:2.25.2`
- `robing_metrics`: `timescaledb:2.25.2`
- 핵심 데이터 건수 대조
- `main_db.team_document_chunk`: `3204 -> 3204`
- `main_db.memory_vectors`: `168 -> 168`
- `main_db.ag_catalog.ag_graph`: `1 -> 1`
- `robeing_metrics.emotion_readings`: `899 -> 899`
- `robing_metrics.system_metrics`: `209096 -> 209096`
- 앱/진입점
- `DATABASE_URL`, `METRICS_DATABASE_URL`로 접속 시 둘 다 `18.3` 응답 확인
- Docker 주요 컨테이너 health 유지 (`rb8001`, `skill-rag-file`, `skill-embedding`, `robeing-gateway`, `auth-server`)
- `http://127.0.0.1:8000/health` 정상, `http://127.0.0.1:9000/health` 정상, `http://127.0.0.1:8100/docs``openapi.json` 정상
## 운영 메모
- 즉시 롤백이 필요하면 기존 14 클러스터는 `5434`에서 그대로 살아 있어 포트만 되돌리면 됩니다.
- 이번 사건의 핵심은 `AGE + TimescaleDB`가 섞인 클러스터에서는 `pg_upgrade`보다 `논리 복원` 경로가 더 현실적이었다는 점입니다.
- 같은 패턴이 반복되면 별도 PostgreSQL 메이저 업그레이드 workflow 문서로 승격을 검토합니다.