{"id":24809,"date":"2025-01-10T08:31:43","date_gmt":"2025-01-10T16:31:43","guid":{"rendered":"https:\/\/www.pingcap.com\/?p=24809"},"modified":"2026-01-09T08:44:14","modified_gmt":"2026-01-09T16:44:14","slug":"distributed-sql-tutorial-first-steps-setting-up-tidb-locally","status":"publish","type":"post","link":"https:\/\/www.pingcap.com\/ko\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/","title":{"rendered":"Kickstart Your Distributed SQL Journey: Setting Up TiDB Locally with TiUP Playground"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.pingcap.com\/tidb-self-managed\/\">TiDB<\/a> is a powerful, open-source <a href=\"https:\/\/www.pingcap.com\/blog\/why-distributed-sql-databases-elevate-modern-app-dev\/\">distributed SQL database<\/a> built for handling both transactional and analytical workloads. With its MySQL compatibility, horizontal scalability, and real-time HTAP capabilities, it\u2019s designed for modern, cloud-native architectures. In this distributed SQL tutorial, we&#8217;ll walk you through setting up a local TiDB cluster for development and testing in just a few simple steps.&nbsp;<\/p>\n\n\n\n<p>For a fully-managed experience with a free tier, you can also explore <a href=\"https:\/\/tidbcloud.com\">TiDB Cloud Serverless<\/a>.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Set_Up_Your_Environment\"><\/span>Set Up Your Environment<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This tutorial demonstrates examples using macOS. They will also work on Linux with trivial adaptations.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install TiUP<\/h3>\n\n\n\n<p><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/tiup-overview\">TiUP<\/a> is TiDB\u2019s package manager. Install it with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl --proto '=https' --tlsv1.2 -sSf https:\/\/tiup-mirrors.pingcap.com\/install.sh | sh<\/code><\/pre>\n\n\n\n<p>You will see an output like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nSuccessfully set mirror to https:\/\/tiup-mirrors.pingcap.com\nDetected shell: zsh\nShell profile:  ~\/.zshrc\n~\/.zshrc has been modified to add tiup to PATH\nopen a new terminal or source ~\/.zshrc to use it\nInstalled path: ~\/.tiup\/bin\/tiup\n\n===============================================\nHave a try:     tiup playground\n===============================================<\/code><\/pre>\n\n\n\n<p>The script automatically modifies your PATH. To apply the changes, use the source command shown in the installation output or open a new terminal. In this example, run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>source ~\/.zshrc<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Start Your Database Playground<\/h3>\n\n\n\n<p>Start your local <a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/tiup-playground\">TiUP playground<\/a> environment with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground<\/code><\/pre>\n\n\n\n<p>When playground starts, you\u2019ll see:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nTiDB Playground Cluster is started, enjoy!\n\nConnect TiDB:    mysql --host 127.0.0.1 --port 4000 -u root\nTiDB Dashboard:  http:\/\/127.0.0.1:2379\/dashboard\nGrafana:         http:\/\/127.0.0.1:3000\n<\/code><\/pre>\n\n\n\n<p>Keep this terminal open and proceed to the next steps in a new terminal.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect to TiDB and Run Your First Queries<\/h3>\n\n\n\n<p>Let&#8217;s connect to the database server and run your first queries using TiUP&#8217;s built-in client. While this client only works with TiUP playground environments, it&#8217;s the quickest way to get started. Notice that TiDB Playground output shows you how to connect using the standard MySQL client. We\u2019ll cover that later.&nbsp;<\/p>\n\n\n\n<p>Run the built-in client with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup client<\/code><\/pre>\n\n\n\n<p>When prompted to choose an endpoint, simply press <code>Enter<\/code> to connect. Since we started <code>tiup playground<\/code> without extra arguments, there&#8217;s only one endpoint available.<\/p>\n\n\n\n<p>You will see a prompt like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nStarting component client: ~\/.tiup\/components\/client\/v1.16.1\/tiup-client\nConnected with driver mysql (8.0.11-TiDB-v8.4.0)\nType \"help\" for help.\n\nmy:root@127.0.0.1:4000=&gt; <\/code><\/pre>\n\n\n\n<p>Then, try these sample SQL commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE DATABASE hello;\nUSE hello;\n\nCREATE TABLE hello_tidb (\n    id INT,\n    name VARCHAR(50)\n);\n\nINSERT INTO hello_tidb VALUES (1, 'Hello World');\n\nSELECT * FROM hello_tidb;<\/code><\/pre>\n\n\n\n<p>The SQL commands above demonstrate basic interactions with the TiDB database. First, a new database <code>hello<\/code> and a table <code>hello_tidb<\/code> are created. Then, a row with <code>id = 1<\/code> and <code>name = 'Hello World'<\/code> is inserted. The <code>SELECT * FROM hello_tidb<\/code> command retrieves and displays all rows in the table, resulting in the following output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> id |    name     \n----+-------------\n  1 | Hello World \n(1 row)<\/code><\/pre>\n\n\n\n<p>This confirms that the data has been successfully inserted and queried from the database. To exit the TiUP client, type <code>\\q<\/code> or <code>exit<\/code> and press <code>Enter<\/code>. This will close the interactive session and return you to the terminal.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Understanding_What_Just_Happened\"><\/span>Understanding What Just Happened<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You just started to use a fully functional <a href=\"https:\/\/www.pingcap.com\/tidb\/self-managed\/\">distributed database<\/a> cluster with:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>TiDB Server:<\/strong> SQL layer that processes queries and speaks MySQL protocol<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/tikv-overview\">TiKV<\/a>:<\/strong> Distributed storage layer that replicates data automatically and handles transactions across nodes<\/li>\n\n\n\n<li><strong>PD (Placement Driver):<\/strong> Cluster orchestrator that works behind the scenes to coordinate TiDB, TiKV, and TiFlash components, managing cluster metadata and ensuring data is distributed optimally<\/li>\n<\/ul>\n\n\n\n<p>Additionally, <code>tiup playground<\/code> installed optional components:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/tiflash-overview\">TiFlash<\/a>:<\/strong> Real-time analytics engine that accelerates complex queries and reporting without slowing down your live application<\/li>\n\n\n\n<li>Built-in <strong>monitoring stack<\/strong> with:\n<ul class=\"wp-block-list\">\n<li><strong>TiDB Dashboard<\/strong> (default: <a href=\"http:\/\/127.0.0.1:2379\/dashboard\">http:\/\/127.0.0.1:2379\/dashboard<\/a>, user: <code>root<\/code>, no password)<\/li>\n\n\n\n<li><strong>Grafana + Prometheus<\/strong> (default: <a href=\"http:\/\/127.0.0.1:3000\">http:\/\/127.0.0.1:3000<\/a>, user: <code>admin<\/code>, password: <code>admin<\/code>)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>You can verify your running database cluster components with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground display<\/code><\/pre>\n\n\n\n<p>The command above displays your local cluster nodes, and you can see the running processes, node roles, and processes uptime:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Pid    Role     Uptime\n---    ----     ------\n56624  pd       2m33.91622925s\n56625  tikv     2m33.755937666s\n56626  tidb     2m33.73377625s\n56646  tiflash  2m25.408932208s<\/code><\/pre>\n\n\n\n<p>You can clean up the playground environment you just started by simply returning to the terminal where you started <code>tiup playground<\/code>, and pressing <code>Ctrl+C<\/code>.<\/p>\n\n\n\n<p>Congratulations! You now have a fully functional <a href=\"https:\/\/www.pingcap.com\/tidb\/self-managed\/\">distributed database<\/a> environment at your fingertips. This is a great moment to take a pause and explore the basics on your own. However, if you&#8217;re eager to dive deeper, let&#8217;s continue with this guide. We will learn more about <code>TiUP playground<\/code> and how to create a sample application and workload, simulate workload balancing across your distributed database, scale your cluster, and leverage TiFlash to accelerate your queries.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Enhance_Your_Development_Workflow\"><\/span>Enhance Your Development Workflow<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The previous steps gave you an ephemeral environment &#8211; perfect for first experiments but everything is lost when you stop the playground. Let&#8217;s set up a more suitable environment for development and tests.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect to TiDB Using MySQL Client<\/h3>\n\n\n\n<p>Since TiDB is compatible with MySQL, you can also utilize the extensive MySQL ecosystem of tools and connectors. Unlike <code>tiup client<\/code> which is restricted to the playground environment, the MySQL standard client is recommended for all TiDB deployment options and more advanced usage. Let&#8217;s set it up now and use it for the rest of this guide.&nbsp;<\/p>\n\n\n\n<p>If you already have MySQL installed, verify it by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql --version<\/code><\/pre>\n\n\n\n<p>If you don\u2019t have MySQL installed or need only the client with a specific version, you can install MySQL Client 8.4 on macOS with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>brew install mysql-client@8.4<\/code><\/pre>\n\n\n\n<p><strong>Note:<\/strong> When installing the MySQL client using Homebrew on macOS, we recommend version 8.4 due to a <a href=\"https:\/\/github.com\/Homebrew\/homebrew-core\/pull\/181805\">known issue<\/a> (not solved at the time of this writing) where newer versions cannot load the <code>mysql_native_password<\/code> plugin correctly.<\/p>\n\n\n\n<p>After installation, you should see an output similar to this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nmysql-client@8.4 is keg-only, which means it was not symlinked into \/opt\/homebrew, because this formula is mainly used by MySQL server.\n\nIf you need to have mysql-client@8.4 first in your PATH, run:\n  echo 'export PATH=\"\/opt\/homebrew\/opt\/mysql-client@8.4\/bin:$PATH\"' &gt;&gt; ~\/.zshrc<\/code><\/pre>\n\n\n\n<p>To make <code>mysql-client<\/code> available globally, update your PATH as per the instructions above and reload the rc file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo 'export PATH=\"\/opt\/homebrew\/opt\/mysql-client\/bin:$PATH\"' &gt;&gt; ~\/.zshrc\n\nsource ~\/.zshrc<\/code><\/pre>\n\n\n\n<p>Once the client is available, make sure your playground cluster is running (if you stopped it earlier, start it again with <code>tiup playground<\/code>). Then connect to TiDB using:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql --host 127.0.0.1 --port 4000 -u root<\/code><\/pre>\n\n\n\n<p>You will see a prompt like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Welcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 3126853646\nServer version: 8.0.11-TiDB-v8.4.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible\n\nCopyright (c) 2000, 2024, Oracle and\/or its affiliates.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nmysql&gt;<\/code><\/pre>\n\n\n\n<p>This confirms that the MySQL client is successfully interacting with the TiDB cluster, and the data previously inserted is correctly retrieved. To exit the MySQL client, type <code>\\q<\/code> or <code>exit<\/code> and press <code>Enter<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Persistent and Customized Environments<\/h3>\n\n\n\n<p>With TiUP you can create tagged playgrounds that persist data between restarts. You can also use playground options to specify different TiDB versions, or components that better meet your development and testing goals.&nbsp;<\/p>\n\n\n\n<p>If your playground cluster is still running, first stop it by pressing <code>Ctrl+C<\/code> in the terminal where you started it and wait for all processes to stop. Now we can create, for example, a tagged local environment with 2 TiDB servers, 3 TiKV, 1 PD, and no TiFlash:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground --tag sample-app-env --db 2 --kv 3 --pd 1 --tiflash 0<\/code><\/pre>\n\n\n\n<p>The <code>--tag<\/code> flag preserves your data after the playground environment restarts and lets you run multiple environments using different tags (ex., <code>sample-app-env<\/code>, <code>dev-env<\/code>).<\/p>\n\n\n\n<p>You can list all your playground environments with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup status<\/code><\/pre>\n\n\n\n<p>You will see an output similar to this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Name            Component  PID    Status  ... Args\nsample-app-env  playground 30661  RUNNING ... tiup-playground --tag sample-app-env --db 2 --kv 3 --pd 1 --tiflash 0<\/code><\/pre>\n\n\n\n<p>If you stop a tagged playground cluster by pressing <code>Ctrl+C<\/code> in the terminal where you started it, you can start it again without losing data. To restart the environment, you simply run <code>tiup playground<\/code> with the same arguments as seen in <code>Args<\/code> in the <code>tiup status<\/code> output above.&nbsp;<\/p>\n\n\n\n<p>Tags also make the clean-up process more explicit. For example, first, stop the playground cluster by pressing <code>Ctrl+C<\/code> in the terminal where you started it and wait a few seconds for TiUP to gracefully stop all processes, then run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup clean sample-app-env<\/code><\/pre>\n\n\n\n<p>See all TiUP playground options with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground --help<\/code><\/pre>\n\n\n\n<p>Common options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>--*.host<\/code>: Bind to specific network interface<\/li>\n\n\n\n<li><code>--*.port<\/code>: Change default ports<\/li>\n\n\n\n<li><code>--without-monitor<\/code>: Start without monitoring stack<\/li>\n<\/ul>\n\n\n\n<p>You can even customize existing environments by changing some arguments. This means that you have the flexibility to add and remove cluster components like monitoring, TiFlash, or <a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/tiproxy-overview\">TiProxy<\/a> without losing data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Add_a_Load_Balancer\"><\/span>Add a Load Balancer<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before we demonstrate distributed SQL with a sample application, let&#8217;s add TiProxy to help us visualize how queries are distributed across TiDB servers. TiProxy will automatically balance our application&#8217;s database connections, making it easier to observe distributed query processing in action.&nbsp;<\/p>\n\n\n\n<p>If your playground cluster is still running, first stop it by pressing <code>Ctrl+C<\/code> in the terminal where you started it and wait for all processes to stop. Then, to add a TiProxy instance in a new or existing <code>sample-app-env<\/code>, start the environment with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground --tag sample-app-env --db 2 --kv 3 --pd 1 --tiflash 0 --tiproxy 1<\/code><\/pre>\n\n\n\n<p>You should see the cluster starting normally, with an output like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nTiDB Playground Cluster is started, enjoy!\n\nConnect TiDB:    mysql --comments --host 127.0.0.1 --port 4001 -u root\nConnect TiDB:    mysql --comments --host 127.0.0.1 --port 4000 -u root\nConnect TiProxy: mysql --comments --host 127.0.0.1 --port 6000 -u root\nTiDB Dashboard:  http:\/\/127.0.0.1:2379\/dashboard\nGrafana:         http:\/\/127.0.0.1:62007<\/code><\/pre>\n\n\n\n<p><strong>Note:<\/strong> If <code>tiup playground<\/code> is taking longer than usual to start or shows errors, check for running instances with tiup status and stop them if needed.<\/p>\n\n\n\n<p>Now you can connect through TiProxy (port 6000):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql --host 127.0.0.1 --port 6000 -u root<\/code><\/pre>\n\n\n\n<p>By adding a TiProxy instance in the environment, you&#8217;ll be enhancing TiDB with a new layer. TiProxy sits between your applications and TiDB servers, intelligently distributing database connections and managing traffic to improve scalability and reduce connection overhead. In the next section, we\u2019ll simulate a sample workload and see the SQL queries automatically distributed across the TiDB server nodes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Build_a_Sample_Scalable_Application\"><\/span>Build a Sample Scalable Application<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let&#8217;s create a simple weather monitoring system that stores data from weather stations worldwide. Using the environment we just created with TiProxy and the MySQL client, connect to TiDB and run the following SQL statements:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Create the schema\/database for the weather monitoring app\nCREATE DATABASE sample_weather;\nUSE sample_weather;\n\nCREATE TABLE stations (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    name VARCHAR(100),\n    location VARCHAR(100),\n    latitude DECIMAL(8,6),\n    longitude DECIMAL(9,6)\n);\n\nCREATE TABLE readings (\n    station_id INT,\n    temperature DECIMAL(4,1), -- in Celsius\n    humidity INT, -- percentage\n    pressure INT, -- in hPa\n    recorded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    INDEX idx_station_time(station_id, recorded_at)\n);<\/code><\/pre>\n\n\n\n<p>You will see a series of <code>Query OK<\/code> responses. Now insert sample data:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Insert some weather stations from different cities\nINSERT INTO stations (name, location, latitude, longitude) VALUES\n    ('Sydney Harbor', 'Sydney, Australia', -33.8688, 151.2093),\n    ('Shibuya Weather', 'Tokyo, Japan', 35.6595, 139.7006),\n    ('Beijing Station', 'Beijing, China', 39.9040, 116.4275),\n    ('Singapore Central', 'Singapore', 1.3521, 103.8198),\n    ('Mumbai Central', 'Mumbai, India', 18.9710, 72.8194),\n    ('Cairo Station', 'Cairo, Egypt', 30.0629, 31.2474),\n    ('Berlin Central', 'Berlin, Germany', 52.5251, 13.3694),\n    ('London City', 'London, UK', 51.5074, -0.1278),\n    ('Sao Paulo Central', 'Sao Paulo, Brazil', -23.5505, -46.6333),\n    ('Central Park', 'New York, USA', 40.7829, -73.9654);<\/code><\/pre>\n\n\n\n<p>The response <code>Query OK, 10 rows affected<\/code> confirms successful data insertion. Now we&#8217;re ready to generate sample workloads in the next section.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Generate Sample Workload<\/h3>\n\n\n\n<p>Open two new terminal windows and run the following shell commands to generate write and read workloads through TiProxy.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Terminal 1: Write Workload<\/h4>\n\n\n\n<p>Run this command in a new terminal to continuously insert weather readings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while true; do\n    mysql -h 127.0.0.1 -P 6000 -u root -D sample_weather -vv -e \"INSERT INTO readings\n    (station_id, temperature, humidity, pressure) SELECT id as station_id, ROUND(10 + (RAND() *\n    30), 1), ROUND(40 + (RAND() * 60)), ROUND(980 + (RAND() * 40)) FROM stations;\"\n    sleep 0.5\ndone<\/code><\/pre>\n\n\n\n<p>This command continuously inserts simulated readings from all stations every 0.5 seconds. You will see output showing successful insertions like <code>Query OK, 10 rows affected<\/code>, confirming that readings are being recorded for all 10 stations.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Terminal 2: Read Workload<\/h4>\n\n\n\n<p>Run this command in another new terminal to continuously query the data:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while true; do\n    mysql -h 127.0.0.1 -P 6000 -u root -D sample_weather -e \"SELECT s.name, s.location,\n    r.temperature, r.humidity, r.recorded_at FROM stations s JOIN readings r ON s.id = r.station_id\n    WHERE r.recorded_at &gt;= NOW() - INTERVAL 5 MINUTE ORDER BY r.recorded_at DESC LIMIT 5;\"\n    sleep 1\n    mysql -h 127.0.0.1 -P 6000 -u root -D sample_weather -e \"SELECT s.name,\n    ROUND(AVG(r.temperature), 1) as avg_temp, ROUND(AVG(r.humidity)) as avg_humidity,\n    COUNT(*) as num_readings FROM stations s JOIN readings r ON s.id = r.station_id WHERE\n    r.recorded_at &gt;= NOW() - INTERVAL 1 HOUR GROUP BY s.id, s.name ORDER BY avg_temp DESC;\"\n    sleep 3\ndone<\/code><\/pre>\n\n\n\n<p>This command alternates between showing the most recent readings and hourly statistics. You&#8217;ll see tables updating with the latest temperatures, humidity levels, and running averages from all stations.<\/p>\n\n\n\n<p>Keep both terminals running as we explore monitoring and scaling in the next sections.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Monitor_Your_Application\"><\/span>Monitor Your Application<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Now that you have a running application with active read and write workloads, let&#8217;s use TiDB&#8217;s built-in monitoring tools to understand what&#8217;s happening.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">TiDB Dashboard: SQL Insights<\/h3>\n\n\n\n<p>Access TiDB Dashboard by checking its URL on the terminal you are running TiUP playground (typically <a href=\"http:\/\/127.0.0.1:2379\/dashboard\">http:\/\/127.0.0.1:2379\/dashboard<\/a> &#8211; user: <code>root<\/code>, no password) to:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>View your running queries:\n<ul class=\"wp-block-list\">\n<li>Go to &#8220;SQL Statements&#8221; to see your weather data queries<\/li>\n\n\n\n<li>Check execution times, and additional optional columns, and click on the statement for more execution details<\/li>\n\n\n\n<li>Go to &#8220;Slow Queries&#8221; to identify queries that might need optimization<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Monitor instance status:\n<ul class=\"wp-block-list\">\n<li>Check &#8220;Overview&#8221; and &#8220;Cluster Info&#8221; for general topology, and resource usage<\/li>\n\n\n\n<li>Check &#8220;Monitoring&#8221; to see the database load and other relevant metrics<\/li>\n\n\n\n<li>Check &#8220;Search Logs&#8221; for any query errors<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXclkdW2VjGI7VeXe60vyojJ-uIYQEib9wX2G1mVGfnf2bPT7joAvrozLABrA_lDORaH3vwsPeLWqg-NMbyOAjNgbbpLPDcdvzwTj7p0hLlkfblbty87kBXh9WYXaVnVx2v8fLoDkg?key=ZPKijGWxscMe970KX3tC_7os\" style=\"\" alt=\"TiDB dashboard overview.\"><\/td><\/tr><tr><td><em>TiDB Dashboard Overview<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Grafana: System Performance<\/h3>\n\n\n\n<p>Access Grafana by checking its URL in the terminal where TiUP playground is running &#8211; the port may change between restarts (look for something like <code>Grafana: http:\/\/127.0.0.1:&lt;port&gt;<\/code>). Log in with user <code>admin<\/code>, password <code>admin<\/code>, and either change the password or click Skip. You can visualize the built-in dashboards by clicking on the Search icon and the folder &#8220;Test-Cluster&#8221;:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Detailed TiDB metrics:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Search for &#8220;Overview&#8221;, and select the \u201cTest-Cluster-Overview\u201d dashboard for general cluster health status<\/li>\n<\/ul>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>TiProxy Load Balancing:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Search for &#8220;TiProxy&#8221;, and check the &#8220;Balance&#8221; row<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXcG3qChw-JK1Rwzlz1jde3QWUrLosEtA5H4wAwRaCRKLGduTxBM8NT_HvdrL4G44cvrNIjA21_ZTi4csfCtrL1TXYDUZpKwJrgWvwDfCcsbGMTktMtulKq55kKx_JkeiYNOb8Rr5A?key=ZPKijGWxscMe970KX3tC_7os\" style=\"\" alt=\"Distributed SQL tutorial: Built-in Grafana dashboards.\"><\/td><\/tr><tr><td><em>Built-in Grafana Dashboards<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Tip:<\/strong> Keep these monitoring pages open while experimenting with different data volumes or query patterns to understand how your application behaves under load.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Scale_Your_Cluster\"><\/span>Scale Your Cluster<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As your weather monitoring system grows, you&#8217;ll need to handle more stations, readings, and queries. Let&#8217;s scale the cluster while observing the process in real time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Prepare Monitoring Views<\/h3>\n\n\n\n<p>Before scaling, set up these monitoring views to watch the scaling process:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open TiDB Dashboard:\n<ul class=\"wp-block-list\">\n<li>Go to &#8220;Cluster Info&#8221;, &#8220;Store Topology&#8221;<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>Open Grafana:\n<ul class=\"wp-block-list\">\n<li>Find the &#8220;TiKV-Summary&#8221; dashboard<\/li>\n\n\n\n<li>Look for the &#8220;Cluster&#8221; panel:\n<ul class=\"wp-block-list\">\n<li>Store, Available, and Capacity size charts<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Add Storage Capacity (TiKV)<\/h3>\n\n\n\n<p>With monitoring in place, let&#8217;s add two additional TiKV nodes online (scale-out). Open a new terminal and run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground scale-out --kv 2<\/code><\/pre>\n\n\n\n<p>Watch the expansion:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In TiDB Dashboard, &#8220;Cluster Info&#8221;, &#8220;Store Topology&#8221;, click the Refresh button. You should see the new TiKV nodes in the topology.<\/li>\n\n\n\n<li>In Grafana, watch the TiKV size increase.<\/li>\n\n\n\n<li>In your application terminals, verify continuous data ingestion and reads without any disruption.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXf8sOLGoRScxZJ4l0AUFap4fhStsgjqAo4BK7ak01qV4RdUWQtNdeJGNakaar46RPHqfFcFF2jVcRLCPYY0dSoMWofLg9_EWVUHrw7laEk0RTwW9WoukTC6BRKNi60lSJylKEarPQ?key=ZPKijGWxscMe970KX3tC_7os\" style=\"\" alt=\"Distributed SQL tutorial: TiDB cluster store topology after TiKV scale-out.\"><\/td><\/tr><tr><td><em>TiDB Cluster Store Topology After TiKV Scale-Out<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXcsDLpR45AqTtO-NM0CmfejOTdt7lCaH-q9v-ds8f2YvTN3KpfdCEmtPBBRjBoeYRXsSBJ_NQ5zxCM-vY2fr8sYKr-IH9_0zHJBCLnGHMrQXS4sUTf1mCYNYXiL7Mp7a45-AX217w?key=ZPKijGWxscMe970KX3tC_7os\" style=\"\" alt=\"TiDB Cluster Increased Size After TiKV Scale-Out.\"><\/td><\/tr><tr><td><em>TiDB Cluster Increased Size After TiKV Scale-Out<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Remove Storage Capacity (TiKV)<\/h3>\n\n\n\n<p>Let&#8217;s remove one TiKV node. For these scale-in operations, we specify the exact node we want to remove using its PID. First, in your available terminal, check the TiKV nodes&#8217; PIDs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground display<\/code><\/pre>\n\n\n\n<p>You will see an output similar to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Pid     Role    Uptime\n...\n73976  tikv     1m44.587040583s\n73977  tikv     1m44.566830708s\n...<\/code><\/pre>\n\n\n\n<p>You can scale-in your cluster by removing one TiKV node of your choice using its PID. For example, select one of the TiKV nodes and run the following replacing the &#8211;pid value with your TiKV PID:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground scale-in --pid 73977<\/code><\/pre>\n\n\n\n<p>Check TiDB Dashboard and Grafana again, and you will see the cluster is smaller now.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdiY1p9i6IYeuvkzdSKp-MRKbFAmxVNDlqNor77MiU_1LjETCgdAUzn62_FIWMeL7vKbu9R73nvASS7oJSCjq-RO1tVqeinA-RGIY6q9lNafZgPcD7kn2p0oPAdUuaCCC63qbXI?key=ZPKijGWxscMe970KX3tC_7os\" style=\"\" alt=\"TiDB Cluster Store Topology After TiKV Scale-In\"><\/td><\/tr><tr><td><em>TiDB Cluster Store Topology After TiKV Scale-In<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXfKrsV3bd_6evL0sEqP-HxnoY_C7HVcpc80z7oUvdT3bCPjunetn6byp_oLbErc4RAP9EXvFIazBUddrYY359kiWvVgkzQpATDPKH0fZPhUPqNipRUdPVbNEWkbLjsqUmS76969sg?key=ZPKijGWxscMe970KX3tC_7os\" style=\"\" alt=\"TiDB Cluster Decreased Size After TiKV Scale-In.\"><\/td><\/tr><tr><td><em>TiDB Cluster Decreased Size After TiKV Scale-In<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Scale Query Processing (TiDB)<\/h3>\n\n\n\n<p>Now that storage is expanded, let&#8217;s add TiDB nodes while watching query distribution:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground scale-out --db 1<\/code><\/pre>\n\n\n\n<p>The output you will see is similar to this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground scale-out --db 1\n... \nTo connect new added TiDB: mysql --comments --host 127.0.0.1 --port 64477 -u root -p (no password)<\/code><\/pre>\n\n\n\n<p>Watch the query layer scaling:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TiDB Dashboard, &#8220;Cluster Info&#8221;, &#8220;Instances&#8221;. Check the new TiDB instance.<\/li>\n\n\n\n<li>Grafana, search for &#8220;TiProxy-Summary&#8221;, and expand the &#8220;Query Summary&#8221; or &#8220;Traffic&#8221;. You should see a new instance in the backend (in this example, with port <code>64477<\/code>) and the traffic is being balanced across them.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXcqBSSs5rlixVwSTb_NjP_PSafdDIY42dIYVSGS3M119kKPopMpx71CrojFLNKS3AwFBx_Ap4JNb8x26E3hw9nufXJvv3r2FgeyW0iJyca6zFuhrENnPspoFhHR31OTLYuuIVU3dA?key=ZPKijGWxscMe970KX3tC_7os\" style=\"\" alt=\"Distributed SQL Tutorial: TiDB Cluster Distributed Query Processing After Scale-Out\"><\/td><\/tr><tr><td><em>TiDB Cluster Distributed Query Processing After Scale-Out<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Add Analytical Processing (TiFlash)<\/h3>\n\n\n\n<p>TiDB supports real-time analytics through its columnar storage engine, TiFlash. Let&#8217;s add it to our playground cluster.<\/p>\n\n\n\n<p>Add TiFlash node:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup playground scale-out --tiflash 1<\/code><\/pre>\n\n\n\n<p>Enable TiFlash replica for our weather data in the table readings. Using the MySQL client or TiUP client run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>USE sample_weather;\nALTER TABLE readings SET TIFLASH REPLICA 1;<\/code><\/pre>\n\n\n\n<p>Check replication progress:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT table_schema, table_name,\n    replica_count, available, progress\nFROM information_schema.tiflash_replica;<\/code><\/pre>\n\n\n\n<p>Once the replica is ready (<code>progress=1<\/code>), you can run analytical queries that will automatically use TiFlash when beneficial.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>+----------------+------------+---------------+-----------+----------+\n| table_schema   | table_name | replica_count | available | progress |\n+----------------+------------+---------------+-----------+----------+\n| sample_weather | readings   |             1 |         1 |        1 |\n+----------------+------------+---------------+-----------+----------+\n1 row in set (0.00 sec)<\/code><\/pre>\n\n\n\n<p>Check the TiDB Dashboard, SQL Statements, &#8220;#Plans&#8221; columns. If there is a new plan, you can inspect the execution details to see if there is a task performed by mpp[tiflash].<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXcNOcW9NAwcnZrBBzb9NVDRvX1bKUGchsvS_wQIR4Qh-27uGuvA64-6pkHkR3PuxAd8pbWZOvak8eJoM55en2qLAy9iciH3Fn5NNwkCWY8CwFyLrtHkTwR78oYBkKRwFt79EAkN?key=ZPKijGWxscMe970KX3tC_7os\" style=\"\" alt=\"Query Execution Plan Accelerated by TiFlash\"><\/td><\/tr><tr><td><em>Query Execution Plan Accelerated by TiFlash<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You may not notice too much performance difference because it is a local test environment with low concurrency. In a production environment with real workloads, TiFlash significantly improves analytical query performance while isolating these resource-intensive operations from your transactional workload. This separation enables real-time analytics without impacting your operational applications.&nbsp;<\/p>\n\n\n\n<p>If you are interested in testing in a production-like environment, see <a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/production-deployment-using-tiup\">Deploy a TiDB Cluster Using TiUP<\/a> or <a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/tidb-in-kubernetes\">Deploy a TiDB Cluster on Kubernetes<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Clean_Up_Optional\"><\/span>Clean Up (Optional)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you want to clean up after experimenting:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Stop running workloads (<code>Ctrl+C<\/code> in Terminal 1 and 2)<\/li>\n\n\n\n<li>Stop the playground cluster (<code>Ctrl+C<\/code> in the playground terminal)<\/li>\n\n\n\n<li>Clean up the environment:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup clean sample-app-env<\/code><\/pre>\n\n\n\n<p>If you want to clean everything, all environments and components, run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tiup clean --all<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this distributed SQL tutorial, you&#8217;ve learned how to set up and experiment with a fully functional TiDB distributed database environment on your local machine. Using TiUP Playground, you:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gained hands-on experience with TiDB&#8217;s core architecture components: TiDB servers for SQL processing, TiKV for distributed storage, and PD for cluster coordination<\/li>\n\n\n\n<li>Mastered basic TiUP commands to manage and control your local cluster<\/li>\n\n\n\n<li>Set up a development environment<\/li>\n\n\n\n<li>Created a sample weather monitoring application<\/li>\n\n\n\n<li>Explored monitoring capabilities and real-time scaling<\/li>\n\n\n\n<li>Learned how to scale your cluster by adding or removing TiDB and TiKV nodes and load balancing with TiProxy<\/li>\n\n\n\n<li>Added analytical processing with TiFlash<\/li>\n<\/ul>\n\n\n\n<p>You now have the foundation to continue exploring TiDB&#8217;s capabilities for both transactional and analytical workloads.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Next_Steps\"><\/span>Next Steps<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Continue your learning journey! Whether you&#8217;re interested in development, operations, or data analytics, check out our comprehensive resources for additional distributed SQL tutorials, guides, and insights.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Need Help?<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TiDB AI (<a href=\"https:\/\/tidb.ai\">tidb.ai<\/a>) &#8211; get instant, accurate answers about any TiDB topic, with cited sources from our documentation and community resources<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Developer Resources<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/tidbcloud.com\">TiDB Cloud Serverless<\/a> &#8211; create a free account, play with AI capabilities<\/li>\n\n\n\n<li><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/dev-guide-overview\">Developer Guide<\/a> &#8211; guides by popular languages, frameworks, and tools<\/li>\n\n\n\n<li><a href=\"https:\/\/www.pingcap.com\/education\/?#developer-courses\">TiDB Education Developer Courses<\/a> &#8211; free self-paced courses<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Operations Resources<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/production-deployment-using-tiup\">Deploy a TiDB Cluster Using TiUP<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/tidb-in-kubernetes\">Deploy a TiDB Cluster on Kubernetes<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/quick-start-with-dm\">Migrate from MySQL-compatible databases to TiDB<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/sql-statement-import-into\">Import Data from Files<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/deploy-ticdc\">Data Streaming and Change Data Capture with TiCDC<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.pingcap.com\/education\/?#database-operation-courses\">TiDB Education Operations Courses<\/a> &#8211; deep dive into operations and get certified<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Data Analytics Resources<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.pingcap.com\/tidb\/stable\/quick-start-with-htap\">Use TiFlash for HTAP<\/a><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Community Resources<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/slack.tidb.io\/invite?team=tidb-community&amp;channel=everyone&amp;ref=pingcap\">Join the TiDB Community on Slack<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/discord.com\/invite\/vYU9h56kAX\">Join the TiDB Community on Discord<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/pingcap\/tidb\">GitHub<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>TiDB is a powerful, open-source distributed SQL database built for handling both transactional and analytical workloads. With its MySQL compatibility, horizontal scalability, and real-time HTAP capabilities, it\u2019s designed for modern, cloud-native architectures. In this distributed SQL tutorial, we&#8217;ll walk you through setting up a local TiDB cluster for development and testing in just a few [&hellip;]<\/p>\n","protected":false},"author":285,"featured_media":24818,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ub_ctt_via":"","footnotes":""},"categories":[436],"tags":[147,246,111,52,22],"class_list":["post-24809","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial","tag-distributed-sql","tag-horizontal-scalability","tag-tidb","tag-tiflash","tag-tikv"],"acf":[],"featured_image_src":"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png","author_info":{"display_name":"Airton Lastori","author_link":"https:\/\/www.pingcap.com\/ko\/blog\/author\/alastori\/"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Distributed SQL Tutorial: How to Set Up TiDB Locally<\/title>\n<meta name=\"description\" content=\"In this distributed SQL tutorial, discover how to set up a local TiDB cluster for development and testing in just a few simple steps.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pingcap.com\/ko\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Distributed SQL Tutorial: How to Set Up TiDB Locally\" \/>\n<meta property=\"og:description\" content=\"In this distributed SQL tutorial, discover how to set up a local TiDB cluster for development and testing in just a few simple steps.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pingcap.com\/ko\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/\" \/>\n<meta property=\"og:site_name\" content=\"TiDB\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/pingcap2015\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-10T16:31:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-09T16:44:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/static.pingcap.com\/files\/2025\/01\/09142849\/tidb_1200x627-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1254\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Airton Lastori\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/static.pingcap.com\/files\/2025\/01\/09142904\/tidb_twitter_1600x900-1.png\" \/>\n<meta name=\"twitter:creator\" content=\"@PingCAP\" \/>\n<meta name=\"twitter:site\" content=\"@PingCAP\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Airton Lastori\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/\"},\"author\":{\"name\":\"Airton Lastori\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/0c56cc38fb130e361408086496eca5cd\"},\"headline\":\"Kickstart Your Distributed SQL Journey: Setting Up TiDB Locally with TiUP Playground\",\"datePublished\":\"2025-01-10T16:31:43+00:00\",\"dateModified\":\"2026-01-09T16:44:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/\"},\"wordCount\":2568,\"publisher\":{\"@id\":\"https:\/\/www.pingcap.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png\",\"keywords\":[\"Distributed SQL\",\"Horizontal Scalability\",\"TiDB\",\"TiFlash\",\"TiKV\"],\"articleSection\":[\"Tutorial\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/\",\"url\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/\",\"name\":\"Distributed SQL Tutorial: How to Set Up TiDB Locally\",\"isPartOf\":{\"@id\":\"https:\/\/www.pingcap.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png\",\"datePublished\":\"2025-01-10T16:31:43+00:00\",\"dateModified\":\"2026-01-09T16:44:14+00:00\",\"description\":\"In this distributed SQL tutorial, discover how to set up a local TiDB cluster for development and testing in just a few simple steps.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#primaryimage\",\"url\":\"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png\",\"width\":3600,\"height\":1200},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pingcap.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Kickstart Your Distributed SQL Journey: Setting Up TiDB Locally with TiUP Playground\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pingcap.com\/#website\",\"url\":\"https:\/\/www.pingcap.com\/\",\"name\":\"TiDB\",\"description\":\"TiDB | SQL at Scale\",\"publisher\":{\"@id\":\"https:\/\/www.pingcap.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pingcap.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pingcap.com\/#organization\",\"name\":\"PingCAP\",\"url\":\"https:\/\/www.pingcap.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png\",\"width\":811,\"height\":232,\"caption\":\"PingCAP\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/pingcap2015\",\"https:\/\/x.com\/PingCAP\",\"https:\/\/linkedin.com\/company\/pingcap\",\"https:\/\/youtube.com\/channel\/UCuq4puT32DzHKT5rU1IZpIA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/0c56cc38fb130e361408086496eca5cd\",\"name\":\"Airton Lastori\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg\",\"caption\":\"Airton Lastori\"},\"url\":\"https:\/\/www.pingcap.com\/ko\/blog\/author\/alastori\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Distributed SQL Tutorial: How to Set Up TiDB Locally","description":"In this distributed SQL tutorial, discover how to set up a local TiDB cluster for development and testing in just a few simple steps.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pingcap.com\/ko\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/","og_locale":"ko_KR","og_type":"article","og_title":"Distributed SQL Tutorial: How to Set Up TiDB Locally","og_description":"In this distributed SQL tutorial, discover how to set up a local TiDB cluster for development and testing in just a few simple steps.","og_url":"https:\/\/www.pingcap.com\/ko\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/","og_site_name":"TiDB","article_publisher":"https:\/\/facebook.com\/pingcap2015","article_published_time":"2025-01-10T16:31:43+00:00","article_modified_time":"2026-01-09T16:44:14+00:00","og_image":[{"width":2400,"height":1254,"url":"https:\/\/static.pingcap.com\/files\/2025\/01\/09142849\/tidb_1200x627-1.png","type":"image\/png"}],"author":"Airton Lastori","twitter_card":"summary_large_image","twitter_image":"https:\/\/static.pingcap.com\/files\/2025\/01\/09142904\/tidb_twitter_1600x900-1.png","twitter_creator":"@PingCAP","twitter_site":"@PingCAP","twitter_misc":{"Written by":"Airton Lastori","Est. reading time":"17\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#article","isPartOf":{"@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/"},"author":{"name":"Airton Lastori","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/0c56cc38fb130e361408086496eca5cd"},"headline":"Kickstart Your Distributed SQL Journey: Setting Up TiDB Locally with TiUP Playground","datePublished":"2025-01-10T16:31:43+00:00","dateModified":"2026-01-09T16:44:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/"},"wordCount":2568,"publisher":{"@id":"https:\/\/www.pingcap.com\/#organization"},"image":{"@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#primaryimage"},"thumbnailUrl":"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png","keywords":["Distributed SQL","Horizontal Scalability","TiDB","TiFlash","TiKV"],"articleSection":["Tutorial"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/","url":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/","name":"Distributed SQL Tutorial: How to Set Up TiDB Locally","isPartOf":{"@id":"https:\/\/www.pingcap.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#primaryimage"},"image":{"@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#primaryimage"},"thumbnailUrl":"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png","datePublished":"2025-01-10T16:31:43+00:00","dateModified":"2026-01-09T16:44:14+00:00","description":"In this distributed SQL tutorial, discover how to set up a local TiDB cluster for development and testing in just a few simple steps.","breadcrumb":{"@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/"]}]},{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#primaryimage","url":"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png","contentUrl":"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png","width":3600,"height":1200},{"@type":"BreadcrumbList","@id":"https:\/\/www.pingcap.com\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pingcap.com\/"},{"@type":"ListItem","position":2,"name":"Kickstart Your Distributed SQL Journey: Setting Up TiDB Locally with TiUP Playground"}]},{"@type":"WebSite","@id":"https:\/\/www.pingcap.com\/#website","url":"https:\/\/www.pingcap.com\/","name":"\ud2f0DB","description":"TiDB | SQL at Scale","publisher":{"@id":"https:\/\/www.pingcap.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pingcap.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.pingcap.com\/#organization","name":"PingCAP","url":"https:\/\/www.pingcap.com\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/","url":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","contentUrl":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","width":811,"height":232,"caption":"PingCAP"},"image":{"@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/pingcap2015","https:\/\/x.com\/PingCAP","https:\/\/linkedin.com\/company\/pingcap","https:\/\/youtube.com\/channel\/UCuq4puT32DzHKT5rU1IZpIA"]},{"@type":"Person","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/0c56cc38fb130e361408086496eca5cd","name":"Airton Lastori","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/image\/","url":"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg","contentUrl":"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg","caption":"Airton Lastori"},"url":"https:\/\/www.pingcap.com\/ko\/blog\/author\/alastori\/"}]}},"grav_blocks":false,"card_markup":"<a class=\"card-resource bg-white\" href=\"https:\/\/www.pingcap.com\/ko\/blog\/distributed-sql-tutorial-first-steps-setting-up-tidb-locally\/\"><div class=\"card-resource__image-container\"><img class=\"card-resource__image\" alt=\"tidb_feature_1800x600 (1)\" src=\"https:\/\/static.pingcap.com\/files\/2025\/01\/09142829\/tidb_feature_1800x600-1.png\" loading=\"lazy\" width=3600 height=1200 \/><\/div><div class=\"card-resource__content-container\"><div class=\"card-resource__content-head\"><div class=\"card-resource__category\">Tutorial<\/div><\/div><h5 class=\"card-resource__title\">Kickstart Your Distributed SQL Journey: Setting Up TiDB Locally with TiUP Playground<\/h5><\/div><\/a>","_links":{"self":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/24809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/users\/285"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/comments?post=24809"}],"version-history":[{"count":16,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/24809\/revisions"}],"predecessor-version":[{"id":30474,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/24809\/revisions\/30474"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/media\/24818"}],"wp:attachment":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/media?parent=24809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/categories?post=24809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/tags?post=24809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}