Deploying TiDB on Four Machines

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 四台机子部署tidb

| username: 烂番薯0

Is this allocation reasonable?

| username: 会飞的土拨鼠 | Original post link

It feels like there are relatively few resources. TiDB can also be set up with 3 nodes, right? 3 TiDB, TiKV, and PD.

| username: 会飞的土拨鼠 | Original post link

If it’s a testing environment, you can try
tidb, tikv, pd
tidb, tikv, pd
tidb, tikv, pd, tiflash
monitoring, tiflash

| username: Kongdom | Original post link

If there is no massive analysis, you can skip deploying TiFlash nodes.

| username: 烂番薯0 | Original post link

Yes, the resources are indeed quite limited, but these are the only ones.

| username: Jiawei | Original post link

What was said above is correct. If you don’t have massive data analysis needs, there’s no need to deploy TiFlash. Otherwise, TiFlash and TiKV will have serious resource competition issues. If you’re just experimenting, you can limit the memory usage of each component.

| username: 我是咖啡哥 | Original post link

For a testing environment, I would prefer to divide it like this:

  • tidb, pd, monitoring
  • tikv
  • tikv
  • tikv
    This way, the tidb node doesn’t need too much storage.
    If tiflash is needed, place it on the tikv node.

If considering high availability:

  • tidb, pd, monitoring
  • tikv, tidb, pd
  • tikv, tidb, pd
  • tikv, tiflash
    tiflash generally doesn’t need high availability. Testing with one replica is sufficient.
| username: 烂番薯0 | Original post link

Boss, if a TiDB node goes down, how can it automatically switch to another node? Do we need to configure keepalived to achieve high availability?

| username: xingzhenxiang | Original post link

Testing is fine, but if it’s for production, there’s no need to use TiFlash with such limited resources.

| username: 烂番薯0 | Original post link

Okay, thank you. Should I set up a keepalived for this?

| username: 啦啦啦啦啦 | Original post link

All load balancing components can be used. HAProxy, Keepalived, etc. If you have an LB, that works too.

| username: 烂番薯0 | Original post link

Boss, if TiFlash is deployed on a separate node, can this resource contention issue be resolved?

| username: tidb菜鸟一只 | Original post link

That should definitely be fine. It’s best not to deploy TiFlash and TiKV on the same node.

| username: 会飞的土拨鼠 | Original post link

Load balancing components, such as Nginx and HAProxy. Previously, we used Nginx, which can configure the access weight for each TiDB node.

| username: zhouzeru | Original post link

If there is no need for massive analysis, TiFlash can be disregarded.

| username: TI表弟 | Original post link

It is recommended to use separate nodes. Unless the machine configuration is particularly high, do not deploy them together.

| username: Running | Original post link

TiFlash can use a single node.

| username: Jiawei | Original post link

Of course, it is possible. It is best to deploy TiFlash on a separate machine.

| username: 考试没答案 | Original post link

Is this a production environment???

| username: tracy0984 | Original post link

You can consider connecting to TiDB through HAProxy, so that all TiDB server nodes can be used normally. If you use Keepalived, only one TiDB server will be able to provide services externally, which is not recommended.