• Stars
    star
    1,041
  • Rank 44,255 (Top 0.9 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Placement driver for TiKV

PD

Check Status Build & Test Status TSO Consistency Test Status GitHub release Go Report Card codecov

PD is the abbreviation for Placement Driver. It manages and schedules TiKV clusters.

PD supports fault-tolerance by embedding etcd.

contribution-map

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

Build

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

Usage

PD can be configured using command-line flags. For more information, 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 HOST_IP to the address you want to listen on
export HOST_IP="192.168.199.105"

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

Using curl to view PD members:

curl http://${HOST_IP}:2379/pd/api/v1/members

{
  "members": [
    {
      "name": "pd",
      "member_id": 15980934438217023866,
      "peer_urls": [
        "http://192.168.199.105:2380"
      ],
      "client_urls": [
        "http://192.168.199.105:2379"
      ],
      "deploy_path": "/",
      "binary_version": "v6.1.3",
      "git_hash": "1a4e975892512a97fb0e5b45c9be69aa76148793"
    }
  ]
}

You can also use httpie to call the API:

http http://${HOST_IP}: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: 1003
Content-Type: application/json; charset=UTF-8
Date: Mon, 12 Dec 2022 13:46:33 GMT

{
  "members": [
    {
      "name": "pd",
      "member_id": 15980934438217023866,
      "peer_urls": [
        "http://192.168.199.105:2380"
      ],
      "client_urls": [
        "http://192.168.199.105:2379"
      ],
      "deploy_path": "/",
      "binary_version": "v6.1.3",
      "git_hash": "1a4e975892512a97fb0e5b45c9be69aa76148793"
    }
  ]
}

Docker

You can choose one of the following methods to get a PD image:

  • Build locally:

    docker build -t pingcap/pd .
  • Pull from Docker Hub:

    docker pull pingcap/pd

Then you can run a single node using the following command:

# Set HOST_IP to the address you want to listen on
export HOST_IP="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://${HOST_IP}:2379" \
          --peer-urls="http://0.0.0.0:2380" \
          --advertise-peer-urls="http://${HOST_IP}:2380" \
          --log-file=pd.log

Cluster

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

More Repositories

1

tikv

Distributed transactional key-value database, originally created to complement TiDB
Rust
15,068
star
2

raft-rs

Raft distributed consensus algorithm implemented in Rust.
Rust
2,916
star
3

grpc-rs

The gRPC library for Rust built on C Core library and futures
Rust
1,801
star
4

pprof-rs

A Rust CPU profiler implemented with the help of backtrace-rs
Rust
1,299
star
5

rust-prometheus

Prometheus instrumentation library for Rust applications
Rust
1,056
star
6

agatedb

A persistent key-value storage in rust.
Rust
829
star
7

minitrace-rust

Extremely fast tracing library for Rust
Rust
731
star
8

raft-engine

A persistent storage engine for Multi-Raft log
Rust
547
star
9

titan

A RocksDB plugin for key-value separation, inspired by WiscKey.
C++
485
star
10

client-rust

Rust Client for TiKV.
Rust
388
star
11

fail-rs

Fail points for rust
Rust
333
star
12

client-go

Go client for TiKV
Go
279
star
13

minstant

Performant time measuring in Rust
Rust
170
star
14

yatp

Yet another thread pool in rust for both callbacks or futures.
Rust
134
star
15

client-java

TiKV Java Client
Java
111
star
16

deep-dive-tikv

How do we build a distributed, transactional key-value database - TiKV?
HTML
97
star
17

rfcs

RFCs for changes to TiKV and its ecosystem
78
star
18

auto-tikv

Tool to tune TiKV with ML method
Python
67
star
19

sig-transaction

Resources for the transaction SIG
63
star
20

async-speed-limit

Asynchronously speed-limiting multiple byte streams
Rust
57
star
21

minitrace-go

A high-performance timeline tracing library for Golang, used by TiDB
Go
45
star
22

crc64fast

SIMD accelerated CRC-64-ECMA computation
Rust
43
star
23

community

TiKV community content
43
star
24

client-c

The C++ TiKV client used by TiFlash.
C++
40
star
25

migration

Migration tools for TiKV, e.g. online bulk load.
Go
35
star
26

tikv-dev-guide

The TiKV development/contribution guide
34
star
27

client-py

Rust
27
star
28

importer

tikv-importer is a front-end to help ingesting large number of KV pairs into a TiKV cluster
Rust
20
star
29

website

Website for tikv.org
HTML
19
star
30

tikv-operator

Go
19
star
31

protobuf-build

Rust
17
star
32

client-cpp

TiKV Client for C++
Rust
14
star
33

client-node

Rust
11
star
34

mur3

Rust implementation of MurmurHash3.
Rust
11
star
35

copr-test

Go
10
star
36

mock-tikv

A mocked TiKV server for testing clients that written in different languages.
Go
6
star
37

jepsen-test

Clojure
6
star
38

slog-global

Global loggers for slog-rs. Similar to slog-scope but more simple.
Rust
5
star
39

match-template

match-template is a procedural macro that generates repeated match arms by pattern.
Rust
5
star
40

terraform-tikv-bench

An Orcestrated TiKV benchmark. Not for production deployment.
HCL
4
star
41

skiplist-rs

Rust
4
star
42

client-validator

Provide functional checks for tikv client implementations in different languages.
Go
3
star
43

tracing-active-tree

Rust
3
star
44

tlaplus-specs

TiKV TLA+ specifications
TLA
3
star