고가용성 관리

중요합니다

Lakebase 자동 크기 조정은 자동 크기 조정 컴퓨팅, 0으로 크기 조정, 분기 및 즉시 복원이 포함된 최신 버전의 Lakebase입니다. 지원되는 지역은 지역 가용성을 참조하세요. Lakebase 프로비전된 사용자인 경우 Lakebase Provisioned를 참조하세요.

이 가이드에서는 Lakebase 엔드포인트에 대한 고가용성 사용 및 관리에 대해 설명합니다. 고가용성 작동 방식 및 보조 컴퓨팅 인스턴스가 독립 실행형 읽기 복제본과 어떻게 다른지에 대한 배경 정보는 고가용성을 참조하세요.

고가용성 활성화

고가용성을 사용하도록 설정하려면 UI에서 컴퓨팅 유형 및 HA 구성을 설정하거나 API를 통해 엔드포인트를 EndpointGroupSpec 구성합니다.

사전 요구 사항

  • "스케일-투-제로 기능을 비활성화해야 합니다." UI에서 계산 서랍 편집에서 배율을 0으로 설정하여 끄기로 만드세요. API를 통해 엔드포인트 사양에서 설정합니다 no_suspension: true (업데이트 마스크로 사용 spec.suspension ).

사용자 인터페이스 (UI)

프로젝트를 만든 후 프로젝트 대시보드에서 기본 컴퓨팅 링크를 클릭하여 컴퓨팅 서랍 편집을 엽니다.

프로덕션 분기의 주요 컴퓨팅 링크가 있는 프로젝트 대시보드

컴퓨팅 유형을고가용성으로 설정한 다음, 고가용성에서 구성을 선택합니다.

  • 2 (기본 1개, 보조 1개),
  • 3 (기본 1개, 보조 2개),
  • 또는 4 개(기본 인스턴스 1개, 보조 3개) 총 컴퓨팅 인스턴스 수입니다.

고가용성으로 설정된 컴퓨팅 유형 토글과 총 컴퓨팅 인스턴스 2개, 3개 또는 4개에 대한 옵션이 포함된 구성 드롭다운을 보여 주는 컴퓨팅 서랍 편집

Lakebase는 다른 가용성 영역에서 보조 컴퓨팅 인스턴스를 프로비전합니다. 모든 컴퓨팅 인스턴스가 활성화되면 엔드포인트에 자동 페일오버 기능이 있습니다.

Python SDK

from databricks.sdk import WorkspaceClient
from databricks.sdk.service.postgres import (
    Endpoint, EndpointSpec, EndpointType, EndpointGroupSpec, FieldMask
)

w = WorkspaceClient()

endpoint_name = "projects/my-project/branches/production/endpoints/my-endpoint"

result = w.postgres.update_endpoint(
    name=endpoint_name,
    endpoint=Endpoint(
        name=endpoint_name,
        spec=EndpointSpec(
            endpoint_type=EndpointType.ENDPOINT_TYPE_READ_WRITE,
            group=EndpointGroupSpec(
                min=2,
                max=2,
                enable_readable_secondaries=True
            )
        )
    ),
    update_mask=FieldMask(field_mask=["spec.group"])
).wait()

print(f"Group size: {result.status.group.max}")
print(f"Host: {result.status.hosts.host}")
print(f"Read-only host: {result.status.hosts.read_only_host}")

CLI

databricks postgres update-endpoint \
  projects/my-project/branches/production/endpoints/my-endpoint \
  "spec.group" \
  --json '{
    "spec": {
      "group": {
        "min": 2,
        "max": 2,
        "enable_readable_secondaries": true
      }
    }
  }'

curl

curl -X PATCH "$DATABRICKS_HOST/api/2.0/postgres/projects/my-project/branches/production/endpoints/my-endpoint?update_mask=spec.group" \
  -H "Authorization: Bearer $DATABRICKS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "projects/my-project/branches/production/endpoints/my-endpoint",
    "spec": {
      "group": {
        "min": 2,
        "max": 2,
        "enable_readable_secondaries": true
      }
    }
  }' | jq

보조 컴퓨팅 인스턴스에 대한 읽기 전용 액세스 구성

읽기 전용 컴퓨팅 인스턴스에 대한 액세스 허용 보조 컴퓨팅 인스턴스가 -ro connection string 통해 읽기 트래픽을 제공하는지 여부를 제어합니다.

사용자 인터페이스 (UI)

  1. 컴퓨팅 탭에서 기본 컴퓨팅에서 편집을 클릭합니다.
  2. 고가용성에서 읽기 전용 컴퓨팅 인스턴스에 대한 액세스 허용을 선택하거나 선택 취소합니다.
  3. 저장을 클릭합니다.

Python SDK

from databricks.sdk import WorkspaceClient
from databricks.sdk.service.postgres import (
    Endpoint, EndpointSpec, EndpointType, EndpointGroupSpec, FieldMask
)

w = WorkspaceClient()

endpoint_name = "projects/my-project/branches/production/endpoints/my-endpoint"

# Get current group size first
current = w.postgres.get_endpoint(name=endpoint_name)
current_size = current.status.group.max

w.postgres.update_endpoint(
    name=endpoint_name,
    endpoint=Endpoint(
        name=endpoint_name,
        spec=EndpointSpec(
            endpoint_type=EndpointType.ENDPOINT_TYPE_READ_WRITE,
            group=EndpointGroupSpec(
                min=current_size,
                max=current_size,
                enable_readable_secondaries=True  # set False to disable
            )
        )
    ),
    update_mask=FieldMask(field_mask=["spec.group.enable_readable_secondaries"])
).wait()

CLI

# Replace 2 with your current group size
databricks postgres update-endpoint \
  projects/my-project/branches/production/endpoints/my-endpoint \
  "spec.group.enable_readable_secondaries" \
  --json '{
    "spec": {
      "group": {
        "min": 2,
        "max": 2,
        "enable_readable_secondaries": true
      }
    }
  }'

curl

# Replace 2 with your current group size
curl -X PATCH "$DATABRICKS_HOST/api/2.0/postgres/projects/my-project/branches/production/endpoints/my-endpoint?update_mask=spec.group.enable_readable_secondaries" \
  -H "Authorization: Bearer $DATABRICKS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "projects/my-project/branches/production/endpoints/my-endpoint",
    "spec": {
      "group": {
        "min": 2,
        "max": 2,
        "enable_readable_secondaries": true
      }
    }
  }' | jq

경고

하나의 보조 컴퓨팅 인스턴스와 읽기 액세스만 활성화되면, 장애 조치 시 -ro 연결 문자열의 모든 읽기 트래픽이 대체가 추가될 때까지 중단됩니다. 복원력 있는 읽기 액세스의 경우 읽기 액세스가 사용하도록 설정된 두 개 이상의 보조 컴퓨팅 인스턴스를 구성합니다.

보조 컴퓨팅 인스턴스 수 변경

사용자 인터페이스 (UI)

  1. 컴퓨팅 탭에서 기본 컴퓨팅에서 편집을 클릭합니다.
  2. 고가용성에서 드롭다운(총 컴퓨팅 인스턴스 2개, 3개 또는 4개)에서 새 컴퓨팅 구성을 선택합니다.
  3. 저장을 클릭합니다.

메모

고가용성을 사용하지 않도록 설정하려면 컴퓨팅 유형을다시 단일 컴퓨팅으로 설정합니다. 이렇게 하면 모든 보조 컴퓨팅 인스턴스가 제거되고 엔드포인트가 단일 컴퓨팅 구성으로 돌아갑니다.

Python SDK

from databricks.sdk import WorkspaceClient
from databricks.sdk.service.postgres import (
    Endpoint, EndpointSpec, EndpointType, EndpointGroupSpec, FieldMask
)

w = WorkspaceClient()

endpoint_name = "projects/my-project/branches/production/endpoints/my-endpoint"

# Scale to 3 compute instances (1 primary + 2 secondaries)
w.postgres.update_endpoint(
    name=endpoint_name,
    endpoint=Endpoint(
        name=endpoint_name,
        spec=EndpointSpec(
            endpoint_type=EndpointType.ENDPOINT_TYPE_READ_WRITE,
            group=EndpointGroupSpec(min=3, max=3)
        )
    ),
    update_mask=FieldMask(field_mask=["spec.group.min", "spec.group.max"])
).wait()

CLI

# Scale to 3 compute instances (1 primary + 2 secondaries)
databricks postgres update-endpoint \
  projects/my-project/branches/production/endpoints/my-endpoint \
  "spec.group.min,spec.group.max" \
  --json '{
    "spec": {
      "group": { "min": 3, "max": 3 }
    }
  }'

curl

curl -X PATCH "$DATABRICKS_HOST/api/2.0/postgres/projects/my-project/branches/production/endpoints/my-endpoint?update_mask=spec.group.min,spec.group.max" \
  -H "Authorization: Bearer $DATABRICKS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "projects/my-project/branches/production/endpoints/my-endpoint",
    "spec": {
      "group": { "min": 3, "max": 3 }
    }
  }' | jq

고가용성 상태 및 역할 보기

컴퓨팅 탭에는 현재 역할, 상태 및 액세스 수준이 있는 고가용성 구성의 모든 컴퓨팅 인스턴스가 표시됩니다.

읽기/쓰기 액세스 권한이 있는 주 컴퓨팅 인스턴스 1개와 읽기 전용 액세스 권한이 있는 보조 컴퓨팅 인스턴스 3개, 모든 ACTIVE를 보여 주는 컴퓨팅 탭

칼럼 가치들
Role 주(primary), 부(secondary)
상태 시작, 활성
Access 읽기/쓰기(기본), 읽기 전용(액세스가 설정된 보조 컴퓨팅 인스턴스), 사용 안 함(읽기 권한이 없는 보조 컴퓨팅 인스턴스)

또한 기본 컴퓨팅 헤더는 엔드포인트 ID, 자동 크기 조정 범위 및 보조 개수(예: 8 ↔ 16 CU · 3 secondaries)를 표시합니다.

연결 문자열 가져오기

사용자 인터페이스 (UI)

기본 컴퓨팅에서 연결을 클릭하여 연결 세부 정보 대화 상자를 엽니다. 컴퓨팅 드롭다운에는 고가용성 엔드포인트에 대한 두 연결 옵션이 모두 나열됩니다.

기본 및 보조 RO 옵션이 표시된 Compute 드롭다운과 읽기 전용 연결 문자열이 표시된 연결 세부 정보 대화 상자.

컴퓨팅 옵션 연결 문자열 사용 목적
Primary (name) ● Active {endpoint-id}.database.{region}.databricks.com 모든 쓰기 및 읽기/쓰기 연결
Secondary (name) ● Active RO {endpoint-id}-ro.database.{region}.databricks.com 보조 컴퓨팅 인스턴스에 대한 오프로드 읽기

-ro connection string는 읽기 전용 컴퓨팅 인스턴스에 대한 액세스 허용 사용하도록 설정된 경우에만 사용할 수 있습니다.

Python SDK

from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

endpoint = w.postgres.get_endpoint(
    name="projects/my-project/branches/production/endpoints/my-endpoint"
)

print(f"Read/write host: {endpoint.status.hosts.host}")
print(f"Read-only host:  {endpoint.status.hosts.read_only_host}")

CLI

databricks postgres get-endpoint \
  projects/my-project/branches/production/endpoints/my-endpoint \
  -o json | jq '{rw_host: .status.hosts.host, ro_host: .status.hosts.read_only_host}'

curl

curl -X GET "$DATABRICKS_HOST/api/2.0/postgres/projects/my-project/branches/production/endpoints/my-endpoint" \
  -H "Authorization: Bearer $DATABRICKS_TOKEN" \
  | jq '{rw_host: .status.hosts.host, ro_host: .status.hosts.read_only_host}'

전체 connection string 참조는 커넥션 문자열 참조하세요.

다음 단계