-
Notifications
You must be signed in to change notification settings - Fork 678
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#1938) * tidb-in-kubernetes: add doc to restart tidb components on k8s * address comments * tidb-in-kubernetes: refine format * make the same changes as before * address comments from lilian * address comment on wording Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com> Co-authored-by: Lilian Lee <lilin@pingcap.com> Co-authored-by: DanielZhangQD <36026334+DanielZhangQD@users.noreply.github.com> Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> Co-authored-by: Keke Yi <40977455+yikeke@users.noreply.github.com> Co-authored-by: Lilian Lee <lilin@pingcap.com> Co-authored-by: DanielZhangQD <36026334+DanielZhangQD@users.noreply.github.com>
- Loading branch information
1 parent
482ad5b
commit a3eb80e
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: Restart a TiDB Cluster in Kubernetes | ||
summary: Learn how to restart a TiDB cluster in the Kubernetes cluster. | ||
category: how-to | ||
--- | ||
|
||
# Restart a TiDB Cluster in Kubernetes | ||
|
||
This document describes how to forcibly restart a TiDB cluster in the Kubernetes cluster, including restarting a Pod, restarting all Pods of a component, and restarting all Pods of the TiDB cluster. | ||
|
||
> **Note:** | ||
> | ||
> TiDB Operator v1.0.x only supports restarting the Pod in a forcible way. | ||
> | ||
> - If the PD Pod being restarted is the PD leader, its leadership does not automatically transfer, which can cause the PD service to be temporarily unavailable. | ||
> - If the TiKV Pod being restarted contains a Region leader of the TiKV cluster, its leadership does not automatically transfer, which can cause the requests of accessing the corresponding data to fail. | ||
> - Restarting the TiDB Pod can cause the requests of accessing this Pod to fail. | ||
## Forcibly restart a Pod | ||
|
||
Execute the following command to forcibly restart a Pod: | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
```shell | ||
kubectl delete pod -n <namespace> <pod-name> | ||
``` | ||
|
||
## Forcibly restart all Pods of a component | ||
|
||
Execute the following command to check the Pod list of a component: | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
```shell | ||
kubectl get pod -n <namespace> -l app.kubernetes.io/component=<component-name> | ||
``` | ||
|
||
Execute the following command to forcibly restart all Pods of a component: | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
```shell | ||
kubectl delete pod -n <namespace> -l app.kubernetes.io/component=<component-name> | ||
``` | ||
|
||
> **Note:** | ||
> | ||
> - To forcibly restart all Pods of the `PD`, `TiDB`, or `TiKV` component, replace `<component-name>` in the above commands with `pd`, `tidb`, or `tikv` respectively. | ||
> - Replace `<namespace>` in the above commands with your own namespace. | ||
## Forcibly restart all Pods of the TiDB cluster | ||
|
||
Execute the following command to check the Pod list of the TiDB cluster (including `monitor` and `discovery`): | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
```shell | ||
kubectl get pod -n <namespace> -l app.kubernetes.io/instance=<tidb-cluster-name> | ||
``` | ||
|
||
Execute the following command to forcibly restart all Pods of the TiDB cluster (including `monitor` and `discovery`): | ||
|
||
{{< copyable "shell-regular" >}} | ||
|
||
```shell | ||
kubectl delete pod -n <namespace> -l app.kubernetes.io/instance=<tidb-cluster-name> | ||
``` | ||
|
||
> **Note:** | ||
> | ||
> Replace `<namespace>` and `<tidb-cluster-name>` in the above commands with your own namespace and TiDB cluster name. |