Skip to content

Commit

Permalink
*: add TiKV overview, installation, and client driver (#472)
Browse files Browse the repository at this point in the history
* *: add TiKV Quick Start Guide

* tikv: update code display effect

* tikv: update the ParseInt code

* tikv: fix a step typo

* tikv: update wording

* tikv, readme: reorganize TiKV documents

* tikv, readme: reorganize the structure and update content based on comments

* tikv, readme: add Install TiKV Using Docker Compose

* tikv: add two links to API usage

* tikv, readme: update file name and readme

* tikv: update wording

* tikv: update two links
  • Loading branch information
lilin90 authored and QueenyJin committed May 31, 2018
1 parent c95ac05 commit aab3991
Show file tree
Hide file tree
Showing 6 changed files with 568 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@
- [PD Control](tools/pd-control.md)
- [TiKV Control](tools/tikv-control.md)
- [TiDB Controller](tools/tidb-controller.md)
+ TiSpark
+ TiKV Documentation
- [Overview](tikv/tikv-overview.md)
+ Install and Deploy TiKV
- [Prerequisites](op-guide/recommendation.md)
- [Install and Deploy TiKV Using Docker Compose](tikv/deploy-tikv-docker-compose.md)
- [Install and Deploy TiKV Using Binary Files](tikv/deploy-tikv-using-binary.md)
+ Client Drivers
- [Go](tikv/go-client-api.md)
+ TiSpark Documentation
- [Quick Start Guide](tispark/tispark-quick-start-guide.md)
- [User Guide](tispark/tispark-user-guide.md)
- [Frequently Asked Questions (FAQ)](FAQ.md)
Expand Down
Binary file added media/tikv_stack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions tikv/deploy-tikv-docker-compose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Install and Deploy TiKV Using Docker Compose
category: user guide
---

# Install and Deploy TiKV Using Docker Compose

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.

## Prerequisites

- Install Docker and Docker Compose.

```
sudo yum install docker docker-compose
```

- Install Helm.

```
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
```

## Install and deploy

1. Download `tidb-docker-compose`.

```
git clone https://github.com/pingcap/tidb-docker-compose.git
```

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

```
cd tidb-docker-compose/compose
networkMode: host
```

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

```
helm template compose > generated-docker-compose.yml
```

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

```
docker-compose -f generated-docker-compose.yml up -d
```

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

```
curl localhost:2379/pd/api/v1/stores
```

If the state of all the TiKV instances is "Up", you have successfully deployed a TiKV cluster.
148 changes: 148 additions & 0 deletions tikv/deploy-tikv-using-binary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
---
title: Install and Deploy TiKV Using Binary Files
category: user guide
---

# Install and Deploy TiKV Using Binary Files

This guide describes how to deploy a TiKV cluster using binary files.

- To quickly understand and try TiKV, see [Deploy the TiKV cluster on a single machine](#deploy-the-tikv-cluster-on-a-single-machine).
- To try TiKV out and explore the features, see [Deploy the TiKV cluster on multiple nodes for test](#deploy-the-tikv-cluster-on-multiple-nodes-for-test).

## Deploy the TiKV cluster on a single machine

This section describes how to deploy TiKV on a single machine installed with the Linux system. Take the following steps:

1. Download the official binary package.

```bash
# Download the package.
wget https://download.pingcap.org/tidb-latest-linux-amd64.tar.gz
wget http://download.pingcap.org/tidb-latest-linux-amd64.sha256

# Check the file integrity. If the result is OK, the file is correct.
sha256sum -c tidb-latest-linux-amd64.sha256

# Extract the package.
tar -xzf tidb-latest-linux-amd64.tar.gz
cd tidb-latest-linux-amd64
```

2. Start PD.

```bash
./bin/pd-server --name=pd1 \
--data-dir=pd1 \
--client-urls="http://127.0.0.1:2379" \
--peer-urls="http://127.0.0.1:2380" \
--initial-cluster="pd1=http://127.0.0.1:2380" \
--log-file=pd1.log
```

3. Start TiKV.

To start the 3 TiKV instances, open a new terminal tab or window, come to the `tidb-latest-linux-amd64` directory, and start the instances using the following command:

```bash
./bin/tikv-server --pd-endpoints="127.0.0.1:2379" \
--addr="127.0.0.1:20160" \
--data-dir=tikv1 \
--log-file=tikv1.log
./bin/tikv-server --pd-endpoints="127.0.0.1:2379" \
--addr="127.0.0.1:20161" \
--data-dir=tikv2 \
--log-file=tikv2.log
./bin/tikv-server --pd-endpoints="127.0.0.1:2379" \
--addr="127.0.0.1:20162" \
--data-dir=tikv3 \
--log-file=tikv3.log
```

You can use the [pd-ctl](https://github.com/pingcap/pd/tree/master/pdctl) tool to verify whether PD and TiKV are successfully deployed:

```
./bin/pd-ctl store -d -u http://127.0.0.1:2379
```
If the state of all the TiKV instances is "Up", you have successfully deployed a TiKV cluster.
## Deploy the TiKV cluster on multiple nodes for test
This section describes how to deploy TiKV on multiple nodes. If you want to test TiKV with a limited number of nodes, you can use one PD instance to test the entire cluster.
Assume that you have four nodes, you can deploy 1 PD instance and 3 TiKV instances. For details, see the following table:
| Name | Host IP | Services |
| :-- | :-- | :------------------- |
| Node1 | 192.168.199.113 | PD1 |
| Node2 | 192.168.199.114 | TiKV1 |
| Node3 | 192.168.199.115 | TiKV2 |
| Node4 | 192.168.199.116 | TiKV3 |
To deploy a TiKV cluster with multiple nodes for test, take the following steps:
1. Download the official binary package on each node.
```bash
# Download the package.
wget https://download.pingcap.org/tidb-latest-linux-amd64.tar.gz
wget http://download.pingcap.org/tidb-latest-linux-amd64.sha256
# Check the file integrity. If the result is OK, the file is correct.
sha256sum -c tidb-latest-linux-amd64.sha256
# Extract the package.
tar -xzf tidb-latest-linux-amd64.tar.gz
cd tidb-latest-linux-amd64
```

2. Start PD on Node1.

```bash
./bin/pd-server --name=pd1 \
--data-dir=pd1 \
--client-urls="http://192.168.199.113:2379" \
--peer-urls="http://192.168.199.113:2380" \
--initial-cluster="pd1=http://192.168.199.113:2380" \
--log-file=pd1.log
```

3. Log in and start TiKV on other nodes: Node2, Node3 and Node4.

Node2:

```bash
./bin/tikv-server --pd-endpoints="192.168.199.113:2379" \
--addr="192.168.199.114:20160" \
--data-dir=tikv1 \
--log-file=tikv1.log
```

Node3:

```bash
./bin/tikv-server --pd-endpoints="192.168.199.113:2379" \
--addr="192.168.199.115:20160" \
--data-dir=tikv2 \
--log-file=tikv2.log
```

Node4:

```bash
./bin/tikv-server --pd-endpoints="192.168.199.113:2379" \
--addr="192.168.199.116:20160" \
--data-dir=tikv3 \
--log-file=tikv3.log
```

You can use the [pd-ctl](https://github.com/pingcap/pd/tree/master/pdctl) tool to verify whether PD and TiKV are successfully deployed:

```
./pd-ctl store -d -u http://192.168.199.113:2379
```
The result displays the store count and detailed information regarding each store. If the state of all the TiKV instances is "Up", you have successfully deployed a TiKV cluster.
Loading

0 comments on commit aab3991

Please sign in to comment.