obsidian: 정본 문서에서 히스토리/인시던트 분리 완료
15개 정본 문서에서 날짜별 변경이력, 인시던트 기록, 폐기된 구현 상세를 history/ 디렉토리로 분리. 정본은 현재 상태만 기술하는 백서 형태로 정리. 각 정본에 history 위키링크 추가. 분리된 history 파일 12건: - apisix git push 500, k3s postgresql migration, apisix→traefik 전환 - netbis DDoS 공격, gitea 이전/분리, usb 2.5g hang + NFS hard mount - supabase→patroni, apisix etcd 통합/분리, anomaly-detect 재설계 - patroni failover incident, zlambda nixos migration, ops-agents setup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ tags: [infra, postgresql, patroni, etcd, ha]
|
||||
|
||||
PostgreSQL 3노드 HA 클러스터. Patroni가 자동 failover를 관리하고, etcd를 DCS(Distributed Consensus Store)로 사용.
|
||||
|
||||
K3s의 kine 데이터스토어로 사용 중. Supabase Free tier에서 로컬로 이전 완료 (2026-04-05).
|
||||
K3s의 kine 데이터스토어로 사용 중.
|
||||
|
||||
## PostgreSQL 클러스터
|
||||
|
||||
@@ -61,7 +61,6 @@ incus exec postgres-1 -- /opt/patroni/bin/patronictl -c /etc/patroni.yml reinit
|
||||
- jp1: openrc 서비스 (`/etc/init.d/etcd`), `command_background=true`
|
||||
- mbp: docker container `etcd` (named volume `etcd-data`), client/peer 모두 호스트 `127.0.0.1`만 노출 → `socat`이 Tailscale IP `100.115.154.78`의 `2379`/`2380`으로 forward (`~/Library/LaunchAgents/com.kaffa.etcd-socat{,-peer}.plist`)
|
||||
- Patroni etcd namespace: `/patroni`
|
||||
- 2026-04-08: etcd-hp2(10.100.2.214)를 etcd-mbp로 교체. hp2 incus 컨테이너 삭제됨.
|
||||
|
||||
### etcd 확인 명령어
|
||||
|
||||
@@ -79,7 +78,7 @@ incus exec postgres-1 -- etcdctl --endpoints=http://192.168.9.100:2379,http://10
|
||||
|--------|------|
|
||||
| `/patroni` | Patroni DCS (Leader election, 설정) |
|
||||
| `/apisix/osaka` | APISIX 오사카 라우팅 설정 |
|
||||
| `/apisix/tokyo` | APISIX sandbox-tokyo 라우팅 설정 (2026-04-08 NixOS 전환 후 미사용, 데이터는 보존) |
|
||||
| `/apisix/tokyo` | APISIX sandbox-tokyo 라우팅 설정 (미사용, 데이터 보존) |
|
||||
| `/apisix/seoul` | APISIX 서울 K3s 라우팅 설정 |
|
||||
|
||||
## K3s kine 연결
|
||||
@@ -122,7 +121,7 @@ NocoDB, n8n 등 K3s 내부 애플리케이션은 **pgcat**(연결 풀링)을 통
|
||||
nocodb/n8n → pgcat (db.svc.cluster.local:6432) → HAProxy 192.168.9.1:5432 → Patroni Leader
|
||||
```
|
||||
|
||||
`db/pgcat-config` ConfigMap의 각 풀의 `shards.0.servers`는 **HAProxy 단일 백엔드만 가리켜야 함** (2026-04-08 변경):
|
||||
`db/pgcat-config` ConfigMap의 각 풀의 `shards.0.servers`는 **HAProxy 단일 백엔드만 가리켜야 함**:
|
||||
|
||||
```toml
|
||||
[pools.nocodb.shards.0]
|
||||
@@ -138,9 +137,7 @@ servers = [["192.168.9.1", 5432, "primary"]]
|
||||
|
||||
pgcat는 풀링 전용으로만 쓰고, leader 탐지는 OpenWrt HAProxy에 위임. `query_parser_enabled = false` 설정 (read/write splitting 비활성).
|
||||
|
||||
### 2026-04-08 사고 기록
|
||||
|
||||
Patroni failover 발생 → pgcat가 옛 primary IP(`10.100.2.5`)를 hardcoded 참조 → nocodb 마이그레이션 시 `cannot execute UPDATE in a read-only transaction` 에러로 4시간 가량 CrashLoopBackOff. n8n은 마이그레이션이 없어서 표면화되지는 않았으나 동일한 잠재 문제 존재. 위의 단일 백엔드 구조로 변경하여 항구 해결.
|
||||
Patroni failover 인시던트 이력: [[../history/2026-04-08-patroni-failover-incident|2026-04-08 pgcat/nocodb/outline read-only 사고]]
|
||||
|
||||
## APISIX etcd 사용 현황
|
||||
|
||||
@@ -150,21 +147,7 @@ Patroni failover 발생 → pgcat가 옛 primary IP(`10.100.2.5`)를 hardcoded
|
||||
| sandbox-tokyo | (미가동) | `/apisix/tokyo` | 2026-04-08 NixOS 전환으로 APISIX 자체 폐기, etcd 데이터만 보존 |
|
||||
| 서울 K3s | **K3s 내부 apisix-etcd StatefulSet** (apisix.apisix.svc:2379) | `/apisix` | 2026-04-08 외부 통합에서 K3s 내부로 복귀 |
|
||||
|
||||
### 2026-04-06 → 2026-04-08 변경 이력
|
||||
|
||||
1. **2026-04-06**: 서울 K3s APISIX의 K3s 내부 apisix-etcd StatefulSet을 삭제하고 외부 통합 etcd로 이전 (`/apisix/seoul` prefix). 통합 운영 + 컴포넌트 수 절감 의도.
|
||||
2. **2026-04-08**: 다시 K3s 내부로 복귀. Patroni DCS와 같은 etcd 클러스터를 공유할 때 장애 전파 위험(Patroni 이슈 → APISIX 라우팅 영향)이 비직관적이라 격리. 외부 통합 etcd의 `/apisix/seoul/*` 20개 키 삭제 완료. **현재 외부 통합 etcd는 Patroni DCS + osaka APISIX 전용.**
|
||||
|
||||
### Stale prefix 삭제 명령 (참고)
|
||||
|
||||
```bash
|
||||
# HTTP API v3 사용 (heimdall에서 직접 호출)
|
||||
KEY=$(echo -n "/apisix/seoul/" | base64)
|
||||
RANGE_END=$(echo -n "/apisix/seoul0" | base64)
|
||||
curl -s -X POST "http://192.168.9.100:2379/v3/kv/deleterange" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"key\":\"$KEY\",\"range_end\":\"$RANGE_END\"}"
|
||||
```
|
||||
APISIX etcd 통합/분리 이력: [[../history/2026-04-06-apisix-etcd-consolidation|history]]. 현재 외부 통합 etcd는 **Patroni DCS + osaka APISIX 전용**.
|
||||
|
||||
## 관련 문서
|
||||
|
||||
|
||||
Reference in New Issue
Block a user