What is the concept of TiDB instances? How should I connect to it?

Note that this question was originally posted on the Chinese TiDB Forum. We copied it here to help new users solve their problems quickly.

Application environment:

Test environment

TiDB version:

TiDB v6.0.0


I started two TiDB servers and three TiKV servers. The data read from both TiDB servers is the same. Do I need to connect two TiDB servers and then do load balancing? Which TiDB server should I connect to in the application layer?

TiDB Server is stateless, connecting to any of them is possible. For your reference, you can read this doc about TiDB architecture:TiDB Architecture | PingCAP Docs

You can also do load balancing to achieve high availability. Haproxy, F5, SLB/CLB, Weir, etc. can be used as load balance middleware. Here is a doc about the best practices for using HAProxy in TiDB: Best Practices for Using HAProxy in TiDB | PingCAP Docs