콘텐츠로 이동

프로덕션 배포 가이드

이 가이드는 프로덕션 환경에서 Continuum Router를 실행하기 위한 다양한 배포 전략, 설정 및 모범 사례를 다룹니다.

목차

배포 옵션

방법 적합한 경우 장점 단점
Docker 단일 인스턴스, 개발 쉬운 설정, 이식성 단일 장애 지점
Kubernetes 대규모, 자동 스케일링 HA, 자동 스케일링, 오케스트레이션 복잡한 설정
Systemd 베어메탈, VM 직접 제어, 간단함 수동 스케일링
Docker Swarm 중규모 간단한 오케스트레이션 제한된 기능
Cloud PaaS 관리형 배포 낮은 유지보수 벤더 종속

Docker 배포

Continuum Router는 두 가지 Docker 이미지 옵션을 제공합니다:

이미지 베이스 크기 사용 사례
lablup/continuum-router:VERSION Debian Bookworm ~50MB 일반 사용, 높은 호환성
lablup/continuum-router:VERSION-alpine Alpine 3.20 ~10MB 최소 크기, Kubernetes

Docker Compose로 빠른 시작

가장 빠르게 시작하는 방법은 Docker Compose를 사용하는 것입니다:

# 설정 파일 생성
curl -fsSL https://raw.githubusercontent.com/lablup/continuum-router/main/config.yaml.example > config.yaml

# config.yaml을 편집하여 백엔드와 API 키 추가
# 그 다음 라우터 시작
docker compose up -d

# 로그 보기
docker compose logs -f continuum-router

Docker로 실행하기

# 기본 설정으로 실행
docker run -d \
  --name continuum-router \
  -p 8080:8080 \
  -v $(pwd)/config.yaml:/etc/continuum-router/config.yaml:ro \
  lablup/continuum-router:latest

# 더 작은 이미지를 위한 Alpine 변형 실행
docker run -d \
  --name continuum-router \
  -p 8080:8080 \
  -v $(pwd)/config.yaml:/etc/continuum-router/config.yaml:ro \
  lablup/continuum-router:latest-alpine

# 사용자 정의 로그 레벨로 실행
docker run -d \
  --name continuum-router \
  -p 8080:8080 \
  -e RUST_LOG=debug \
  -v $(pwd)/config.yaml:/etc/continuum-router/config.yaml:ro \
  lablup/continuum-router:latest

커스텀 이미지 빌드

저장소에는 두 개의 Dockerfile이 제공됩니다:

  • Dockerfile - 미리 빌드된 바이너리를 사용하는 Debian 기반 이미지
  • Dockerfile.alpine - musl 바이너리를 사용하는 Alpine 기반 이미지

미리 빌드된 바이너리에서 빌드 (권장)

이 방법은 GitHub Releases에서 미리 빌드된 바이너리를 다운로드합니다:

# Debian 기반 이미지 빌드
docker build --build-arg VERSION=0.21.0 -t continuum-router:0.21.0 .

# Alpine 기반 이미지 빌드
docker build -f Dockerfile.alpine --build-arg VERSION=0.21.0 -t continuum-router:0.21.0-alpine .

# buildx를 사용한 멀티플랫폼 빌드
docker buildx build --platform linux/amd64,linux/arm64 \
  --build-arg VERSION=0.21.0 \
  -t lablup/continuum-router:0.21.0 \
  --push .

소스에서 빌드

개발이나 커스터마이징을 위해 멀티스테이지 빌드를 사용합니다:

# 최적의 크기를 위한 멀티스테이지 빌드
FROM rust:1.75-slim as builder

# 빌드 의존성 설치
RUN apt-get update && apt-get install -y \
    pkg-config \
    libssl-dev \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# 의존성 캐시
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release && rm -rf src

# 애플리케이션 빌드
COPY . .
RUN touch src/main.rs && cargo build --release

# 런타임 이미지
FROM debian:bookworm-slim

# 런타임 의존성 설치
RUN apt-get update && apt-get install -y \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# 비루트 사용자 생성
RUN useradd -r -s /bin/false continuum

# 바이너리 복사
COPY --from=builder /app/target/release/continuum-router /usr/local/bin/
RUN chmod +x /usr/local/bin/continuum-router

# 디렉토리 설정
RUN mkdir -p /etc/continuum-router /var/log/continuum-router
RUN chown -R continuum:continuum /etc/continuum-router /var/log/continuum-router

USER continuum

EXPOSE 8080

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD ["/usr/local/bin/continuum-router", "--health-check"]

ENTRYPOINT ["continuum-router"]
CMD ["--config", "/etc/continuum-router/config.yaml"]

헬스 체크

Continuum Router는 컨테이너 오케스트레이션을 위한 내장 헬스 체크 명령을 포함합니다:

# 컨테이너 내부에서 헬스 체크
continuum-router --health-check

# 사용자 정의 URL로 헬스 체크
continuum-router --health-check --health-check-url http://localhost:8080/health

헬스 체크 특징:

  • 서버가 정상이면 종료 코드 0 반환
  • 서버에 연결할 수 없거나 비정상이면 종료 코드 1 반환
  • 기본 5초 타임아웃

Docker Compose 프로덕션 설정

services:
  continuum-router:
    image: lablup/continuum-router:latest
    container_name: continuum-router
    restart: always
    ports:
      - "8080:8080"
    volumes:
      - ./config.yaml:/etc/continuum-router/config.yaml:ro
      - ./logs:/var/log/continuum-router
    environment:
      - RUST_LOG=info
      - RUST_BACKTRACE=1
    networks:
      - llm-network
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 512M
        reservations:
          cpus: '1'
          memory: 256M
    healthcheck:
      test: ["CMD", "continuum-router", "--health-check"]
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 5s
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

  # 예제 백엔드 서비스
  ollama:
    image: ollama/ollama:latest
    volumes:
      - ollama_data:/root/.ollama
    networks:
      - llm-network
    deploy:
      resources:
        limits:
          cpus: '4'
          memory: 8G

networks:
  llm-network:
    driver: bridge

volumes:
  ollama_data:

Docker Swarm 배포

services:
  continuum-router:
    image: lablup/continuum-router:latest
    deploy:
      replicas: 3
      update_config:
        parallelism: 1
        delay: 10s
        failure_action: rollback
      restart_policy:
        condition: any
        delay: 5s
        max_attempts: 3
      placement:
        constraints:
          - node.role == worker
    ports:
      - "8080:8080"
    configs:
      - source: router_config
        target: /etc/continuum-router/config.yaml
    networks:
      - llm-overlay
    healthcheck:
      test: ["CMD", "continuum-router", "--health-check"]
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 5s

configs:
  router_config:
    external: true

networks:
  llm-overlay:
    driver: overlay
    attachable: true

Kubernetes 배포

완전한 Kubernetes 매니페스트

# namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: continuum-router

---
# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: continuum-router-config
  namespace: continuum-router
data:
  config.yaml: |
    server:
      bind_address: "0.0.0.0:8080"
      workers: 4
    backends:
      - url: http://ollama-service:11434
        name: ollama
        weight: 1
    health_checks:
      enabled: true
      interval: 30s
      timeout: 10s

---
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: continuum-router
  namespace: continuum-router
  labels:
    app: continuum-router
spec:
  replicas: 3
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  selector:
    matchLabels:
      app: continuum-router
  template:
    metadata:
      labels:
        app: continuum-router
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8080"
        prometheus.io/path: "/metrics"
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - continuum-router
              topologyKey: kubernetes.io/hostname
      containers:
      - name: continuum-router
        image: ghcr.io/lablup/continuum-router:latest
        imagePullPolicy: Always
        ports:
        - name: http
          containerPort: 8080
          protocol: TCP
        env:
        - name: RUST_LOG
          value: "info"
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        volumeMounts:
        - name: config
          mountPath: /etc/continuum-router
          readOnly: true
        resources:
          requests:
            memory: "256Mi"
            cpu: "200m"
          limits:
            memory: "512Mi"
            cpu: "1000m"
        livenessProbe:
          httpGet:
            path: /health
            port: http
          initialDelaySeconds: 30
          periodSeconds: 10
          timeoutSeconds: 5
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /health
            port: http
          initialDelaySeconds: 10
          periodSeconds: 5
          timeoutSeconds: 3
          failureThreshold: 3
        startupProbe:
          httpGet:
            path: /health
            port: http
          initialDelaySeconds: 0
          periodSeconds: 10
          timeoutSeconds: 3
          failureThreshold: 30
      volumes:
      - name: config
        configMap:
          name: continuum-router-config

---
# service.yaml
apiVersion: v1
kind: Service
metadata:
  name: continuum-router
  namespace: continuum-router
  labels:
    app: continuum-router
spec:
  type: LoadBalancer
  ports:
    - port: 80
    targetPort: http
    protocol: TCP
    name: http
  selector:
    app: continuum-router

---
# hpa.yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: continuum-router
  namespace: continuum-router
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: continuum-router
  minReplicas: 3
  maxReplicas: 10
  metrics:
    - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70
    - type: Resource
    resource:
      name: memory
      target:
        type: Utilization
        averageUtilization: 80

---
# ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: continuum-router
  namespace: continuum-router
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: "100m"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
spec:
  ingressClassName: nginx
  rules:
    - host: api.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: continuum-router
            port:
              number: 80
  tls:
    - hosts:
        - api.example.com
    secretName: continuum-router-tls

Helm Chart

# values.yaml
replicaCount: 3

image:
  repository: ghcr.io/lablup/continuum-router
  pullPolicy: IfNotPresent
  tag: "latest"

service:
  type: LoadBalancer
  port: 80
  targetPort: 8080

ingress:
  enabled: true
  className: nginx
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
  hosts:
        - host: api.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
        - secretName: continuum-router-tls
      hosts:
        - api.example.com

resources:
  limits:
    cpu: 1000m
    memory: 512Mi
  requests:
    cpu: 200m
    memory: 256Mi

autoscaling:
  enabled: true
  minReplicas: 3
  maxReplicas: 10
  targetCPUUtilizationPercentage: 70
  targetMemoryUtilizationPercentage: 80

config:
  backends:
        - url: http://ollama:11434
      name: ollama
  health_checks:
    enabled: true
    interval: 30s

Systemd 서비스

설치 스크립트

#!/bin/bash
# install-systemd.sh

# 사용자 생성
sudo useradd -r -s /bin/false continuum

# 디렉토리 생성
sudo mkdir -p /etc/continuum-router
sudo mkdir -p /var/log/continuum-router
sudo mkdir -p /opt/continuum-router

# 바이너리 복사
sudo cp continuum-router /usr/local/bin/
sudo chmod +x /usr/local/bin/continuum-router

# 설정 복사
sudo cp config.yaml /etc/continuum-router/

# 권한 설정
sudo chown -R continuum:continuum /etc/continuum-router
sudo chown -R continuum:continuum /var/log/continuum-router

# 서비스 파일 설치
sudo cp continuum-router.service /etc/systemd/system/

# 서비스 활성화 및 시작
sudo systemctl daemon-reload
sudo systemctl enable continuum-router
sudo systemctl start continuum-router

서비스 파일

# /etc/systemd/system/continuum-router.service
[Unit]
Description=Continuum Router - LLM API 라우터
Documentation=https://github.com/lablup/backend.ai-continuum
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=continuum
Group=continuum
WorkingDirectory=/opt/continuum-router

# 서비스 실행
ExecStart=/usr/local/bin/continuum-router --config /etc/continuum-router/config.yaml
ExecReload=/bin/kill -USR1 $MAINPID

# 재시작 설정
Restart=always
RestartSec=10
TimeoutStopSec=30

# 보안 강화
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/log/continuum-router
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
RestrictRealtime=true
RestrictNamespaces=true
RestrictSUIDSGID=true
PrivateDevices=true
SystemCallFilter=@system-service

# 리소스 제한
LimitNOFILE=65536
LimitNPROC=4096

# 환경 변수
Environment="RUST_LOG=continuum_router=info"
Environment="RUST_BACKTRACE=1"

[Install]
WantedBy=multi-user.target

서비스 활성화 및 시작:

sudo systemctl daemon-reload
sudo systemctl enable continuum-router
sudo systemctl start continuum-router
sudo systemctl status continuum-router

클라우드 배포

AWS ECS

{
  "family": "continuum-router",
  "taskRoleArn": "arn:aws:iam::ACCOUNT_ID:role/ecsTaskRole",
  "executionRoleArn": "arn:aws:iam::ACCOUNT_ID:role/ecsTaskExecutionRole",
  "networkMode": "awsvpc",
  "requiresCompatibilities": ["FARGATE"],
  "cpu": "1024",
  "memory": "2048",
  "containerDefinitions": [
    {
      "name": "continuum-router",
      "image": "ghcr.io/lablup/continuum-router:latest",
      "portMappings": [
        {
          "containerPort": 8080,
          "protocol": "tcp"
        }
      ],
      "essential": true,
      "environment": [
        {
          "name": "RUST_LOG",
          "value": "info"
        }
      ],
      "mountPoints": [
        {
          "sourceVolume": "config",
          "containerPath": "/etc/continuum-router"
        }
      ],
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "/ecs/continuum-router",
          "awslogs-region": "us-west-2",
          "awslogs-stream-prefix": "ecs"
        }
      },
      "healthCheck": {
        "command": ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"],
        "interval": 30,
        "timeout": 5,
        "retries": 3,
        "startPeriod": 60
      }
    }
  ],
  "volumes": [
    {
      "name": "config",
      "efsVolumeConfiguration": {
        "fileSystemId": "fs-12345678",
        "rootDirectory": "/config"
      }
    }
  ]
}

Google Cloud Run

# service.yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: continuum-router
  annotations:
    run.googleapis.com/ingress: all
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/minScale: "1"
        autoscaling.knative.dev/maxScale: "100"
    spec:
      containerConcurrency: 1000
      timeoutSeconds: 300
      containers:
      - image: gcr.io/PROJECT_ID/continuum-router:latest
        ports:
        - containerPort: 8080
        env:
        - name: RUST_LOG
          value: info
        resources:
          limits:
            cpu: "2"
            memory: 2Gi
        livenessProbe:
          httpGet:
            path: /health
          initialDelaySeconds: 10
          periodSeconds: 10

Azure Container Instances

{
  "location": "eastus",
  "properties": {
    "containers": [
      {
        "name": "continuum-router",
        "properties": {
          "image": "ghcr.io/lablup/continuum-router:latest",
          "ports": [
            {
              "port": 8080,
              "protocol": "TCP"
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1.0,
              "memoryInGB": 1.5
            }
          },
          "environmentVariables": [
            {
              "name": "RUST_LOG",
              "value": "info"
            }
          ],
          "livenessProbe": {
            "httpGet": {
              "path": "/health",
              "port": 8080
            },
            "initialDelaySeconds": 30,
            "periodSeconds": 10
          }
        }
      }
    ],
    "osType": "Linux",
    "ipAddress": {
      "type": "Public",
      "ports": [
        {
          "port": 80,
          "protocol": "TCP"
        }
      ]
    }
  }
}

고가용성 설정

다중 리전 배포

# 글로벌 로드 밸런서 설정
regions:
    - name: us-west
    endpoints:
      - https://us-west-1.api.example.com
      - https://us-west-2.api.example.com
    weight: 33

    - name: eu-central
    endpoints:
      - https://eu-central-1.api.example.com
      - https://eu-central-2.api.example.com
    weight: 33

    - name: asia-pacific
    endpoints:
      - https://ap-southeast-1.api.example.com
      - https://ap-southeast-2.api.example.com
    weight: 34

health_check:
  path: /health
  interval: 10s
  timeout: 5s
  healthy_threshold: 2
  unhealthy_threshold: 3

failover:
  primary: us-west
  secondary: eu-central
  tertiary: asia-pacific

데이터베이스 복제

# PostgreSQL HA 설정
postgresql:
  primary:
    host: primary.db.example.com
    port: 5432

  replicas:
        - host: replica1.db.example.com
      port: 5432
        - host: replica2.db.example.com
      port: 5432

  pooling:
    max_connections: 100
    connection_timeout: 10s

  failover:
    automatic: true
    promote_timeout: 30s

성능 튜닝

고부하 설정

# config-highload.yaml
server:
  bind_address: "0.0.0.0:8080"
  workers: 16                   # 2x CPU 코어
  connection_pool_size: 1000    # 많은 백엔드를 위한 큰 풀
  keepalive_timeout: 75s        # ALB 타임아웃과 일치

request:
  timeout: "30s"                # 응답성을 위한 낮은 타임아웃
  max_retries: 1                # 최소 재시도
  buffer_size: 65536            # 64KB 버퍼

health_checks:
  enabled: true
  interval: "60s"               # 부하 시 덜 빈번한 체크
  timeout: "10s"
  parallel: true                # 병렬 헬스 체크

cache:
  model_cache_ttl: "900s"       # 15분 캐시
  enable_deduplication: true
  max_entries: 10000

rate_limiting:
  enabled: true
  requests_per_minute: 1000
  burst_size: 100

logging:
  level: "warn"
  format: "json"
  buffer_size: 8192

메모리 최적화 설정

# config-memory.yaml
server:
  connection_pool_size: 25      # 최소 연결

cache:
  model_cache_ttl: "60s"        # 짧은 TTL
  max_entries: 100              # 제한된 캐시 크기

request:
  buffer_size: 8192             # 8KB 버퍼

logging:
  level: "error"
  buffer_size: 1024

CPU 최적화 설정

# config-cpu.yaml
server:
  workers: 32                   # 병렬성 최대화

threading:
  tokio_worker_threads: 16
  blocking_threads: 8

request:
  parallel_backend_queries: true

selection_strategy: LeastLatency  # CPU 효율적 라우팅

보안 강화

네트워크 보안

# firewall-rules.yaml
ingress:
    - protocol: tcp
    port: 8080
    source: 10.0.0.0/8      # 내부 전용

    - protocol: tcp
    port: 443
    source: 0.0.0.0/0       # 어디서나 HTTPS

egress:
    - protocol: tcp
    port: 443
    destination: 0.0.0.0/0   # 어디로나 HTTPS

    - protocol: tcp
    port: 11434
    destination: 10.0.0.0/8  # 백엔드 통신

TLS 설정

# tls-config.yaml
tls:
  enabled: true
  cert_file: /etc/ssl/certs/server.crt
  key_file: /etc/ssl/private/server.key

  # TLS 1.2 이상만
  min_version: "1.2"

  # 강력한 암호화만
  ciphers:
        - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
        - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

  client_auth:
    enabled: false
    ca_file: /etc/ssl/certs/ca.crt

인증

Continuum Router는 설정 가능한 적용 모드와 함께 API 키 인증을 지원합니다.

인증 모드

모드 설명
permissive (기본) API 키 없는 요청 허용. 이전 버전과 호환됨.
blocking 인증된 요청만 처리. 프로덕션에 권장.

프로덕션 설정

# config.yaml - 프로덕션 인증 설정
api_keys:
  # 필수 인증을 위한 차단 모드 활성화
  mode: blocking

  # API 키 정의
  api_keys:
        - key: "${PROD_API_KEY}"           # 환경 변수 사용
      id: "key-production-1"
      user_id: "prod-user"
      organization_id: "prod-org"
      scopes: [read, write, files]
      rate_limit: 1000
      enabled: true

  # 더 나은 보안을 위해 외부 파일에서 로드
  api_keys_file: "/etc/continuum-router/api-keys.yaml"

외부 키 파일 형식

# /etc/continuum-router/api-keys.yaml
keys:
    - key: "sk-prod-xxxxxxxxxxxxx"
    id: "key-external-1"
    user_id: "service-account"
    organization_id: "production"
    scopes: [read, write, files]
    enabled: true

인증된 요청 만들기

curl -X POST http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-4", "messages": [{"role": "user", "content": "Hello"}]}'

보호되는 엔드포인트 (blocking 모드)

  • /v1/chat/completions
  • /v1/completions
  • /v1/responses
  • /v1/images/generations
  • /v1/images/edits
  • /v1/images/variations
  • /v1/models

참고: 헬스 엔드포인트(/health, /healthz)는 항상 접근 가능합니다. Admin, Files, Metrics 엔드포인트는 별도의 인증이 있습니다.

API 키별 속도 제한

각 API 키에 개별 속도 제한을 설정할 수 있습니다:

api_keys:
  mode: blocking
  api_keys:
        - key: "${PREMIUM_KEY}"
      id: "premium-user"
      rate_limit: 5000        # 분당 5000 요청
      scopes: [read, write, files, admin]

        - key: "${STANDARD_KEY}"
      id: "standard-user"
      rate_limit: 100         # 분당 100 요청
      scopes: [read, write]

모니터링 및 관측성

Prometheus 통합

# prometheus-config.yaml
metrics:
  enabled: true
  endpoint: /metrics

  # 카디널리티 제한
  max_labels_per_metric: 10
  max_unique_label_values: 100

  # 사용자 정의 메트릭
  custom:
        - name: llm_request_duration
      type: histogram
      buckets: [0.1, 0.5, 1, 2, 5, 10, 30, 60]
        - name: backend_errors
      type: counter
      labels: [backend, error_type]

로깅 설정

# logging-config.yaml
logging:
  level: info
  format: json

  outputs:
        - type: stdout
      level: info

        - type: file
      path: /var/log/continuum-router/app.log
      rotation:
        size: 100MB
        count: 10
        compress: true

        - type: syslog
      address: syslog.example.com:514
      facility: local0

  structured_fields:
    service: continuum-router
    environment: production
    version: ${VERSION}

트레이싱

# tracing-config.yaml
tracing:
  enabled: true

  exporter:
    type: otlp
    endpoint: http://jaeger:4317

  sampling:
    rate: 0.1  # 요청의 10% 샘플링

  propagation:
        - tracecontext
        - baggage

백업 및 복구

설정 백업

#!/bin/bash
# backup-config.sh

BACKUP_DIR="/backup/continuum-router"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)

# 백업 디렉토리 생성
mkdir -p $BACKUP_DIR

# 설정 백업
tar -czf $BACKUP_DIR/config_$TIMESTAMP.tar.gz \
  /etc/continuum-router/

# 로그 백업
tar -czf $BACKUP_DIR/logs_$TIMESTAMP.tar.gz \
  /var/log/continuum-router/

# 최근 30일만 유지
find $BACKUP_DIR -name "*.tar.gz" -mtime +30 -delete

재해 복구 계획

  1. 정기 백업
  2. 설정: 매일
  3. 로그: 매주
  4. 메트릭: 매월

  5. 복구 시간 목표

  6. RTO: < 1시간
  7. RPO: < 24시간

  8. 복구 절차

    # 백업에서 복원
    tar -xzf /backup/config_latest.tar.gz -C /
    
    # 서비스 재시작
    systemctl restart continuum-router
    
    # 헬스 확인
    curl http://localhost:8080/health
    

문제 해결

일반적인 문제

높은 메모리 사용량

# 메모리 사용량 확인
ps aux | grep continuum-router

# 힙 덤프 분석
gdb -p $(pidof continuum-router)
(gdb) gcore memory.dump

연결 문제

# 열린 연결 확인
netstat -an | grep 8080

# 백엔드 연결 테스트
curl -I http://backend:11434/v1/models

성능 저하

# 디버그 로깅 활성화
export RUST_LOG=debug
systemctl restart continuum-router

# 메트릭 모니터링
curl http://localhost:8080/metrics | grep latency

참고 문서