何隆昌 docker部署TiDB

docker部署TiDB

https://docs.pingcap.com/zh/tidb/stable/quick-start-with-tidb#在单机上模拟部署生产环境集群

1、下载并安装 TiUP。

java 复制代码
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh    会在当目录生成两个文件夹:tidb-data,卸载的时候记得删除

2、声明全局环境变量:
source /root/.bash_profile  (隐藏文件)

安装 TiUP 的 cluster 组件:


tiup cluster

如果机器已经安装 TiUP cluster,需要更新软件版本:

tiup update --self && tiup update cluster
由于模拟多机部署,需要通过 root 用户调大 sshd 服务的连接数限制:

修改 /etc/ssh/sshd_config 将 MaxSessions 调至 20。

重启 sshd 服务:

service sshd restart

执行集群部署命令:
tiup cluster deploy tidb_cluster v7.1.2 ./topo.yaml --user root -p YThx@198201

启动集群:
tiup cluster start tidb_cluster    这里经常报错:最少要6个G,而且连接要关闭防火墙(systemctl stop firewalld.service)或者打开端口  firewall-cmd --zone=public --add-port=4000/tcp --permanent
停止集群:
tiup cluster stop tidb_cluster


tiup cluster clean tidb_cluster --all

要删除 TiDB 集群,您可以执行以下步骤:

停止 TiDB 集群:使用 tiup cluster stop tidb_cluster 命令停止 TiDB 集群,确保所有的 TiDB、TiKV 和 PD 进程都已停止运行。

卸载 TiDB 集群:使用 tiup cluster destroy tidb_cluster 命令卸载 TiDB 集群,这将删除 TiDB 集群的所有组件、数据和配置。

必须输入   Yes, I know my cluster and data will be deleted.     包括后面的. 才能删除

还要记得之前下载的 tidb-data等物理文件


cp id_rsa /root/.tiup/storage/cluster/clusters/tidb_cluster/ssh/id_rsa




访问 TiDB 数据库,密码为空:
mysql -h 10.0.1.1 -P 4000 -u root
相关推荐
Ha_To1 天前
2026.1.28 docker安装
运维·docker·容器
北极熊~~1 天前
emqx持久化 Docker 容器中生成的数据并打包新镜像,迁移至新机器运行
运维·docker·容器
tomiatomia1 天前
MinIO docker 部署使用的几个坑
运维·docker·容器
杨浦老苏1 天前
Docker方式安装你的私人AI电脑助手Moltbot
人工智能·docker·ai·群晖
x70x801 天前
# Docker 搭建 MySQL 8 主从复制(踩坑实录 + 完整验证)
mysql·docker·容器
qq_316837751 天前
docker 运行 cn_clip
运维·docker·容器
木卫二号Coding1 天前
Docker-构建自己的Web-Linux系统-Ubuntu:22.04
linux·前端·docker
春日见1 天前
win11 分屏设置
java·开发语言·驱动开发·docker·单例模式·计算机外设
岳来1 天前
网络小白理解容器网络endpointid
网络·docker·endpoint
江湖有缘1 天前
轻量级知识协作平台搭建:Docker + MediaWiki入门教程
docker·容器·eureka