Skip to content
Placement driver for TiKV
Branch: master
Clone or download
nolouch statistic: add the statistic of flow (#1548)
* store_statistic: add the statistic of flow

Signed-off-by: nolouch <nolouch@gmail.com>
Latest commit c44ddf4 May 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
client client, server: add ScanRegions gRPC protocol support (#1535) May 17, 2019
cmd/pd-server *: Start switching to the zap logger (#1422) Feb 14, 2019
conf
docs added the doc 'development-workflow.md' (#1464) Mar 20, 2019
pkg etcdutil: move kvGet to the uitl package (#1513) Apr 21, 2019
scripts *: replace gofail with pingcap/failpoint (#1534) May 15, 2019
server statistic: add the statistic of flow (#1548) May 22, 2019
table kv: LoadRange returns both keys and values (#1508) Apr 18, 2019
tests schedule: operator limit for stores (#1474) May 22, 2019
tools schedule: operator limit for stores (#1474) May 22, 2019
.gitignore *: Start switching to the zap logger (#1422) Feb 14, 2019
.travis.yml upgrade go to 1.12 (#1458) Mar 13, 2019
CHANGELOG.md Bump to v3.0.0-beta.1 (#1480) Mar 26, 2019
CONTRIBUTING.md added the doc 'development-workflow.md' (#1464) Mar 20, 2019
Dockerfile docker: add jq and cache dependencies (#1519) Apr 25, 2019
Jenkinsfile Jenkinsfile: init adding Jenkinsfile (#643) May 15, 2017
LICENSE Add goreport and license. (#120) May 29, 2016
Makefile *: replace gofail with pingcap/failpoint (#1534) May 15, 2019
README.md *: update some dead links (#1543) May 21, 2019
build.ps1 Add windows build script (#1540) May 21, 2019
circle.yml upgrade go to 1.12 (#1458) Mar 13, 2019
go.mod client, server: add ScanRegions gRPC protocol support (#1535) May 17, 2019
go.sum client, server: add ScanRegions gRPC protocol support (#1535) May 17, 2019
revive.toml revive linter: exit 1 on failure (#1217) Aug 28, 2018
tools.json *: replace gofail with pingcap/failpoint (#1534) May 15, 2019

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.12) is installed.
  2. Use make to install PD. PD is installed in the bin directory.

Usage

Command flags

See PD Configuration Flags.

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.

You can’t perform that action at this time.