Get start with TiDB - Setup a sandbox in 5 minutes

25 Jun, 2021
Start TiDB in 1 min

To answer the question that what is TiDB, we briefly talked about NewSQL. So, the minimum expectation for a NewSQL database would be, it should run SQL. And the best way for (a person who always try to at least think as) a developer, I decided to give it a run~

Here is my reference for this tutorial.

Here are my questions when going through the tutorial so I think we’d better cover the concepts before diving in.

  • What is TiUP? TiUP is a tool for us to quickly and easily setup TiDB. It is something new since TiDB 4.0 and without it, I am not able to setup a TiDB within 10 minutes.
  • What is TiUP Playground? So, that’s a sandbox environment we can easily deploy and free to mess up with~ In the first couple of tutorials, this will be the environment we go with.
  • What are KVs, DBs, and PDs? We can temporarily ignore those terms for now. It is related to the architecture of TiDB and I will explain more when we come to understand the “distributed database” part.

Now it is Phoebe putting on her instructional design hat:

  1. Instruction said it currently does not support the Apple M1 chip. I Checked my Mac Overview info. I am using an Intel Chip. So I am good to go.
  2. Install curl command if needed and follow this tutorial.
  3. Download and install TiUP:

    curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh

  4. Declare the global environment variable:

    source ~/.profile

  5. Start the cluster in the current session:

    tiup playground v5.0.2 --db 2 --pd 3 --kv 3 --monitor

  6. Verify that you can see the cluster start successfully message.
  7. Install mysql using Brew:

    Brew install mysql

  8. Connect to mysql client

    mysql --host 127.0.0.1 --port 4000 -u root

Now we are good to go! In the next blog, we will explore the database and do some SQL fun.

© 2021 GEEK SG. All rights reserved.