• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

tikv/pd: Placement driver for TiKV

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

tikv/pd

开源软件地址(OpenSource Url):

https://github.com/tikv/pd

开源编程语言(OpenSource Language):

Go 99.3%

开源软件介绍(OpenSource Introduction):

PD

Check Status Build & Test Status TSO Consistency Test 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.

contribution-map

If you're interested in contributing to PD, see CONTRIBUTING.md. For more contributing information, please click on the contributor icon above.

Build

  1. Make sure Go (version 1.16) 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/pd/api/v1/members

{
    "members": [
        {
            "name":"pd",
            "member_id":"f62e88a6e81c149",
            "peer_urls": [
                "http://192.168.199.105:2380"
            ],
            "client_urls": [
                "http://192.168.199.105:2379"
            ]
        }
    ]
}

A better tool httpie is recommended:

http http://${HostIP}:2379/pd/api/v1/members
Access-Control-Allow-Headers: accept, content-type, authorization
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
Access-Control-Allow-Origin: *
Content-Length: 673
Content-Type: application/json; charset=UTF-8
Date: Thu, 20 Feb 2020 09:49:42 GMT

{
    "members": [
        {
            "client_urls": [
                "http://192.168.199.105:2379"
            ],
            "member_id": "f62e88a6e81c149",
            "name": "pd",
            "peer_urls": [
                "http://192.168.199.105:2380"
            ]
        }
    ]
}

Docker

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

docker build -t tikv/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 tikv/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

As a component of TiKV project, PD needs to run with TiKV to work. The cluster can also include TiDB to provide SQL services. You can refer Deploy a TiDB Cluster Using TiUP or TiDB in Kubernetes Documentation for detailed instructions to deploy a cluster.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
hacs/default: The home of the default HACS repositories.发布时间:2022-07-09
下一篇:
cp-geeks-adgitm/Hacktoberfest: Everyone is free to contribute.发布时间:2022-07-09
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap