pd

Placement driver for TiKV

  • 所有者: tikv/pd
  • 平台:
  • 许可证: Apache License 2.0
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

PD

TravisCI Build Status
GitHub release
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.13) 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.

主要指标

概览
名称与所有者tikv/pd
主编程语言Go
编程语言Go (语言数: 4)
平台
许可证Apache License 2.0
所有者活动
创建于2016-03-07 09:13:06
推送于2025-07-31 10:54:35
最后一次提交2025-07-31 17:30:44
发布数267
最新版本名称v9.0.0-beta.2.pre (发布于 )
第一版名称beta4 (发布于 )
用户参与
星数1.1k
关注者数86
派生数738
提交数4.6k
已启用问题?
问题数2795
打开的问题数504
拉请求数5738
打开的拉请求数129
关闭的拉请求数937
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?