https://pingcap.com/docs-cn/stable/deploy-test-cluster-using-docker-compose/
一、快速部署
1、下载 tidb-docker-compose
git clone https://github.com/pingcap/tidb-docker-compose.git
2、创建并启动集群
获取最新 Docker 镜像:
docker-compose pull
$ docker-compose up -d
3、访问集群:
$ mysql -h 127.0.0.1 -P 4000 -u root
4、访问集群 Grafana 监控页面:http://localhost:3000 默认用户名和密码均为 admin。
5、集群数据可视化(https://github.com/pingcap/tidb-vision):http://localhost:8010
访问 Spark shell 并加载 TiSpark
1、向 TiDB 集群中插入一些样本数据:
$ docker-compose exec tispark-master bash &&
cd /opt/spark/data/tispark-sample-data &&
mysql -h tidb -P 4000 -u root < dss.ddl
2、当样本数据加载到 TiDB 集群之后,可以使用 docker-compose exec tispark-master /opt/spark/bin/spark-shell 来访问 Spark shell。
$ docker-compose exec tispark-master /opt/spark/bin/spark-shell
scala> import org.apache.spark.sql.TiContext
...
scala> val ti = new TiContext(spark)
...
scala> ti.tidbMapDatabase("TPCH_001")
...
scala> spark.sql("select count(*) from lineitem").show
3、通过 Python 或 R 来访问 Spark:
docker-compose exec tispark-master /opt/spark/bin/pyspark &&
docker-compose exec tispark-master /opt/spark/bin/sparkR
网友评论