Placement driver for TiKV
Clone or download
nolouch Release v3.0.0-beta (#1413)
Signed-off-by: nolouch <nolouch@gmail.com>
Latest commit 56cff4a Jan 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github *: make pull request template more concise (#1220) Aug 29, 2018
client *: handle more errors properly (#1405) Jan 10, 2019
cmd/pd-server *: adjust the project layout (#1245) Sep 20, 2018
conf config: fix configs cannot set to zero values (#1334) Nov 22, 2018
docs scripts, docs: update api document (#1346) Nov 27, 2018
pkg *: add more coverage tests (#1395) Dec 27, 2018
scripts scripts, docs: update api document (#1346) Nov 27, 2018
server simulator: add case about import data (#1263) Jan 17, 2019
table simulator: add case about import data (#1263) Jan 17, 2019
tests *: handle more errors properly (#1405) Jan 10, 2019
tools simulator: add case about import data (#1263) Jan 17, 2019
.gitignore abandon vendor (#1337) Nov 26, 2018
.travis.yml switch to codecov (#1401) Dec 28, 2018
CHANGELOG.md Release v3.0.0-beta (#1413) Jan 18, 2019
CONTRIBUTING.md docs: add development.md to help new contributors (#1141) Jul 6, 2018
Dockerfile use a separate builder image and deploy in Alpine (#1285) Oct 23, 2018
Jenkinsfile Jenkinsfile: init adding Jenkinsfile (#643) May 15, 2017
LICENSE Add goreport and license. (#120) May 29, 2016
Makefile switch to codecov (#1401) Dec 28, 2018
README.md switch to codecov (#1401) Dec 28, 2018
circle.yml Makefile: update the coverage test (#1380) Dec 17, 2018
go.mod region-syncer: full synchronization of new member (#1349) Dec 29, 2018
go.sum region-syncer: full synchronization of new member (#1349) Dec 29, 2018
revive.toml revive linter: exit 1 on failure (#1217) Aug 28, 2018
tools.json switch to codecov (#1401) Dec 28, 2018

README.md

PD

TravisCI Build Status GitHub release CircleCI Build Status Go Report Card codecov

PD is the abbreviation for Placement Driver. It is used to manage and schedule the TiKV cluster.

PD supports distribution and fault-tolerance by embedding etcd.

Build

  1. Make sure Go (version 1.11+) is installed. For development, go 1.11.2+ is required.
  2. Use make to install PD. PD is installed in the bin directory.

Usage

Command flags

See configuration.

Single Node with default ports

You can run pd-server directly on your local machine, if you want to connect to PD from outside, you can let PD listen on the host IP.

# Set correct HostIP here. 
export HostIP="192.168.199.105"

pd-server --name="pd" \
          --data-dir="pd" \
          --client-urls="http://${HostIP}:2379" \
          --peer-urls="http://${HostIP}:2380" \
          --log-file=pd.log

Using curl to see PD member:

curl http://${HostIP}:2379/v2/members

{"members":[{"id":"f62e88a6e81c149","name":"pd","peerURLs":["http://192.168.199.105:2380"],"clientURLs":["http://192.168.199.105:2379"]}]}

A better tool httpie is recommended:

http http://${HostIP}:2379/v2/members
HTTP/1.1 200 OK
Content-Length: 144
Content-Type: application/json
Date: Thu, 21 Jul 2016 09:37:12 GMT
X-Etcd-Cluster-Id: 33dc747581249309

{
    "members": [
        {
            "clientURLs": [
                "http://192.168.199.105:2379"
            ], 
            "id": "f62e88a6e81c149", 
            "name": "pd", 
            "peerURLs": [
                "http://192.168.199.105:2380"
            ]
        }
    ]
}

Docker

You can use the following command to build a PD image directly:

docker build -t pingcap/pd .

Or you can also use following command to get PD from Docker hub:

docker pull pingcap/pd

Run a single node with Docker:

# Set correct HostIP here. 
export HostIP="192.168.199.105"

docker run -d -p 2379:2379 -p 2380:2380 --name pd pingcap/pd \
          --name="pd" \
          --data-dir="pd" \
          --client-urls="http://0.0.0.0:2379" \
          --advertise-client-urls="http://${HostIP}:2379" \
          --peer-urls="http://0.0.0.0:2380" \
          --advertise-peer-urls="http://${HostIP}:2380" \
          --log-file=pd.log

Cluster

PD is a component in TiDB project, you must run it with TiDB and TiKV together, see TiDB-Ansible to learn how to set up the cluster and run them.

You can also use Docker to run the cluster.