Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: TiDB直接部署在Docker上是否可以
【TiDB Usage Environment】: Production
【TiDB Version】: 5.0-5.2.2
【Architecture Consultation】:
Question: Can TiDB be directly deployed in Docker?
Can an empty container be directly deployed and TiDB services be deployed using tiup?
Since TiDB needs to be managed using systemctl, Docker super privileges are required, and it needs:
<1> Enable systemd
<2> Add parameters when running Docker: docker run -tid --privileged centos /usr/sbin/init
Is this sufficient?
Will there be any operational issues?
There are many cases of deploying TiDB
on private clouds. The most well-known in the community is Xiaomi’s TiDB
cluster, which is deployed on k8s
and managed using tidb operator
.
Column - TiDB’s Implementation and Cloud-Native Exploration at Xiaomi | TiDB Community
【Presentation Materials Download】See How Digital China, Xiaomi, Douyu, and ShardingSphere Play with Open Source Data Architecture - TiDB Community Events / Event Review - TiDB Q&A Community (asktug.com)
This contains the cloud deployment solutions introduced by Xiaomi at that time.
You are already running centos
in docker
, so there is no difference from running multiple virtual machines to deploy TiDB
.
The official documentation for general machines basically allows for one-click deployment. I haven’t used Docker. I feel that the native method is still better. After all, containers are for quick deployment, and the official method has already achieved that. Databases are not like stateless applications such as Tomcat, where it doesn’t matter much. If you can avoid putting the database in a container, it’s better not to.
You can refer to the k8s deployment plan.