lab_code: demo_018
title_en: "TiProxy: The Official Proxy Component of TiDB (v8.1+)"
title_zh: "TiProxy: TiDB 的官方代理组件 (v8.1+)"
title_ja: "TiProxy: TiDB の公式プロキシコンポーネント (v8.1+)"
title_ko: "TiProxy: TiDB의 공식 프록시 컴포넌트 (v8.1+)"
description_en: TiProxy is the official proxy component of TiDB. It is placed between the client and the TiDB server to provide load balancing, connection persistence, service discovery, and failover for TiDB. In this lab, we show you TiProxy's capability of service discovery, load balancing, and connection persistence. We also show you the application best practice when the TiDB server is offline unexpectedly.
description_zh: TiProxy 是 TiDB 的官方代理组件。它位于客户端与 TiDB 服务器之间，为 TiDB 提供负载均衡、连接迁移、服务发现和故障转移等功能。在本实验中，我们将展示 TiProxy 的服务发现、负载均衡和连接迁移能力。同时，我们还会介绍当 TiDB 服务器意外下线时，应用程序的最佳实践。
description_ja: TiProxy は TiDB の公式プロキシコンポーネントです。クライアントと TiDB サーバーの間に配置され、TiDB に対して負荷分散、接続の永続化、サービスディスカバリー、フェイルオーバーなどの機能を提供します。本ラボでは、TiProxy のサービスディスカバリー、負荷分散、接続の永続化の機能を紹介します。また、TiDB サーバーが予期せずオフラインになった場合のアプリケーションのベストプラクティスもご紹介します。
description_ko: TiProxy는 TiDB의 공식 프록시 컴포넌트입니다. 클라이언트와 TiDB 서버 사이에 배치되어 TiDB에 대해 부하 분산, 연결 유지, 서비스 검색, 장애 조치 등의 기능을 제공합니다. 본 실습에서는 TiProxy의 서비스 검색, 부하 분산, 연결 유지 기능을 소개합니다. 또한, TiDB 서버가 예상치 못하게 오프라인이 된 경우의 애플리케이션 모범 사례도 소개합니다.
splash_image_en: https://lab-static.pingcap.com/images/2025/9/26/359c3af54e50e857a606f12425b9849e2fcff4ba.png
splash_image_zh: https://lab-static.pingcap.com/images/2025/9/26/359c3af54e50e857a606f12425b9849e2fcff4ba.png
splash_image_ja: https://lab-static.pingcap.com/images/2025/9/26/359c3af54e50e857a606f12425b9849e2fcff4ba.png
splash_image_ko: https://lab-static.pingcap.com/images/2025/9/26/359c3af54e50e857a606f12425b9849e2fcff4ba.png

external_materials_en:
  - name: "TiProxy Deck Template"
    url: https://docs.google.com/presentation/d/1HtfmthDlYvt6NeILImcyLsRKcXX-OgEm/edit?slide=id.p1#slide=id.p1
    employee_only: true
external_materials_ja:
  - name: "TiProxy デッキテンプレート"
    url: https://docs.google.com/presentation/d/1HtfmthDlYvt6NeILImcyLsRKcXX-OgEm/edit?slide=id.p1#slide=id.p1
    employee_only: true
external_materials_zh:
  - name: "TiProxy 演示文稿模板"
    url: https://docs.google.com/presentation/d/1HtfmthDlYvt6NeILImcyLsRKcXX-OgEm/edit?slide=id.p1#slide=id.p1
    employee_only: true
external_materials_ko:
  - name: "TiProxy 자료 템플릿"
    url: https://docs.google.com/presentation/d/1HtfmthDlYvt6NeILImcyLsRKcXX-OgEm/edit?slide=id.p1#slide=id.p1
    employee_only: true
lab_level: Advanced
category_en:
  - Foundational Capability
  - Scalability
category_zh:
  - 基础能力
  - 可扩展性
category_ja:
  - 基礎能力
  - スケーラビリティ
category_ko:
  - 기초 능력
  - 확장성
authors:
  - Chenhao Huang (CEG)
delivery_type: Self-Paced
tidb_environments:
  - TiDB Self-Managed
tidb_versions:
  - 8.5.1
target_audience:
  - Architect
  - DBA
  - DevOps
regions:
  aws:
    - oregon
    - tokyo
    - singapore
    - frankfurt
credits: 5
credit_redeemable: true
employee_only: false
estimated_duration_minutes: 45

topology:
  - role: monitor
    node_count: 1
    web_ssh: true
    web_ssh_name: "TiUP Control Machine"
    ssh_user: ec2-user
  - role: pd
    node_count: 1
  - role: kv
    node_count: 4
  - role: db
    node_count: 2

requirements:
  - type: "CloudStack"

bootstrap:
  - name: "prepare monitor"
    type: "ShellScript"
    target:
      - monitor1
    script: ./scripts/prepare-monitor.sh

  - name: "prepare tidb cluster"
    type: "ShellScript"
    target:
      - monitor1
    script: ./scripts/prepare-tidb.sh

features:
  enable_content_explain: false
