Skip to content

Commit 6c4d135

Browse files
authored
op-guide, tikv: update docker compose deployment (#496)
* op-guide, tikv: update docker compose deployment Via: pingcap/tidb-docker-compose#25 * op-guide: add the TiSpark section * op-guide: add a 5-minute tutorial link * op-guide: update wording
1 parent 60dae22 commit 6c4d135

File tree

2 files changed

+82
-17
lines changed

2 files changed

+82
-17
lines changed

op-guide/docker-compose.md

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
---
22
title: TiDB Docker Compose Deployment
3+
summary: Deploy a TiDB testing cluster with a single command using Docker Compose.
34
category: operations
45
---
56

67
# TiDB Docker Compose Deployment
78

8-
This document describes how to quickly deploy TiDB using [Docker Compose](https://docs.docker.com/compose/overview).
9+
This document describes how to quickly deploy a TiDB testing cluster with a single command using [Docker Compose](https://docs.docker.com/compose/overview).
910

1011
With Docker Compose, you can use a YAML file to configure application services in multiple containers. Then, with a single command, you can create and start all the services from your configuration.
1112

12-
You can use Docker Compose to deploy a TiDB test cluster with a single command. It is required to use Docker 17.06.0 or later.
13+
## Prerequisites
14+
15+
Make sure you have installed the following items on your machine:
16+
17+
- Docker (17.06.0 or later)
18+
- Docker Compose
19+
- Git
1320

1421
## Deploy TiDB using Docker Compose
1522

@@ -22,7 +29,8 @@ You can use Docker Compose to deploy a TiDB test cluster with a single command.
2229
2. Create and start the cluster.
2330

2431
```bash
25-
cd tidb-docker-compose && docker-compose up -d
32+
cd tidb-docker-compose && docker-compose pull # Get the latest Docker images
33+
docker-compose up -d
2634
```
2735

2836
3. Access the cluster.
@@ -59,7 +67,7 @@ To customize the cluster, you can edit the `docker-compose.yml` file directly. I
5967

6068
For macOS, you can also install Helm using the following command in Homebrew:
6169

62-
```
70+
```bash
6371
brew install kubernetes-helm
6472
```
6573

@@ -77,7 +85,7 @@ To customize the cluster, you can edit the `docker-compose.yml` file directly. I
7785
vim values.yaml
7886
```
7987

80-
Modify the configuration in `values.yaml`, such as the cluster size, TiDB image version, and so on.
88+
You can modify the configuration in `values.yaml`, such as the cluster size, TiDB image version, and so on.
8189

8290
[tidb-vision](https://github.com/pingcap/tidb-vision) is the data visualization interface of the TiDB cluster, used to visually display the PD scheduling on TiKV data. If you do not need this component, leave `tidbVision` empty.
8391

@@ -96,6 +104,7 @@ To customize the cluster, you can edit the `docker-compose.yml` file directly. I
96104
5. Create and start the cluster using the generated `docker-compose.yml` file.
97105

98106
```bash
107+
docker-compose -f generated-docker-compose.yaml pull # Get the latest Docker images
99108
docker-compose -f generated-docker-compose.yml up -d
100109
```
101110

@@ -111,4 +120,48 @@ To customize the cluster, you can edit the `docker-compose.yml` file directly. I
111120
- Default account name: admin
112121
- Default password: admin
113122

114-
If tidb-vision is enabled, you can access the cluster data visualization interface: <http://localhost:8010>.
123+
If tidb-vision is enabled, you can access the cluster data visualization interface: <http://localhost:8010>.
124+
125+
## Access the Spark shell and load TiSpark
126+
127+
Insert some sample data to the TiDB cluster:
128+
129+
```bash
130+
$ docker-compose exec tispark-master bash
131+
$ cd /opt/spark/data/tispark-sample-data
132+
$ mysql -h tidb -P 4000 -u root < dss.ddl
133+
```
134+
135+
After the sample data is loaded into the TiDB cluster, you can access the Spark shell using `docker-compose exec tispark-master /opt/spark/bin/spark-shell`.
136+
137+
```bash
138+
$ docker-compose exec tispark-master /opt/spark/bin/spark-shell
139+
...
140+
Spark context available as 'sc' (master = local[*], app id = local-1527045927617).
141+
Spark session available as 'spark'.
142+
Welcome to
143+
____ __
144+
/ __/__ ___ _____/ /__
145+
_\ \/ _ \/ _ `/ __/ '_/
146+
/___/ .__/\_,_/_/ /_/\_\ version 2.1.1
147+
/_/
148+
149+
Using Scala version 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_172)
150+
Type in expressions to have them evaluated.
151+
Type :help for more information.
152+
153+
scala> import org.apache.spark.sql.TiContext
154+
...
155+
scala> val ti = new TiContext(spark)
156+
...
157+
scala> ti.tidbMapDatabase("TPCH_001")
158+
...
159+
scala> spark.sql("select count(*) from lineitem").show
160+
+--------+
161+
|count(1)|
162+
+--------+
163+
| 60175|
164+
+--------+
165+
```
166+
167+
Here is [a 5-minute tutorial](https://www.pingcap.com/blog/how_to_spin_up_an_htap_database_in_5_minutes_with_tidb_tispark/) for macOS users that shows how to spin up a standard TiDB cluster using Docker Compose on your local computer.

tikv/deploy-tikv-docker-compose.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,68 @@
11
---
22
title: Install and Deploy TiKV Using Docker Compose
3-
category: user guide
3+
summary: Quickly deploy a TiKV testing cluster using Docker Compose.
4+
category: operations
45
---
56

67
# Install and Deploy TiKV Using Docker Compose
78

8-
This guide describes how to quickly deploy a TiKV cluster using [Docker Compose](https://github.com/pingcap/tidb-docker-compose/). Currently, this installation method only supports the Linux system.
9+
This guide describes how to quickly deploy a TiKV testing cluster using [Docker Compose](https://github.com/pingcap/tidb-docker-compose/).
10+
11+
> **Note:** Currently, this installation method only supports the Linux system.
912
1013
## Prerequisites
1114

12-
- Install Docker and Docker Compose.
15+
Make sure you have installed the following items on your machine:
1316

14-
```
17+
- Docker (17.06.0 or later) and Docker Compose
18+
19+
```bash
1520
sudo yum install docker docker-compose
1621
```
1722

18-
- Install Helm.
23+
- Helm
1924

20-
```
25+
```bash
2126
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
2227
```
2328

29+
- Git
30+
31+
```
32+
sudo yum install git
33+
```
34+
2435
## Install and deploy
2536

2637
1. Download `tidb-docker-compose`.
2738

28-
```
39+
```bash
2940
git clone https://github.com/pingcap/tidb-docker-compose.git
3041
```
3142

3243
2. Edit the `compose/values.yaml` file to configure `networkMode` to `host` and comment the TiDB section out.
3344

34-
```
45+
```bash
3546
cd tidb-docker-compose/compose
3647
networkMode: host
3748
```
3849

3950
3. Generate the `generated-docker-compose.yml` file.
4051

41-
```
52+
```bash
4253
helm template compose > generated-docker-compose.yml
4354
```
4455

4556
4. Create and start the cluster using the `generated-docker-compose.yml` file.
4657

47-
```
58+
```bash
59+
docker-compose -f generated-docker-compose.yaml pull # Get the latest Docker images
4860
docker-compose -f generated-docker-compose.yml up -d
4961
```
5062

5163
You can check whether the TiKV cluster has been successfully deployed using the following command:
5264

53-
```
65+
```bash
5466
curl localhost:2379/pd/api/v1/stores
5567
```
5668

0 commit comments

Comments
 (0)