Skip to content

Commit

Permalink
readme: update Go version, wording (#5777)
Browse files Browse the repository at this point in the history
close #5776

* update the Go version to v1.19
* update some old links to the latest one
* update some wording, format, and the output of command

Signed-off-by: Aolin <aolin.zhang@pingcap.com>
  • Loading branch information
Oreoxmt committed Dec 13, 2022
1 parent 65abc36 commit 16fb017
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 71 deletions.
22 changes: 11 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# How to contribute

Thanks for your interest in contributing to PD! If you need any help or mentoring getting started, understanding the codebase, or making a PR (or anything else really), please ask on [#sig-scheduling (Slack channel)](https://slack.tidb.io/invite?team=tikv-wg&channel=sig-scheduling&ref=pingcap-community).
Thanks for your interest in contributing to PD!

## Finding something to work on

Expand All @@ -12,18 +12,18 @@ If you are planning something big, for example, relates to multiple components o

- Fork the repository on GitHub.
- Read the README.md for build instructions.
- Play with the project, submit bugs, submit patches!
- Play with the project, submit bugs, and submit patches!

## Contribution flow

This is a rough outline of what a contributor's workflow looks like:

- Create an issue about the problem that you are going to solve if there isn't existed (see below for linking issue).
- Create an issue about the problem that you are going to solve if there isn't existed (see below for [linking issues](#linking-issues)).
- Create a topic branch from where you want to base your work. This is usually master.
- Make commits of logical units and add test case if the change fixes a bug or adds new functionality.
- Make commits of logical units and add test cases if the change fixes a bug or adds new functionality.
- Run tests and make sure all the tests are passed.
- Push your changes to a topic branch in your fork of the repository.
- Submit a pull request and make sure proper final commit message (see below for message format).
- Submit a pull request and make sure proper final commit message (see below for [message format](#format-of-the-commit-message)).
- Your PR must receive LGTMs from two reviewers.

More specifics on the development workflow are in [development workflow](./docs/development-workflow.md).
Expand All @@ -40,7 +40,7 @@ Please follow this style to make PD easy to review, maintain and develop.

### Linking issues

Code repositories in TiKV community require **ALL** the pull requests referring to its corresponding issues. In the pull request body, there **MUST** be one line starting with `Issue Number: ` and linking the relevant issues via the [keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), for example:
Code repositories in TiKV community require **ALL** the pull requests referring to their corresponding issues. In the pull request body, there **MUST** be one line starting with `Issue Number: ` and linking the relevant issues via the [keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword), for example:

If the pull request resolves the relevant issues, and you want GitHub to close these issues automatically after it merged into the default branch, you can use the syntax (`KEYWORD #ISSUE-NUMBER`) like this:

Expand All @@ -64,9 +64,9 @@ For pull requests trying to close issues in a different repository, contributors

If the pull request body does not provide the required content, the bot will add the `do-not-merge/needs-linked-issue` label to the pull request to prevent it from being merged.

### Format of the Commit Message
### Format of the commit message

The bot we use will extract the pull request title as the one-line subject and messages inside the `commit-message` code block as commit message body. For example, a pull request with title `pkg: what's changed in this one package` and body containing:
The bot we use will extract the pull request title as the one-line subject and messages inside the `commit-message` code block as commit message body. For example, a pull request with title `pkg: what's changed in this one package` and a body containing:

```commit-message
any multiple line commit messages that go into
Expand All @@ -90,14 +90,14 @@ the final commit message body

The first line is the subject (the pull request title) and should be no longer than 70 characters, the second line is always blank, and other lines should be wrapped at 80 characters. This allows the message to be easier to read on GitHub as well as in various git tools.

If the change affects more than one subsystem, you can use comma to separate them like `server, pd-client:`.
If the change affects more than one subsystem, you can use a comma to separate them like `server, pd-client:`.

If the change affects many subsystems, you can use ```*``` instead, like ```*:```.

The body of the commit message should describe why the change was made and at a high level, how the code works.

### Signing off the Commit
### Signing off the commit

The project uses [DCO check](https://github.com/probot/dco#how-it-works) and the commit message must contain a `Signed-off-by` line for [Developer Certificate of Origin](https://developercertificate.org/).

Use option `git commit -s` to sign off your commits.
Use option `git commit -s` to sign off your commits.
126 changes: 66 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,119 +7,125 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/tikv/pd)](https://goreportcard.com/report/github.com/tikv/pd)
[![codecov](https://codecov.io/gh/tikv/pd/branch/master/graph/badge.svg)](https://codecov.io/gh/tikv/pd)

PD is the abbreviation for Placement Driver. It is used to manage and schedule the [TiKV](https://github.com/tikv/tikv) cluster.
PD is the abbreviation for Placement Driver. It manages and schedules [TiKV](https://github.com/tikv/tikv) clusters.

PD supports distribution and fault-tolerance by embedding [etcd](https://github.com/etcd-io/etcd).
PD supports fault-tolerance by embedding [etcd](https://github.com/etcd-io/etcd).

[<img src="docs/contribution-map.png" alt="contribution-map" width="180">](https://github.com/pingcap/tidb-map/blob/master/maps/contribution-map.md#pd-placement-driver-for-tikv)
[<img src="docs/contribution-map.png" alt="contribution-map" width="180"/>](https://github.com/pingcap/tidb-map/blob/master/maps/contribution-map.md#pd-placement-driver-for-tikv)

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

## Build

1. Make sure [*Go*](https://golang.org/) (version 1.16) is installed.
1. Make sure [*Go*](https://golang.org/) (version 1.19) is installed.
2. Use `make` to install PD. PD is installed in the `bin` directory.

## Usage

### Command flags
PD can be configured using command-line flags. For more information, see [PD Configuration Flags](https://docs.pingcap.com/tidb/stable/command-line-flags-for-pd-configuration).

See [PD Configuration Flags](https://pingcap.com/docs/dev/reference/configuration/pd-server/configuration/#pd-configuration-flags).
### Single node with default ports

### 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.
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.

```bash
# Set correct HostIP here.
export HostIP="192.168.199.105"
# 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://${HostIP}:2379" \
--peer-urls="http://${HostIP}:2380" \
--client-urls="http://${HOST_IP}:2379" \
--peer-urls="http://${HOST_IP}:2380" \
--log-file=pd.log
```

Using `curl` to see PD member:
Using `curl` to view PD members:

```bash
curl http://${HostIP}:2379/pd/api/v1/members
curl http://${HOST_IP}: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"
]
}
]
"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"
}
]
}
```

A better tool [httpie](https://github.com/jkbrzt/httpie) is recommended:
You can also use [httpie](https://github.com/jkbrzt/httpie) to call the API:

```bash
http http://${HostIP}:2379/pd/api/v1/members
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: 673
Content-Length: 1003
Content-Type: application/json; charset=UTF-8
Date: Thu, 20 Feb 2020 09:49:42 GMT
Date: Mon, 12 Dec 2022 13:46:33 GMT

{
"members": [
{
"client_urls": [
"http://192.168.199.105:2379"
],
"member_id": "f62e88a6e81c149",
"name": "pd",
"peer_urls": [
"http://192.168.199.105:2380"
]
}
]
"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 use the following command to build a PD image directly:
You can choose one of the following methods to get a PD image:

```bash
docker build -t tikv/pd .
```
- Build locally:

Or you can also use following command to get PD from Docker hub:
```bash
docker build -t pingcap/pd .
```

```bash
docker pull pingcap/pd
```
- Pull from Docker Hub:

```bash
docker pull pingcap/pd
```

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

```bash
# Set correct HostIP here.
export HostIP="192.168.199.105"
# 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 tikv/pd \
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" \
--advertise-client-urls="http://${HOST_IP}:2379" \
--peer-urls="http://0.0.0.0:2380" \
--advertise-peer-urls="http://${HostIP}:2380" \
--advertise-peer-urls="http://${HOST_IP}: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](https://docs.pingcap.com/tidb/stable/production-deployment-using-tiup) or [TiDB in Kubernetes Documentation](https://docs.pingcap.com/tidb-in-kubernetes/stable) for detailed instructions to deploy a 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](https://docs.pingcap.com/tidb/stable/production-deployment-using-tiup) or [TiDB on Kubernetes Documentation](https://docs.pingcap.com/tidb-in-kubernetes/stable).

0 comments on commit 16fb017

Please sign in to comment.