gavinzheng / pd

Placement driver for TiKV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


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.


  1. Make sure Go (version 1.12) is installed.
  2. Use make to install PD. PD is installed in the bin directory.


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=""

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

Using curl to see PD member:

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


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": [
            "id": "f62e88a6e81c149",
            "name": "pd",
            "peerURLs": [


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=""

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


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.

ezoic increase your site revenue


Placement driver for TiKV

License:Apache License 2.0


Language:Go 97.4%Language:RAML 2.1%Language:Makefile 0.3%Language:Shell 0.1%Language:PowerShell 0.1%Language:Dockerfile 0.0%