- 250914 문서 상태를 해결됨으로 변경 - 미해결 항목 매트릭스에서 Stats 스키마 정합 제거 - 해결 내역: robeing_container_id 컬럼명 수정
3.6 KiB
3.6 KiB
robeing-monitor DB 스키마 불일치
작성일: 2025-09-14
작성자: admin
환경: 51124 서버, robeing-monitor, PostgreSQL
서비스 정보
- 서버: 51124 (192.168.219.52)
- 포트: 9024
- 컨테이너: robeing_monitor (38시간 가동 중, healthy)
- DB 연결: postgresql://robeings:robeings@192.168.219.45:5432/main_db
문제 증상
Gateway에서 stats API 호출 시 매분마다 500 에러 발생
에러 로그
sqlalchemy.exc.ProgrammingError: column robeing.robeing_id does not exist
LINE 1: SELECT robeing.id AS robeing_id_1, robeing.robeing_id AS rob...
원인
robeing-monitor가 잘못된 테이블/컬럼 조회
- 코드 예상:
robeing_stats테이블의robeing_id컬럼 - 실제 DB:
robeing테이블의robeing_container_id컬럼
현재 영향
/api/stats/{robeing_id}엔드포인트 실패 (500 에러)- Gateway 프록시:
http://192.168.219.52:9024/api/stats/rb8001호출 실패
Gateway에서 robeing-monitor 호출 경로
# /home/admin/robeing-gateway/app/main.py
@app.get("/api/stats/{robeing_id}") # 라인 296-297
target_url = f"http://192.168.219.52:9024/api/stats/{robeing_id}"
@app.api_route("/api/preferences/{path:path}") # 라인 364-391
monitor_url = "http://192.168.219.52:9024"
@app.api_route("/api/items/{path:path}") # 라인 150-167
monitor_url = os.getenv("MONITOR_URL", "http://192.168.219.52:9024")
robeing-monitor 제공 API
GET /api/stats/{robeing_id}- 로빙 스탯 조회 (500 에러)PUT /api/stats/{robeing_id}- 스탯 업데이트GET /api/preferences/{user_id}- 사용자 설정PUT /api/preferences/{user_id}- 설정 업데이트GET /api/items/gmail- Gmail 아이템 조회GET /healthz- 헬스체크 (정상)
상태
✅ 해결됨 - 2025-09-15
해결 내역
- RobeingStats 테이블: robeing_id → robeing_container_id 수정
- ConversationLog 테이블: robeing_id → robeing_container_id 수정
- SQLAlchemy 쿼리: 모든 참조 수정
- API 테스트: 500 에러 없음 확인 (최근 1시간)
2025-09-15 업데이트
DB 스키마 확인 (51123 서버)
-- robeing 테이블 실제 구조
id | uuid
product_id | uuid
team_id | uuid
name | varchar(32)
level | integer
experience | integer
memory | integer
compute | integer
react | integer
empathy | integer
leadership | integer
updated_at | timestamp
created_at | timestamp
robeing_container_id | varchar(64)
robeing_container_url | varchar(128)
확인된 사실
- robeing_id 컬럼 없음 확인
- robeing-monitor는 51124 서버에서 실행 중
- 51123 서버 DB에는 id(UUID) 컬럼만 존재
문제 원인 분석
SQLAlchemy 쿼리 분석:
SELECT robeing.id AS robeing_id_1, robeing.robeing_id AS rob...
- robeing.id를 robeing_id_1로 별칭 처리
- 존재하지 않는 robeing.robeing_id 컬럼도 조회 시도
- 원인: robeing-monitor의 SQLAlchemy 모델에 id와 robeing_id 둘 다 정의됨
해결 방안
robeing-monitor 수정 필요 파일:
/home/admin/ivada_project/robeing-monitor/app/state/database.py/home/admin/ivada_project/robeing-monitor/app/state/state_service.py
수정 내용:
- 테이블명:
robeing_stats→robeing - 컬럼명:
robeing_id→robeing_container_id - SQLAlchemy 모델 정의 수정
테스트:
# 51124 서버에서
curl http://192.168.219.52:9024/api/stats/rb8001