lab_code: demo_016
title_en: Database Scalability Deep Dive - Best Practice during SQL Layer Scaling In
title_zh: 深入理解数据库扩容与缩容 - SQL 层缩容最佳实践
title_ja: データベーススケーラビリティ徹底解説：SQL レイヤースケールイン時のベストプラクティス
title_ko: 데이터베이스 확장성을 깊이 이해하십시오 - SQL 레이어 스케일 인 시 모범 사례
description_en: TiDB is a distributed database which provides you the flexibility of scaling in/out the computing (SQL layer) or the storage layer (TiKV layer) easily. When scaling in the computing layer, your application needs to follow best practice, to achieve zero downtime. In this lab, we discuss those best practices.
description_zh: TiDB 是一款分布式数据库，能够灵活地对计算层（SQL 层）和存储层（TiKV 层）进行扩容和缩容。在缩容计算层时，应用程序需要遵循最佳实践，以实现零停机。本实验将讨论这些最佳实践。
description_ja: TiDB は分散型データベースであり、コンピューティング層（SQL レイヤー）やストレージ層（TiKV レイヤー）を柔軟にスケールイン・スケールアウトできます。コンピューティング層をスケールインする際、アプリケーションはゼロダウンタイムを実現するためにベストプラクティスに従う必要があります。本ラボでは、これらのベストプラクティスについて解説します。
description_ko: TiDB는 분산형 데이터베이스로, 컴퓨팅 계층(SQL 계층) 또는 스토리지 계층(TiKV 계층)을 손쉽게 확장하거나 축소할 수 있는 유연성을 제공합니다. 컴퓨팅 계층을 축소할 때, 애플리케이션이 무중단을 달성하려면 반드시 모범 사례를 따라야 합니다. 본 실습에서는 이러한 모범 사례에 대해 다룹니다.
splash_image_en: https://lab-static.pingcap.com/images/2025/9/5/f1fa368aef2033a14d30f3c836f9df7cd0381ee6.png
splash_image_zh: https://lab-static.pingcap.com/images/2025/9/5/f1fa368aef2033a14d30f3c836f9df7cd0381ee6.png
splash_image_ja: https://lab-static.pingcap.com/images/2025/9/5/f1fa368aef2033a14d30f3c836f9df7cd0381ee6.png
splash_image_ko: https://lab-static.pingcap.com/images/2025/9/5/f1fa368aef2033a14d30f3c836f9df7cd0381ee6.png
lab_level: Advanced
category_en:
  - Foundational Capability
  - Application Migration
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
  - Developer
  - DevOps
regions:
  aws:
    - oregon
    - tokyo
    - singapore
    - frankfurt
credits: 5
credit_redeemable: true
employee_only: false
estimated_duration_minutes: 90

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
