tm

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0

README

titan-meta

titan search meta service

Build

  1. Make sure Go (version 1.20) 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.

Directories

Path Synopsis
client module
cmd
docs
pkg
id
mcs
Package mcs used to implement the core logic of the external services which rely on the PD backend provider.
Package mcs used to implement the core logic of the external services which rely on the PD backend provider.
mcs/registry
Package registry is used to register the services.
Package registry is used to register the services.
mcs/resource_manager/server
Package server provides a set of struct definitions for the resource group, can be imported.
Package server provides a set of struct definitions for the resource group, can be imported.
tso
plugin
api
gc
tools

Jump to

Keyboard shortcuts

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