pd

module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2017 License: Apache-2.0

README

PD

TravisCI Build Status Project Status CircleCI Build Status Go Report Card Coverage Status

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.8+) is installed.
  2. Use make to install PD. PD is installed in the bin directory.

Usage

Command flags

See configuration.

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 ${HostIP}:2379/v2/members

{"members":[{"id":"f62e88a6e81c149","name":"default","peerURLs":["http://192.168.199.105:2380"],"clientURLs":["http://192.168.199.105:2379"]}]}

A better tool httpie is recommended:

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": "default", 
            "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 binary deployment to learn how to set up the cluster and run them.

You can also use Docker to run the cluster.

Directories

Path Synopsis
_vendor
src/github.com/Sirupsen/logrus
Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
src/github.com/beorn7/perks/quantile
Package quantile computes approximate quantiles over an unbounded data stream within low memory and CPU bounds.
Package quantile computes approximate quantiles over an unbounded data stream within low memory and CPU bounds.
src/github.com/boltdb/bolt
Package bolt implements a low-level key/value store in pure Go.
Package bolt implements a low-level key/value store in pure Go.
src/github.com/chzyer/readline
Readline is a pure go implementation for GNU-Readline kind library.
Readline is a pure go implementation for GNU-Readline kind library.
src/github.com/coreos/etcd/alarm
Package alarm manages health status alarms in etcd.
Package alarm manages health status alarms in etcd.
src/github.com/coreos/etcd/auth
Package auth provides client role authentication for accessing keys in etcd.
Package auth provides client role authentication for accessing keys in etcd.
src/github.com/coreos/etcd/auth/authpb
Package authpb is a generated protocol buffer package.
Package authpb is a generated protocol buffer package.
src/github.com/coreos/etcd/client
Package client provides bindings for the etcd APIs.
Package client provides bindings for the etcd APIs.
src/github.com/coreos/etcd/clientv3
Package clientv3 implements the official Go etcd client for v3.
Package clientv3 implements the official Go etcd client for v3.
src/github.com/coreos/etcd/clientv3/concurrency
Package concurrency implements concurrency operations on top of etcd such as distributed locks, barriers, and elections.
Package concurrency implements concurrency operations on top of etcd such as distributed locks, barriers, and elections.
src/github.com/coreos/etcd/compactor
Package compactor implements automated policies for compacting etcd's mvcc storage.
Package compactor implements automated policies for compacting etcd's mvcc storage.
src/github.com/coreos/etcd/discovery
Package discovery provides an implementation of the cluster discovery that is used by etcd.
Package discovery provides an implementation of the cluster discovery that is used by etcd.
src/github.com/coreos/etcd/embed
Package embed provides bindings for embedding an etcd server in a program.
Package embed provides bindings for embedding an etcd server in a program.
src/github.com/coreos/etcd/error
Package error describes errors in etcd project.
Package error describes errors in etcd project.
src/github.com/coreos/etcd/etcdserver
Package etcdserver defines how etcd servers interact and store their states.
Package etcdserver defines how etcd servers interact and store their states.
src/github.com/coreos/etcd/etcdserver/api
Package api manages the capabilities and features that are exposed to clients by the etcd cluster.
Package api manages the capabilities and features that are exposed to clients by the etcd cluster.
src/github.com/coreos/etcd/etcdserver/api/v2http
Package v2http provides etcd client and server implementations.
Package v2http provides etcd client and server implementations.
src/github.com/coreos/etcd/etcdserver/api/v2http/httptypes
Package httptypes defines how etcd's HTTP API entities are serialized to and deserialized from JSON.
Package httptypes defines how etcd's HTTP API entities are serialized to and deserialized from JSON.
src/github.com/coreos/etcd/etcdserver/api/v3client
Package v3client provides clientv3 interfaces from an etcdserver.
Package v3client provides clientv3 interfaces from an etcdserver.
src/github.com/coreos/etcd/etcdserver/api/v3election
Package v3election provides a v3 election service from an etcdserver.
Package v3election provides a v3 election service from an etcdserver.
src/github.com/coreos/etcd/etcdserver/api/v3election/v3electionpb
Package v3electionpb is a generated protocol buffer package.
Package v3electionpb is a generated protocol buffer package.
Package v3electionpb is a reverse proxy.
src/github.com/coreos/etcd/etcdserver/api/v3lock
Package v3lock provides a v3 locking service from an etcdserver.
Package v3lock provides a v3 locking service from an etcdserver.
src/github.com/coreos/etcd/etcdserver/api/v3lock/v3lockpb
Package v3lockpb is a generated protocol buffer package.
Package v3lockpb is a generated protocol buffer package.
Package v3lockpb is a reverse proxy.
src/github.com/coreos/etcd/etcdserver/api/v3rpc
Package v3rpc implements etcd v3 RPC system based on gRPC.
Package v3rpc implements etcd v3 RPC system based on gRPC.
src/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes
Package rpctypes has types and values shared by the etcd server and client for v3 RPC interaction.
Package rpctypes has types and values shared by the etcd server and client for v3 RPC interaction.
src/github.com/coreos/etcd/etcdserver/auth
Package auth implements etcd authentication.
Package auth implements etcd authentication.
src/github.com/coreos/etcd/etcdserver/etcdserverpb
Package etcdserverpb is a generated protocol buffer package.
Package etcdserverpb is a generated protocol buffer package.
src/github.com/coreos/etcd/etcdserver/etcdserverpb/gw
Package etcdserverpb is a reverse proxy.
Package etcdserverpb is a reverse proxy.
src/github.com/coreos/etcd/etcdserver/membership
Package membership describes individual etcd members and clusters of members.
Package membership describes individual etcd members and clusters of members.
src/github.com/coreos/etcd/etcdserver/stats
Package stats defines a standard interface for etcd cluster statistics.
Package stats defines a standard interface for etcd cluster statistics.
src/github.com/coreos/etcd/lease
Package lease provides an interface and implemetation for time-limited leases over arbitrary resources.
Package lease provides an interface and implemetation for time-limited leases over arbitrary resources.
src/github.com/coreos/etcd/lease/leasehttp
Package leasehttp serves lease renewals made through HTTP requests.
Package leasehttp serves lease renewals made through HTTP requests.
src/github.com/coreos/etcd/lease/leasepb
Package leasepb is a generated protocol buffer package.
Package leasepb is a generated protocol buffer package.
src/github.com/coreos/etcd/mvcc
Package mvcc defines etcd's stable MVCC storage.
Package mvcc defines etcd's stable MVCC storage.
src/github.com/coreos/etcd/mvcc/backend
Package backend defines a standard interface for etcd's backend MVCC storage.
Package backend defines a standard interface for etcd's backend MVCC storage.
src/github.com/coreos/etcd/mvcc/mvccpb
Package mvccpb is a generated protocol buffer package.
Package mvccpb is a generated protocol buffer package.
src/github.com/coreos/etcd/pkg/adt
Package adt implements useful abstract data types.
Package adt implements useful abstract data types.
src/github.com/coreos/etcd/pkg/contention
Package contention provides facilities for detecting system contention.
Package contention provides facilities for detecting system contention.
src/github.com/coreos/etcd/pkg/cors
Package cors handles cross-origin HTTP requests (CORS).
Package cors handles cross-origin HTTP requests (CORS).
src/github.com/coreos/etcd/pkg/cpuutil
Package cpuutil provides facilities for detecting cpu-specific features.
Package cpuutil provides facilities for detecting cpu-specific features.
src/github.com/coreos/etcd/pkg/crc
Package crc provides utility function for cyclic redundancy check algorithms.
Package crc provides utility function for cyclic redundancy check algorithms.
src/github.com/coreos/etcd/pkg/debugutil
Package debugutil includes utility functions for debugging.
Package debugutil includes utility functions for debugging.
src/github.com/coreos/etcd/pkg/fileutil
Package fileutil implements utility functions related to files and paths.
Package fileutil implements utility functions related to files and paths.
src/github.com/coreos/etcd/pkg/httputil
Package httputil provides HTTP utility functions.
Package httputil provides HTTP utility functions.
src/github.com/coreos/etcd/pkg/idutil
Package idutil implements utility functions for generating unique, randomized ids.
Package idutil implements utility functions for generating unique, randomized ids.
src/github.com/coreos/etcd/pkg/ioutil
Package ioutil implements I/O utility functions.
Package ioutil implements I/O utility functions.
src/github.com/coreos/etcd/pkg/logutil
Package logutil includes utilities to facilitate logging.
Package logutil includes utilities to facilitate logging.
src/github.com/coreos/etcd/pkg/monotime
Package monotime provides a fast monotonic clock source.
Package monotime provides a fast monotonic clock source.
src/github.com/coreos/etcd/pkg/netutil
Package netutil implements network-related utility functions.
Package netutil implements network-related utility functions.
src/github.com/coreos/etcd/pkg/pathutil
Package pathutil implements utility functions for handling slash-separated paths.
Package pathutil implements utility functions for handling slash-separated paths.
src/github.com/coreos/etcd/pkg/pbutil
Package pbutil defines interfaces for handling Protocol Buffer objects.
Package pbutil defines interfaces for handling Protocol Buffer objects.
src/github.com/coreos/etcd/pkg/runtime
Package runtime implements utility functions for runtime systems.
Package runtime implements utility functions for runtime systems.
src/github.com/coreos/etcd/pkg/schedule
Package schedule provides mechanisms and policies for scheduling units of work.
Package schedule provides mechanisms and policies for scheduling units of work.
src/github.com/coreos/etcd/pkg/srv
Package srv looks up DNS SRV records.
Package srv looks up DNS SRV records.
src/github.com/coreos/etcd/pkg/tlsutil
Package tlsutil provides utility functions for handling TLS.
Package tlsutil provides utility functions for handling TLS.
src/github.com/coreos/etcd/pkg/transport
Package transport implements various HTTP transport utilities based on Go net package.
Package transport implements various HTTP transport utilities based on Go net package.
src/github.com/coreos/etcd/pkg/types
Package types declares various data types and implements type-checking functions.
Package types declares various data types and implements type-checking functions.
src/github.com/coreos/etcd/pkg/wait
Package wait provides utility functions for polling, listening using Go channel.
Package wait provides utility functions for polling, listening using Go channel.
src/github.com/coreos/etcd/proxy/grpcproxy/adapter
Package adapter provides gRPC adapters between client and server gRPC interfaces without needing to go through a gRPC connection.
Package adapter provides gRPC adapters between client and server gRPC interfaces without needing to go through a gRPC connection.
src/github.com/coreos/etcd/raft
Package raft sends and receives messages in the Protocol Buffer format defined in the raftpb package.
Package raft sends and receives messages in the Protocol Buffer format defined in the raftpb package.
src/github.com/coreos/etcd/raft/raftpb
Package raftpb is a generated protocol buffer package.
Package raftpb is a generated protocol buffer package.
src/github.com/coreos/etcd/rafthttp
Package rafthttp implements HTTP transportation layer for etcd/raft pkg.
Package rafthttp implements HTTP transportation layer for etcd/raft pkg.
src/github.com/coreos/etcd/snap
Package snap stores raft nodes' states with snapshots.
Package snap stores raft nodes' states with snapshots.
src/github.com/coreos/etcd/snap/snappb
Package snappb is a generated protocol buffer package.
Package snappb is a generated protocol buffer package.
src/github.com/coreos/etcd/store
Package store defines etcd's in-memory key/value store.
Package store defines etcd's in-memory key/value store.
src/github.com/coreos/etcd/version
Package version implements etcd version parsing and contains latest version information.
Package version implements etcd version parsing and contains latest version information.
src/github.com/coreos/etcd/wal
Package wal provides an implementation of a write ahead log that is used by etcd.
Package wal provides an implementation of a write ahead log that is used by etcd.
src/github.com/coreos/etcd/wal/walpb
Package walpb is a generated protocol buffer package.
Package walpb is a generated protocol buffer package.
src/github.com/coreos/go-semver/semver
Semantic Versions http://semver.org
Semantic Versions http://semver.org
src/github.com/coreos/go-systemd/journal
Package journal provides write bindings to the local systemd journal.
Package journal provides write bindings to the local systemd journal.
src/github.com/dgrijalva/jwt-go
Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
src/github.com/dustin/go-humanize
Package humanize converts boring ugly numbers to human-friendly strings and back.
Package humanize converts boring ugly numbers to human-friendly strings and back.
src/github.com/gogo/protobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.
src/github.com/golang/protobuf/jsonpb
Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON.
Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON.
src/github.com/golang/protobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.
src/github.com/golang/protobuf/ptypes/any
Package any is a generated protocol buffer package.
Package any is a generated protocol buffer package.
src/github.com/google/btree
Package btree implements in-memory B-Trees of arbitrary degree.
Package btree implements in-memory B-Trees of arbitrary degree.
src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
src/github.com/gorilla/mux
Package mux implements a request router and dispatcher.
Package mux implements a request router and dispatcher.
src/github.com/grpc-ecosystem/grpc-gateway/runtime
Package runtime contains runtime helper functions used by servers which protoc-gen-grpc-gateway generates.
Package runtime contains runtime helper functions used by servers which protoc-gen-grpc-gateway generates.
src/github.com/grpc-ecosystem/grpc-gateway/runtime/internal
Package internal is a generated protocol buffer package.
Package internal is a generated protocol buffer package.
src/github.com/grpc-ecosystem/grpc-gateway/utilities
Package utilities provides members for internal use in grpc-gateway.
Package utilities provides members for internal use in grpc-gateway.
src/github.com/juju/errors
[godoc-link-here]
[godoc-link-here]
src/github.com/matttproud/golang_protobuf_extensions/pbutil
Package pbutil provides record length-delimited Protocol Buffer streaming.
Package pbutil provides record length-delimited Protocol Buffer streaming.
src/github.com/pingcap/check
Package check is a rich testing extension for Go's testing package.
Package check is a rich testing extension for Go's testing package.
src/github.com/pingcap/kvproto/pkg/metapb
Package metapb is a generated protocol buffer package.
Package metapb is a generated protocol buffer package.
src/github.com/pingcap/kvproto/pkg/pdpb
Package pdpb is a generated protocol buffer package.
Package pdpb is a generated protocol buffer package.
src/github.com/prometheus/client_golang/prometheus
Package prometheus provides metrics primitives to instrument code for monitoring.
Package prometheus provides metrics primitives to instrument code for monitoring.
src/github.com/prometheus/client_golang/prometheus/push
Package push provides functions to push metrics to a Pushgateway.
Package push provides functions to push metrics to a Pushgateway.
src/github.com/prometheus/client_model/go
Package io_prometheus_client is a generated protocol buffer package.
Package io_prometheus_client is a generated protocol buffer package.
src/github.com/prometheus/common/expfmt
A package for reading and writing Prometheus metrics.
A package for reading and writing Prometheus metrics.
HTTP Content-Type Autonegotiation.
src/github.com/prometheus/common/model
Package model contains common data structures that are shared across Prometheus components and libraries.
Package model contains common data structures that are shared across Prometheus components and libraries.
src/github.com/prometheus/procfs
Package procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Package procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
src/github.com/spf13/cobra
Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
src/github.com/spf13/pflag
Package pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.
Package pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.
src/github.com/ugorji/go/codec
High Performance, Feature-Rich Idiomatic Go codec/encoding library for binc, msgpack, cbor, json.
High Performance, Feature-Rich Idiomatic Go codec/encoding library for binc, msgpack, cbor, json.
src/github.com/unrolled/render
Package render is a package that provides functionality for easily rendering JSON, XML, binary data, and HTML templates.
Package render is a package that provides functionality for easily rendering JSON, XML, binary data, and HTML templates.
src/github.com/urfave/negroni
Package negroni is an idiomatic approach to web middleware in Go.
Package negroni is an idiomatic approach to web middleware in Go.
src/golang.org/x/crypto/bcrypt
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
src/golang.org/x/crypto/blowfish
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
src/golang.org/x/net/http2
Package http2 implements the HTTP/2 protocol.
Package http2 implements the HTTP/2 protocol.
src/golang.org/x/net/http2/hpack
Package hpack implements HPACK, a compression format for efficiently representing HTTP header fields in the context of HTTP/2.
Package hpack implements HPACK, a compression format for efficiently representing HTTP header fields in the context of HTTP/2.
src/golang.org/x/net/idna
Package idna implements IDNA2008 using the compatibility processing defined by UTS (Unicode Technical Standard) #46, which defines a standard to deal with the transition from IDNA2003.
Package idna implements IDNA2008 using the compatibility processing defined by UTS (Unicode Technical Standard) #46, which defines a standard to deal with the transition from IDNA2003.
src/golang.org/x/net/internal/timeseries
Package timeseries implements a time series structure for stats collection.
Package timeseries implements a time series structure for stats collection.
src/golang.org/x/net/lex/httplex
Package httplex contains rules around lexical matters of various HTTP-related specifications.
Package httplex contains rules around lexical matters of various HTTP-related specifications.
src/golang.org/x/net/trace
Package trace implements tracing of requests and long-lived objects.
Package trace implements tracing of requests and long-lived objects.
src/golang.org/x/sys/unix
Package unix contains an interface to the low-level operating system primitives.
Package unix contains an interface to the low-level operating system primitives.
src/golang.org/x/text/secure/bidirule
Package bidirule implements the Bidi Rule defined by RFC 5893.
Package bidirule implements the Bidi Rule defined by RFC 5893.
src/golang.org/x/text/transform
Package transform provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
Package transform provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
src/golang.org/x/text/unicode/bidi
Package bidi contains functionality for bidirectional text support.
Package bidi contains functionality for bidirectional text support.
src/golang.org/x/text/unicode/norm
Package norm contains types and functions for normalizing Unicode strings.
Package norm contains types and functions for normalizing Unicode strings.
src/google.golang.org/genproto/googleapis/rpc/status
Package status is a generated protocol buffer package.
Package status is a generated protocol buffer package.
src/google.golang.org/grpc
Package grpc implements an RPC system called gRPC.
Package grpc implements an RPC system called gRPC.
src/google.golang.org/grpc/codes
Package codes defines the canonical error codes used by gRPC.
Package codes defines the canonical error codes used by gRPC.
src/google.golang.org/grpc/credentials
Package credentials implements various credentials supported by gRPC library, which encapsulate all the state needed by a client to authenticate with a server and make various assertions, e.g., about the client's identity, role, or whether it is authorized to make a particular call.
Package credentials implements various credentials supported by gRPC library, which encapsulate all the state needed by a client to authenticate with a server and make various assertions, e.g., about the client's identity, role, or whether it is authorized to make a particular call.
src/google.golang.org/grpc/grpclb/grpc_lb_v1
Package grpc_lb_v1 is a generated protocol buffer package.
Package grpc_lb_v1 is a generated protocol buffer package.
src/google.golang.org/grpc/grpclog
Package grpclog defines logging for grpc.
Package grpclog defines logging for grpc.
src/google.golang.org/grpc/internal
Package internal contains gRPC-internal code for testing, to avoid polluting the godoc of the top-level grpc package.
Package internal contains gRPC-internal code for testing, to avoid polluting the godoc of the top-level grpc package.
src/google.golang.org/grpc/keepalive
Package keepalive defines configurable parameters for point-to-point healthcheck.
Package keepalive defines configurable parameters for point-to-point healthcheck.
src/google.golang.org/grpc/metadata
Package metadata define the structure of the metadata supported by gRPC library.
Package metadata define the structure of the metadata supported by gRPC library.
src/google.golang.org/grpc/naming
Package naming defines the naming API and related data structures for gRPC.
Package naming defines the naming API and related data structures for gRPC.
src/google.golang.org/grpc/peer
Package peer defines various peer information associated with RPCs and corresponding utils.
Package peer defines various peer information associated with RPCs and corresponding utils.
src/google.golang.org/grpc/stats
Package stats is for collecting and reporting various network and RPC stats.
Package stats is for collecting and reporting various network and RPC stats.
src/google.golang.org/grpc/status
Package status implements errors returned by gRPC.
Package status implements errors returned by gRPC.
src/google.golang.org/grpc/tap
Package tap defines the function handles which are executed on the transport layer of gRPC-Go and related information.
Package tap defines the function handles which are executed on the transport layer of gRPC-Go and related information.
src/google.golang.org/grpc/transport
Package transport defines and implements message oriented communication channel to complete various transactions (e.g., an RPC).
Package transport defines and implements message oriented communication channel to complete various transactions (e.g., an RPC).
src/gopkg.in/natefinch/lumberjack.v2
Package lumberjack provides a rolling logger.
Package lumberjack provides a rolling logger.
src/gopkg.in/yaml.v2
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.
cmd
pkg
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL