GithubHelp home page GithubHelp logo

howardlau1999 / pd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tikv/pd

0.0 2.0 0.0 23.91 MB

Placement driver for TiKV

License: Apache License 2.0

Go 99.31% Makefile 0.33% Shell 0.23% Dockerfile 0.03% PowerShell 0.10%

pd's Introduction

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.

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.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/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 tikv/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

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.

pd's People

Contributors

andelf avatar breezewish avatar c4pt0r avatar connor1996 avatar crazycs520 avatar dantin avatar disksing avatar gregwebs avatar howardlau1999 avatar huachaohuang avatar hundundm avatar jmpotato avatar lhy1024 avatar liukun4515 avatar lonng avatar luffbee avatar nanne007 avatar ngaut avatar nolouch avatar overvenus avatar qiuyesuifeng avatar rleungx avatar shafreeck avatar siddontang avatar sourcelliu avatar tiancaiamao avatar xhebox avatar yisaer avatar zenotan avatar zimulala avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.