目标 :
单机上通过 Docker Compose 快速一键部署一套 TiDB 测试集群
前提条件:
1.centos版本在7.3 以上
2.安装git
3.安装docker
Docker version 18.06.1-ce, build e68fc7a
4.安装docker-compose
docker-compose version 1.22.0, build f46880fe
开始安装
1.下载 tidb-docker-compose
git clone https://github.com/pingcap/tidb-docker-compose.git
2.会在本地创建一个tidb-docker-compose 目录
3.进入该目录执行命令
获取最新的 docker 镜像文件。
docker-compose pull
Pulling pd0 ... done
Pulling pd1 ... done
Pulling pd2 ... done
Pulling tikv0 ... done
Pulling tikv1 ... done
Pulling tikv2 ... done
Pulling tidb ... done
Pulling tispark-master ... done
Pulling tispark-slave0 ... done
Pulling tidb-vision ... done
Pulling pushgateway ... done
Pulling prometheus ... done
Pulling grafana ... done
Pulling dashboard-installer ... done
执行 docker images
pingcap/pd latest ff07b5b3637e 4 days ago 72.2MB
pingcap/tikv latest 552ec3d0b077 4 days ago 166MB
pingcap/tidb latest 70a05caec1ee 4 days ago 56.5MB
python 3.4-alpine 90d3f9764c4d 3 weeks ago 65.8MB
pingcap/tidb-dashboard-installer v2.0.0 525237773def 7 weeks ago 62MB
pingcap/tispark latest aa044a92789b 2 months ago 793MB
pingcap/tidb-vision latest e9b25d9f7bdb 5 months ago 47.6MB
prom/prometheus v2.2.1 cc866859f8df 6 months ago 113MB
grafana/grafana 4.6.3 5d1d85717268 9 months ago 284MB
prom/pushgateway v0.3.1 434efa6ed9db 23 months ago 13.3MB
4.创建并启动集群
执行命令
docker-compose up -d
5.测试访问 tidb
mysql -h 127.0.0.1 -P 4000 -u root
后面的操作和mysql 是一样的。