From c8496eba6d397d7ca3f6fb666ae945f0f5eec81a Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Mon, 27 Dec 2021 11:16:54 +0900 Subject: [PATCH] Replace ` ```shell` with ` ```bash` Fix #1501 --- en/access-dashboard.md | 2 +- en/access-tidb.md | 6 +- en/advanced-statefulset.md | 4 +- en/aggregate-multiple-cluster-monitor-data.md | 4 +- en/backup-and-restore-using-helm-charts.md | 20 +-- en/backup-restore-overview.md | 8 +- en/backup-to-aws-s3-using-br.md | 22 +-- en/backup-to-gcs-using-br.md | 14 +- en/backup-to-gcs.md | 14 +- en/backup-to-pv-using-br.md | 14 +- en/backup-to-s3.md | 26 ++-- en/benchmark-sysbench.md | 8 +- en/canary-upgrade-tidb-operator.md | 16 +-- en/cheat-sheet.md | 128 +++++++++--------- en/configure-a-tidb-cluster.md | 2 +- en/configure-backup.md | 6 +- en/configure-storage-class.md | 22 +-- en/deploy-failures.md | 14 +- en/deploy-heterogeneous-tidb-cluster.md | 6 +- en/deploy-multiple-tidb-operator.md | 8 +- en/deploy-on-alibaba-cloud.md | 34 ++--- en/deploy-on-aws-eks.md | 28 ++-- en/deploy-on-azure-aks.md | 48 +++---- en/deploy-on-gcp-gke.md | 34 ++--- en/deploy-on-general-kubernetes.md | 6 +- en/deploy-ticdc.md | 8 +- en/deploy-tidb-binlog.md | 28 ++-- en/deploy-tidb-dm.md | 8 +- en/deploy-tidb-from-kubernetes-gke.md | 36 ++--- en/deploy-tidb-operator.md | 32 ++--- en/deploy-tiflash.md | 18 +-- en/destroy-a-tidb-cluster.md | 10 +- en/enable-admission-webhook.md | 14 +- en/enable-tidb-cluster-auto-scaling.md | 14 +- en/enable-tls-between-components.md | 52 +++---- en/enable-tls-for-dm.md | 6 +- en/enable-tls-for-mysql-client.md | 6 +- en/enable-tls-for-ticdc-sink.md | 4 +- en/exceptions.md | 14 +- en/faq.md | 12 +- en/get-started.md | 32 ++--- en/grant-permissions-to-remote-storage.md | 10 +- en/initialize-a-cluster.md | 10 +- en/maintain-a-kubernetes-node.md | 44 +++--- en/migrate-tidb-to-kubernetes.md | 8 +- en/migrate-to-helm3.md | 18 +-- en/monitor-a-tidb-cluster.md | 8 +- en/network-issues.md | 24 ++-- en/pause-sync-of-tidb-cluster.md | 8 +- en/pd-recover.md | 36 ++--- en/prerequisites.md | 30 ++-- en/recover-deleted-cluster.md | 4 +- en/renew-tls-certificate.md | 16 +-- en/restart-a-tidb-cluster.md | 4 +- en/restore-data-using-tidb-lightning.md | 28 ++-- en/restore-from-aws-s3-using-br.md | 12 +- en/restore-from-gcs-using-br.md | 8 +- en/restore-from-gcs.md | 8 +- en/restore-from-pv-using-br.md | 8 +- en/restore-from-s3.md | 14 +- en/scale-a-tidb-cluster.md | 16 +-- en/tidb-operator-rbac.md | 12 +- en/tidb-scheduler.md | 2 +- en/tidb-toolkit.md | 54 ++++---- en/tips.md | 8 +- en/upgrade-a-tidb-cluster.md | 12 +- en/upgrade-tidb-operator.md | 28 ++-- en/use-auto-failover.md | 4 +- en/use-tidb-dm.md | 4 +- en/use-tkctl.md | 52 +++---- en/view-logs.md | 6 +- zh/access-dashboard.md | 2 +- zh/access-tidb.md | 6 +- zh/advanced-statefulset.md | 4 +- zh/aggregate-multiple-cluster-monitor-data.md | 2 +- zh/backup-and-restore-using-helm-charts.md | 20 +-- zh/backup-restore-overview.md | 8 +- zh/backup-to-aws-s3-using-br.md | 22 +-- zh/backup-to-gcs-using-br.md | 14 +- zh/backup-to-gcs.md | 14 +- zh/backup-to-pv-using-br.md | 14 +- zh/backup-to-s3.md | 28 ++-- zh/benchmark-sysbench.md | 8 +- zh/canary-upgrade-tidb-operator.md | 16 +-- zh/cheat-sheet.md | 128 +++++++++--------- zh/configure-a-tidb-cluster.md | 2 +- zh/configure-backup.md | 6 +- zh/configure-storage-class.md | 20 +-- zh/deploy-failures.md | 8 +- zh/deploy-heterogeneous-tidb-cluster.md | 6 +- zh/deploy-multiple-tidb-operator.md | 8 +- zh/deploy-on-alibaba-cloud.md | 32 ++--- zh/deploy-on-aws-eks.md | 28 ++-- zh/deploy-on-azure-aks.md | 48 +++---- zh/deploy-on-gcp-gke.md | 36 ++--- zh/deploy-on-general-kubernetes.md | 8 +- zh/deploy-ticdc.md | 8 +- zh/deploy-tidb-binlog.md | 28 ++-- zh/deploy-tidb-dm.md | 6 +- zh/deploy-tidb-from-kubernetes-gke.md | 14 +- zh/deploy-tidb-operator.md | 32 ++--- zh/deploy-tiflash.md | 18 +-- zh/destroy-a-tidb-cluster.md | 10 +- zh/enable-admission-webhook.md | 14 +- zh/enable-tidb-cluster-auto-scaling.md | 14 +- zh/enable-tls-between-components.md | 10 +- zh/enable-tls-for-dm.md | 6 +- zh/enable-tls-for-ticdc-sink.md | 4 +- zh/exceptions.md | 14 +- zh/faq.md | 12 +- zh/get-started.md | 28 ++-- zh/grant-permissions-to-remote-storage.md | 10 +- zh/initialize-a-cluster.md | 12 +- zh/maintain-a-kubernetes-node.md | 96 ++++++------- zh/migrate-tidb-to-kubernetes.md | 10 +- zh/migrate-to-helm3.md | 18 +-- zh/monitor-a-tidb-cluster.md | 8 +- zh/network-issues.md | 22 +-- zh/pause-sync-of-tidb-cluster.md | 8 +- zh/pd-recover.md | 36 ++--- zh/prerequisites.md | 30 ++-- zh/recover-deleted-cluster.md | 4 +- zh/renew-tls-certificate.md | 16 +-- zh/restart-a-tidb-cluster.md | 2 +- zh/restore-data-using-tidb-lightning.md | 22 +-- zh/restore-from-aws-s3-using-br.md | 12 +- zh/restore-from-gcs-using-br.md | 8 +- zh/restore-from-gcs.md | 8 +- zh/restore-from-pv-using-br.md | 8 +- zh/restore-from-s3.md | 14 +- zh/scale-a-tidb-cluster.md | 16 +-- zh/tidb-operator-rbac.md | 12 +- zh/tidb-scheduler.md | 2 +- zh/tidb-toolkit.md | 54 ++++---- zh/tips.md | 8 +- zh/upgrade-a-tidb-cluster.md | 12 +- zh/upgrade-tidb-operator.md | 28 ++-- zh/use-auto-failover.md | 4 +- zh/use-tkctl.md | 52 +++---- zh/view-logs.md | 6 +- 140 files changed, 1264 insertions(+), 1264 deletions(-) diff --git a/en/access-dashboard.md b/en/access-dashboard.md index 9c140a36101..63fb42f0cb3 100644 --- a/en/access-dashboard.md +++ b/en/access-dashboard.md @@ -81,7 +81,7 @@ TiDB Dashboard is built in the PD component in TiDB 4.0 and later versions. You {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward svc/basic-discovery -n ${namespace} 10262:10262 ``` diff --git a/en/access-tidb.md b/en/access-tidb.md index a2799b35599..52f552ee85e 100644 --- a/en/access-tidb.md +++ b/en/access-tidb.md @@ -14,7 +14,7 @@ You can obtain TiDB Service information by running the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get svc ${serviceName} -n ${namespace} ``` @@ -47,7 +47,7 @@ To view the Node Port assigned by Service, run the following commands to obtain {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} get svc ${cluster_name}-tidb -ojsonpath="{.spec.ports[?(@.name=='mysql-client')].nodePort}{'\n'}" ``` @@ -58,7 +58,7 @@ To check you can access TiDB services by using the IP of what nodes, see the fol {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pods -l "app.kubernetes.io/component=tidb,app.kubernetes.io/instance=${cluster_name}" -ojsonpath="{range .items[*]}{.spec.nodeName}{'\n'}{end}" ``` diff --git a/en/advanced-statefulset.md b/en/advanced-statefulset.md index 55c74038d17..ae0f213f590 100644 --- a/en/advanced-statefulset.md +++ b/en/advanced-statefulset.md @@ -22,7 +22,7 @@ The [advanced StatefulSet controller](https://github.com/pingcap/advanced-statef {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/advanced-statefulset-crd.v1beta1.yaml ``` @@ -61,7 +61,7 @@ The data format of `AdvancedStatefulSet` is the same as that of `StatefulSet`, b {{< copyable "shell-regular" >}} -```shell +```bash kubectl get -n ${namespace} asts ``` diff --git a/en/aggregate-multiple-cluster-monitor-data.md b/en/aggregate-multiple-cluster-monitor-data.md index b643adfc265..83a2208624d 100644 --- a/en/aggregate-multiple-cluster-monitor-data.md +++ b/en/aggregate-multiple-cluster-monitor-data.md @@ -23,7 +23,7 @@ Thanos provides [Thanos Query](https://thanos.io/tip/components/query.md/) compo {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/monitor-with-thanos/tidb-monitor.yaml ``` @@ -59,7 +59,7 @@ To access the Thanos Query panel, execute the following command, and then access {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${thanos_namespace} svc/thanos-query 9090 ``` diff --git a/en/backup-and-restore-using-helm-charts.md b/en/backup-and-restore-using-helm-charts.md index a3b3c4b5030..a674365c07b 100644 --- a/en/backup-and-restore-using-helm-charts.md +++ b/en/backup-and-restore-using-helm-charts.md @@ -56,7 +56,7 @@ To configure a scheduled full backup, modify the `scheduledBackup` section in th {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-secret -n ${namespace} --from-literal=user=${user} --from-literal=password=${password} ``` @@ -64,7 +64,7 @@ To configure a scheduled full backup, modify the `scheduledBackup` section in th {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade ${release_name} pingcap/tidb-cluster -f values.yaml --version=${version} ``` @@ -88,7 +88,7 @@ Follow the steps below to perform an ad-hoc full backup task: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-secret -n ${namespace} --from-literal=user=${user} --from-literal=password=${password} ``` @@ -96,7 +96,7 @@ Follow the steps below to perform an ad-hoc full backup task: {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${backup_name} pingcap/tidb-backup --namespace=${namespace} -f values.yaml --version=${version} ``` @@ -106,7 +106,7 @@ For backups stored in PV, you can view them by using the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pvc -n ${namespace} -l app.kubernetes.io/component=backup,pingcap.com/backup-cluster-name=${cluster_name} ``` @@ -124,7 +124,7 @@ The `pingcap/tidb-backup` helm chart helps restore a TiDB cluster using backup d {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-secret -n ${namespace} --from-literal=user=${user} --from-literal=password=${password} ``` @@ -132,7 +132,7 @@ The `pingcap/tidb-backup` helm chart helps restore a TiDB cluster using backup d {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${restore_name} pingcap/tidb-backup --namespace=${namespace} -f values.yaml --version=${version} ``` @@ -152,7 +152,7 @@ To scale in Pump, for each Pump node, make the node offline and then run the `he {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run offline-pump-${ordinal_id} --image=pingcap/tidb-binlog:${version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${release_name}-pd:2379 -cmd offline-pump -node-id ${release_name}-pump-${ordinal_id}:8250 ``` @@ -160,7 +160,7 @@ To scale in Pump, for each Pump node, make the node offline and then run the `he {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs -f -n ${namespace} ${release_name}-pump-${ordinal_id} ``` @@ -170,6 +170,6 @@ To scale in Pump, for each Pump node, make the node offline and then run the `he {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade ${release_name} pingcap/tidb-cluster -f values.yaml --version=${chart_version} ``` diff --git a/en/backup-restore-overview.md b/en/backup-restore-overview.md index d714b7c97bd..810eeada183 100644 --- a/en/backup-restore-overview.md +++ b/en/backup-restore-overview.md @@ -91,7 +91,7 @@ This section introduces the fields in the `Backup` CR. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path} ``` @@ -246,7 +246,7 @@ This section introduces the fields in the `Restore` CR. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path} ``` @@ -296,7 +296,7 @@ You can delete the `Backup` CR or `BackupSchedule` CR by running the following c {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete backup ${name} -n ${namespace} kubectl delete backupschedule ${name} -n ${namespace} ``` @@ -311,7 +311,7 @@ To address this issue, delete `finalizers` by running the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit backup ${name} -n ${namespace} ``` diff --git a/en/backup-to-aws-s3-using-br.md b/en/backup-to-aws-s3-using-br.md index fdcb3c922f5..3db14c4c8e5 100644 --- a/en/backup-to-aws-s3-using-br.md +++ b/en/backup-to-aws-s3-using-br.md @@ -30,7 +30,7 @@ Before you perform ad-hoc backup, AWS account permissions need to be granted. Th {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test1 ``` @@ -44,7 +44,7 @@ Before you perform ad-hoc backup, AWS account permissions need to be granted. Th {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password=${password} --namespace=test1 ``` @@ -58,7 +58,7 @@ Before you perform ad-hoc backup, AWS account permissions need to be granted. Th {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-aws-s3.yaml ``` @@ -105,7 +105,7 @@ Before you perform ad-hoc backup, AWS account permissions need to be granted. Th {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-aws-s3.yaml ``` @@ -153,7 +153,7 @@ Before you perform ad-hoc backup, AWS account permissions need to be granted. Th {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-aws-s3.yaml ``` @@ -208,7 +208,7 @@ After you create the `Backup` CR, view the backup status by running the followin {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bk -n test1 -o wide ``` @@ -226,7 +226,7 @@ The prerequisites for the scheduled full backup is the same as the [prerequisite {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-scheduler-aws-s3.yaml ``` @@ -276,7 +276,7 @@ The prerequisites for the scheduled full backup is the same as the [prerequisite {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-scheduler-aws-s3.yaml ``` @@ -327,7 +327,7 @@ The prerequisites for the scheduled full backup is the same as the [prerequisite {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-scheduler-aws-s3.yaml ``` @@ -377,7 +377,7 @@ After creating the scheduled full backup, use the following command to check the {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bks -n test1 -o wide ``` @@ -385,7 +385,7 @@ You can use the following command to check all the backup items: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-s3 -n test1 ``` diff --git a/en/backup-to-gcs-using-br.md b/en/backup-to-gcs-using-br.md index 1b23b4134b9..af5b00da0ca 100644 --- a/en/backup-to-gcs-using-br.md +++ b/en/backup-to-gcs-using-br.md @@ -25,7 +25,7 @@ This document provides examples in which the data of the `demo1` TiDB cluster in {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test1 ``` @@ -37,7 +37,7 @@ This document provides examples in which the data of the `demo1` TiDB cluster in {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password= --namespace=test1 ``` @@ -51,7 +51,7 @@ This document provides examples in which the data of the `demo1` TiDB cluster in {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-gcs.yaml ``` @@ -107,7 +107,7 @@ This document provides examples in which the data of the `demo1` TiDB cluster in {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -n test1 -owide ``` @@ -125,7 +125,7 @@ The prerequisites for the scheduled full backup is the same with the [prerequisi {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-gcs.yaml ``` @@ -175,7 +175,7 @@ The prerequisites for the scheduled full backup is the same with the [prerequisi {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bks -n test1 -owide ``` @@ -183,7 +183,7 @@ The prerequisites for the scheduled full backup is the same with the [prerequisi {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-gcs -n test1 ``` diff --git a/en/backup-to-gcs.md b/en/backup-to-gcs.md index 0b4f1729ba0..9a08b9684b2 100644 --- a/en/backup-to-gcs.md +++ b/en/backup-to-gcs.md @@ -30,7 +30,7 @@ To better explain how to perform the backup operation, this document shows an ex {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test1 ``` @@ -42,7 +42,7 @@ To better explain how to perform the backup operation, this document shows an ex {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password=${password} --namespace=test1 ``` @@ -52,7 +52,7 @@ To better explain how to perform the backup operation, this document shows an ex {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-gcs.yaml ``` @@ -108,7 +108,7 @@ To better explain how to perform the backup operation, this document shows an ex {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -n test1 -owide ``` @@ -126,7 +126,7 @@ The prerequisites for the scheduled backup is the same as the [prerequisites for {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-gcs.yaml ``` @@ -175,7 +175,7 @@ The prerequisites for the scheduled backup is the same as the [prerequisites for {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bks -n test1 -owide ``` @@ -183,7 +183,7 @@ The prerequisites for the scheduled backup is the same as the [prerequisites for {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-gcs -n test1 ``` diff --git a/en/backup-to-pv-using-br.md b/en/backup-to-pv-using-br.md index f15172bb8ad..0e82a588c1c 100644 --- a/en/backup-to-pv-using-br.md +++ b/en/backup-to-pv-using-br.md @@ -29,7 +29,7 @@ This document provides examples in which the data of the `demo1` TiDB cluster in {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test1 ``` @@ -37,7 +37,7 @@ This document provides examples in which the data of the `demo1` TiDB cluster in {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password= --namespace=test1 ``` @@ -70,7 +70,7 @@ This document provides examples in which the data of the `demo1` TiDB cluster in {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-nfs.yaml ``` @@ -129,7 +129,7 @@ This document provides examples in which the data of the `demo1` TiDB cluster in {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -n test1 -owide ``` @@ -147,7 +147,7 @@ The prerequisites for the scheduled full backup is the same with the [prerequisi {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-nfs.yaml ``` @@ -198,7 +198,7 @@ The prerequisites for the scheduled full backup is the same with the [prerequisi {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bks -n test1 -owide ``` @@ -206,7 +206,7 @@ The prerequisites for the scheduled full backup is the same with the [prerequisi {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-nfs -n test1 ``` diff --git a/en/backup-to-s3.md b/en/backup-to-s3.md index cf3209515fb..e09501d29c4 100644 --- a/en/backup-to-s3.md +++ b/en/backup-to-s3.md @@ -22,7 +22,7 @@ For the current S3-compatible storage types, Ceph and Amazon S3 work normally as {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/backup/backup-rbac.yaml -n tidb-cluster ``` @@ -36,7 +36,7 @@ For the current S3-compatible storage types, Ceph and Amazon S3 work normally as {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password=${password} --namespace=tidb-cluster ``` @@ -89,7 +89,7 @@ GRANT {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-s3.yaml ``` @@ -133,7 +133,7 @@ GRANT {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-s3.yaml ``` @@ -174,7 +174,7 @@ GRANT {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-s3.yaml ``` @@ -277,7 +277,7 @@ After creating the `Backup` CR, use the following command to check the backup st {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bk -n tidb-cluster -owide ``` @@ -285,7 +285,7 @@ To get detailed information on a backup job, use the following command. For `$ba {{< copyable "shell-regular" >}} -```shell +```bash kubectl describe bk -n tidb-cluster $backup_job_name ``` @@ -320,7 +320,7 @@ The prerequisites for the scheduled backup is the same as the [prerequisites for {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-s3.yaml ``` @@ -369,7 +369,7 @@ The prerequisites for the scheduled backup is the same as the [prerequisites for {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-s3.yaml ``` @@ -415,7 +415,7 @@ The prerequisites for the scheduled backup is the same as the [prerequisites for {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-s3.yaml ``` @@ -465,7 +465,7 @@ The prerequisites for the scheduled backup is the same as the [prerequisites for {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-s3.yaml ``` @@ -514,7 +514,7 @@ After creating the scheduled full backup, you can use the following command to c {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bks -n tidb-cluster -owide ``` @@ -522,7 +522,7 @@ You can use the following command to check all the backup items: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-s3 -n tidb-cluster ``` diff --git a/en/benchmark-sysbench.md b/en/benchmark-sysbench.md index 5b21b942ee1..52b58cfdd1d 100644 --- a/en/benchmark-sysbench.md +++ b/en/benchmark-sysbench.md @@ -124,7 +124,7 @@ The core is configured as below: {{< copyable "shell-regular" >}} -```shell +```bash sysctl net.core.somaxconn=32768 sysctl vm.swappiness=0 sysctl net.ipv4.tcp_syncookies=0 @@ -142,7 +142,7 @@ Before the test, the `prewarm` command of `oltp_common` is used to warm up data. {{< copyable "shell-regular" >}} -```shell +```bash sysbench \ --mysql-host=${tidb_host} \ --mysql-port=4000 \ @@ -166,7 +166,7 @@ sysbench \ {{< copyable "shell-regular" >}} -```shell +```bash sysbench \ --mysql-host=${tidb_host} \ --mysql-port=4000 \ @@ -188,7 +188,7 @@ sysbench \ {{< copyable "shell-regular" >}} -```shell +```bash sysbench \ --mysql-host=${tidb_host} \ --mysql-port=4000 \ diff --git a/en/canary-upgrade-tidb-operator.md b/en/canary-upgrade-tidb-operator.md index d5f1aac6520..48c164459d0 100644 --- a/en/canary-upgrade-tidb-operator.md +++ b/en/canary-upgrade-tidb-operator.md @@ -62,7 +62,7 @@ To support canary upgrade, some parameters are added to the `values.yaml` file i {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} label tc ${cluster_name} version=canary ``` @@ -70,7 +70,7 @@ To support canary upgrade, some parameters are added to the `values.yaml` file i 1. View the log of `tidb-controller-manager` of the current TiDB Operator: - ```shell + ```bash kubectl -n tidb-admin logs tidb-controller-manager-55b887bdc9-lzdwv ``` @@ -80,7 +80,7 @@ To support canary upgrade, some parameters are added to the `values.yaml` file i 2. View the log of `tidb-controller-manager` of the canary TiDB Operator: - ```shell + ```bash kubectl -n tidb-admin-canary logs tidb-controller-manager-canary-6dcb9bdd95-qf4qr ``` @@ -92,7 +92,7 @@ To support canary upgrade, some parameters are added to the `values.yaml` file i {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} edit tc ${cluster_name} ``` @@ -100,7 +100,7 @@ To support canary upgrade, some parameters are added to the `values.yaml` file i Check the logs of `tidb-scheduler` of the canary TiDB Operator, and you can see this TiDB cluster is now using the canary `tidb-scheduler`: - ```shell + ```bash kubectl -n tidb-admin-canary logs tidb-scheduler-canary-7f7b6c7c6-j5p2j -c tidb-scheduler ``` @@ -108,19 +108,19 @@ To support canary upgrade, some parameters are added to the `values.yaml` file i {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} label tc ${cluster_name} version- ``` {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} edit tc ${cluster_name} ``` 6. Delete the canary TiDB Operator: - ```shell + ```bash helm -n tidb-admin-canary uninstall ${release_name} ``` diff --git a/en/cheat-sheet.md b/en/cheat-sheet.md index be85bf0f7ab..2b295fdcf21 100644 --- a/en/cheat-sheet.md +++ b/en/cheat-sheet.md @@ -16,7 +16,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get crd ``` @@ -24,7 +24,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get tc ${name} ``` @@ -32,7 +32,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get tidbmonitor ${name} ``` @@ -40,7 +40,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get bk ${name} ``` @@ -48,7 +48,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get bks ${name} ``` @@ -56,7 +56,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get restore ${name} ``` @@ -64,7 +64,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get tidbclusterautoscaler ${name} ``` @@ -72,7 +72,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get tidbinitializer ${name} ``` @@ -80,7 +80,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get asts ${name} ``` @@ -88,7 +88,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pod ${name} ``` @@ -96,19 +96,19 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pod -l app.kubernetes.io/component=tikv ``` View the continuous status change of a Pod: - ```shell + ```bash watch kubectl -n ${namespace} get pod ``` View the detailed information of a Pod: - ```shell + ```bash kubectl -n ${namespace} describe pod ${name} ``` @@ -116,7 +116,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pods -l "app.kubernetes.io/component=tidb,app.kubernetes.io/instance=${cluster_name}" -ojsonpath="{range .items[*]}{.spec.nodeName}{'\n'}{end}" ``` @@ -124,7 +124,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get service ${name} ``` @@ -132,7 +132,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get cm ${name} ``` @@ -140,7 +140,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pv ${name} ``` @@ -148,7 +148,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pv -l app.kubernetes.io/namespace=${namespace},app.kubernetes.io/managed-by=tidb-operator,app.kubernetes.io/instance=${cluster_name} ``` @@ -156,7 +156,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pvc ${name} ``` @@ -164,7 +164,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get sc ``` @@ -172,7 +172,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get sts ${name} ``` @@ -180,7 +180,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} describe sts ${name} ``` @@ -190,7 +190,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} annotate tc ${cluster_name} ${key}=${value} ``` @@ -198,7 +198,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} annotate --overwrite tc ${cluster_name} tidb.pingcap.com/force-upgrade=true ``` @@ -206,7 +206,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} annotate tc ${cluster_name} tidb.pingcap.com/force-upgrade- ``` @@ -214,7 +214,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} annotate pod ${pod_name} runmode=debug ``` @@ -224,7 +224,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} edit tc ${name} ``` @@ -234,7 +234,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pv ${name} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` @@ -242,7 +242,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} patch pvc ${name} -p '{"spec": {"resources": {"requests": {"storage": "100Gi"}}}' ``` @@ -250,7 +250,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch storageclass ${name} -p '{"allowVolumeExpansion": true}' ``` @@ -260,7 +260,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} apply -f ${file} ``` @@ -268,7 +268,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create ns ${namespace} ``` @@ -278,7 +278,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} create secret generic ${secret_name} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path} ``` @@ -286,7 +286,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} create secret generic ${secret_name} --from-literal=user=${user} --from-literal=password=${password} ``` @@ -296,7 +296,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} -it exec ${pod_name} -- cat /etc/pd/pd.toml ``` @@ -304,7 +304,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} -it exec ${pod_name} -- cat /etc/tidb/tidb.toml ``` @@ -312,7 +312,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} -it exec ${pod_name} -- cat /etc/tikv/tikv.toml ``` @@ -320,7 +320,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} logs ${pod_name} -f ``` @@ -328,7 +328,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} logs ${pod_name} -p ``` @@ -336,7 +336,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} logs ${pod_name} -c ${container_name} ``` @@ -344,7 +344,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} port-forward svc/${service_name} ${local_port}:${port_in_pod} ``` @@ -352,7 +352,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} port-forward svc/${cluster_name}-pd 2379:2379 ``` @@ -362,7 +362,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl cordon ${node_name} ``` @@ -370,7 +370,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl uncordon ${node_name} ``` @@ -380,7 +380,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pod ${pod_name} ``` @@ -388,7 +388,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pvc ${pvc_name} ``` @@ -396,7 +396,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} tc ${tc_name} ``` @@ -404,7 +404,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} tidbmonitor ${tidb_monitor_name} ``` @@ -412,7 +412,7 @@ This document is an overview of the commands used for TiDB cluster management. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} delete tidbclusterautoscaler ${name} ``` @@ -426,7 +426,7 @@ See [kubectl Cheat Sheet](https://kubernetes.io/docs/reference/kubectl/cheatshee {{< copyable "shell-regular" >}} -```shell +```bash helm repo add pingcap https://charts.pingcap.org/ ``` @@ -434,7 +434,7 @@ helm repo add pingcap https://charts.pingcap.org/ {{< copyable "shell-regular" >}} -```shell +```bash helm repo update ``` @@ -444,7 +444,7 @@ helm repo update {{< copyable "shell-regular" >}} - ```shell + ```bash helm search hub ${chart_name} ``` @@ -452,7 +452,7 @@ helm repo update {{< copyable "shell-regular" >}} - ```shell + ```bash helm search hub mysql ``` @@ -460,7 +460,7 @@ helm repo update {{< copyable "shell-regular" >}} - ```shell + ```bash helm search repo ${chart_name} -l --devel ``` @@ -468,7 +468,7 @@ helm repo update {{< copyable "shell-regular" >}} - ```shell + ```bash helm search repo tidb-operator -l --devel ``` @@ -476,7 +476,7 @@ helm repo update {{< copyable "shell-regular" >}} -```shell +```bash helm inspect values ${chart_name} --version=${chart_version} > values.yaml ``` @@ -484,7 +484,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash helm inspect values pingcap/tidb-operator --version=v1.2.4 > values-tidb-operator.yaml ``` @@ -492,7 +492,7 @@ helm inspect values pingcap/tidb-operator --version=v1.2.4 > values-tidb-operato {{< copyable "shell-regular" >}} -```shell +```bash helm install ${name} ${chart_name} --namespace=${namespace} --version=${chart_version} -f ${values_file} ``` @@ -500,7 +500,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash helm install tidb-operator pingcap/tidb-operator --namespace=tidb-admin --version=v1.2.4 -f values-tidb-operator.yaml ``` @@ -508,7 +508,7 @@ helm install tidb-operator pingcap/tidb-operator --namespace=tidb-admin --versio {{< copyable "shell-regular" >}} -```shell +```bash helm ls ``` @@ -516,7 +516,7 @@ helm ls {{< copyable "shell-regular" >}} -```shell +```bash helm upgrade ${name} ${chart_name} --version=${chart_version} -f ${values_file} ``` @@ -524,7 +524,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash helm upgrade tidb-operator pingcap/tidb-operator --version=v1.2.4 -f values-tidb-operator.yaml ``` @@ -532,7 +532,7 @@ helm upgrade tidb-operator pingcap/tidb-operator --version=v1.2.4 -f values-tidb {{< copyable "shell-regular" >}} -```shell +```bash helm uninstall ${name} -n ${namespace} ``` @@ -540,7 +540,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash helm uninstall tidb-operator -n tidb-admin ``` diff --git a/en/configure-a-tidb-cluster.md b/en/configure-a-tidb-cluster.md index 73743d1baa3..8d138ebca69 100644 --- a/en/configure-a-tidb-cluster.md +++ b/en/configure-a-tidb-cluster.md @@ -656,7 +656,7 @@ To add the data high availability feature in Kubernetes: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl label node ${node_name} region=${region_name} zone=${zone_name} rack=${rack_name} kubernetes.io/hostname=${host_name} ``` diff --git a/en/configure-backup.md b/en/configure-backup.md index b143fefdf46..58b28ef2508 100644 --- a/en/configure-backup.md +++ b/en/configure-backup.md @@ -39,7 +39,7 @@ aliases: ['/docs/tidb-in-kubernetes/dev/configure-backup/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-secret -n ${namespace} --from-literal=user=root --from-literal=password=${password} ``` @@ -81,7 +81,7 @@ aliases: ['/docs/tidb-in-kubernetes/dev/configure-backup/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic gcp-backup-secret -n ${namespace} --from-file=./credentials.json ``` @@ -107,6 +107,6 @@ aliases: ['/docs/tidb-in-kubernetes/dev/configure-backup/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ceph-backup-secret -n ${namespace} --from-literal=access_key=${access_key} --from-literal=secret_key=${secret_key} ``` diff --git a/en/configure-storage-class.md b/en/configure-storage-class.md index d03b51d20de..1ad69e894b7 100644 --- a/en/configure-storage-class.md +++ b/en/configure-storage-class.md @@ -38,7 +38,7 @@ Kubernetes 1.11 and later versions support [volume expansion of network PV](http {{< copyable "shell-regular" >}} -```shell +```bash kubectl patch storageclass ${storage_class} -p '{"allowVolumeExpansion": true}' ``` @@ -50,7 +50,7 @@ After volume expansion is enabled, expand the PV using the following method: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pvc -n ${namespace} ${pvc_name} -p '{"spec": {"resources": {"requests": {"storage": "100Gi"}}}' ``` @@ -60,7 +60,7 @@ After volume expansion is enabled, expand the PV using the following method: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pv | grep ${pvc_name} ``` @@ -76,7 +76,7 @@ The following process uses `/mnt/disks` as the discovery directory and `local-st {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/local-dind/local-volume-provisioner.yaml ``` @@ -84,7 +84,7 @@ The following process uses `/mnt/disks` as the discovery directory and `local-st {{< copyable "shell-regular" >}} - ```shell + ```bash wget https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/local-dind/local-volume-provisioner.yaml && kubectl apply -f ./local-volume-provisioner.yaml ``` @@ -102,7 +102,7 @@ The following process uses `/mnt/disks` as the discovery directory and `local-st {{< copyable "shell-regular" >}} - ```shell + ```bash docker load -i local-volume-provisioner-v2.3.4.tar ``` @@ -110,7 +110,7 @@ The following process uses `/mnt/disks` as the discovery directory and `local-st {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get po -n kube-system -l app=local-volume-provisioner && kubectl get pv | grep local-storage ``` @@ -253,7 +253,7 @@ Finally, execute the `kubectl apply` command to deploy `local-volume-provisioner {{< copyable "shell-regular" >}} -```shell +```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/local-dind/local-volume-provisioner.yaml ``` @@ -285,7 +285,7 @@ In general, after a PVC is no longer used and deleted, the PV bound to it is rec {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pv ${pv_name} -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' ``` @@ -301,7 +301,7 @@ When the reclaim policy of PVs is set to `Retain`, if you have confirmed that th {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete pvc ${pvc_name} --namespace=${namespace} ``` @@ -309,7 +309,7 @@ When the reclaim policy of PVs is set to `Retain`, if you have confirmed that th {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pv ${pv_name} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` diff --git a/en/deploy-failures.md b/en/deploy-failures.md index 405d68f2724..c7746540480 100644 --- a/en/deploy-failures.md +++ b/en/deploy-failures.md @@ -13,7 +13,7 @@ After creating a cluster, if the Pod is not created, you can diagnose it using t {{< copyable "shell-regular" >}} -```shell +```bash kubectl get tidbclusters -n ${namespace} && \ kubectl describe tidbclusters -n ${namespace} ${cluster_name} && \ kubectl get statefulsets -n ${namespace} && \ @@ -24,7 +24,7 @@ After creating a backup/restore task, if the Pod is not created, you can perform {{< copyable "shell-regular" >}} -```shell +```bash kubectl get backups -n ${namespace} kubectl get jobs -n ${namespace} kubectl describe backups -n ${namespace} ${backup_name} @@ -45,7 +45,7 @@ You can check the specific reason for Pending by using the `kubectl describe pod {{< copyable "shell-regular" >}} -```shell +```bash kubectl describe po -n ${namespace} ${pod_name} ``` @@ -61,7 +61,7 @@ If the `StorageClass` of the PVC cannot be found, take the following steps: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get storageclass ``` @@ -76,7 +76,7 @@ If the `StorageClass` of the PVC cannot be found, take the following steps: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete pvc -n ${namespace} ${pvc_name} && \ kubectl delete sts -n ${namespace} ${statefulset_name} ``` @@ -99,7 +99,7 @@ A Pod in the `CrashLoopBackOff` state means that the container in the Pod repeat {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} logs -f ${pod_name} ``` @@ -107,7 +107,7 @@ kubectl -n ${namespace} logs -f ${pod_name} {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} logs -p ${pod_name} ``` diff --git a/en/deploy-heterogeneous-tidb-cluster.md b/en/deploy-heterogeneous-tidb-cluster.md index dab4eb79444..c3f7da3764b 100644 --- a/en/deploy-heterogeneous-tidb-cluster.md +++ b/en/deploy-heterogeneous-tidb-cluster.md @@ -64,7 +64,7 @@ Execute the following command to create the heterogeneous cluster: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f cluster.yaml -n ${namespace} ``` @@ -104,7 +104,7 @@ Execute the following command to create the heterogeneous cluster: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f tidbmonitor.yaml -n ${namespace} ``` @@ -175,7 +175,7 @@ Execute the following command to create the TLS-enabled heterogeneous cluster: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f cluster.yaml -n ${namespace} ``` diff --git a/en/deploy-multiple-tidb-operator.md b/en/deploy-multiple-tidb-operator.md index d41f18cfe82..ce69da3ea45 100644 --- a/en/deploy-multiple-tidb-operator.md +++ b/en/deploy-multiple-tidb-operator.md @@ -87,7 +87,7 @@ To support deploying multiple sets of TiDB Operator, the following parameters ar {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} label tidbcluster ${cluster_name} user=dev ``` @@ -137,7 +137,7 @@ To support deploying multiple sets of TiDB Operator, the following parameters ar {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} label tidbcluster ${cluster_name} user=qa ``` @@ -149,7 +149,7 @@ To support deploying multiple sets of TiDB Operator, the following parameters ar View the log of `tidb-controller-manager` of the first TiDB Operator: - ```shell + ```bash kubectl -n tidb-admin logs tidb-controller-manager-55b887bdc9-lzdwv ``` @@ -167,7 +167,7 @@ To support deploying multiple sets of TiDB Operator, the following parameters ar View the log of `tidb-controller-manager` of the second TiDB Operator: - ```shell + ```bash kubectl -n tidb-admin-qa logs tidb-controller-manager-qa-5dfcd7f9-vll4c ``` diff --git a/en/deploy-on-alibaba-cloud.md b/en/deploy-on-alibaba-cloud.md index c06807070c6..0c1f4d4685e 100644 --- a/en/deploy-on-alibaba-cloud.md +++ b/en/deploy-on-alibaba-cloud.md @@ -64,7 +64,7 @@ All the instances except ACK mandatory workers are deployed across availability {{< copyable "shell-regular" >}} - ```shell + ```bash export TF_VAR_ALICLOUD_REGION=${REGION} && \ export TF_VAR_ALICLOUD_ACCESS_KEY=${ACCESS_KEY} && \ export TF_VAR_ALICLOUD_SECRET_KEY=${SECRET_KEY} @@ -76,7 +76,7 @@ All the instances except ACK mandatory workers are deployed across availability {{< copyable "shell-regular" >}} - ```shell + ```bash git clone --depth=1 https://github.com/pingcap/tidb-operator && \ cd tidb-operator/deploy/aliyun ``` @@ -104,7 +104,7 @@ All the instances except ACK mandatory workers are deployed across availability {{< copyable "shell-regular" >}} - ```shell + ```bash terraform init ``` @@ -112,7 +112,7 @@ All the instances except ACK mandatory workers are deployed across availability {{< copyable "shell-regular" >}} - ```shell + ```bash terraform apply ``` @@ -145,19 +145,19 @@ All the instances except ACK mandatory workers are deployed across availability {{< copyable "shell-regular" >}} - ```shell + ```bash export KUBECONFIG=$PWD/credentials/kubeconfig ``` {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl version ``` {{< copyable "shell-regular" >}} - ```shell + ```bash helm ls ``` @@ -167,7 +167,7 @@ All the instances except ACK mandatory workers are deployed across availability {{< copyable "shell-regular" >}} - ```shell + ```bash cp manifests/db.yaml.example db.yaml && cp manifests/db-monitor.yaml.example db-monitor.yaml ``` @@ -247,7 +247,7 @@ All the instances except ACK mandatory workers are deployed across availability {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl --kubeconfig credentials/kubeconfig create namespace ${namespace} ``` @@ -259,7 +259,7 @@ All the instances except ACK mandatory workers are deployed across availability {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl --kubeconfig credentials/kubeconfig create -f db.yaml -n ${namespace} && kubectl --kubeconfig credentials/kubeconfig create -f db-monitor.yaml -n ${namespace} ``` @@ -274,13 +274,13 @@ You can connect the TiDB cluster via the bastion instance. All necessary informa {{< copyable "shell-regular" >}} -```shell +```bash ssh -i credentials/${cluster_name}-key.pem root@${bastion_ip} ``` {{< copyable "shell-regular" >}} -```shell +```bash mysql --comments -h ${tidb_lb_ip} -P 4000 -u root ``` @@ -312,7 +312,7 @@ This may take a while to complete. You can watch the process using the following {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pods --namespace ${namespace} -o wide --watch ``` @@ -422,7 +422,7 @@ It is recommended to use a separate Terraform module to manage a specific Kubern {{< copyable "shell-regular" >}} - ```shell + ```bash mkdir -p deploy/aliyun-staging ``` @@ -491,7 +491,7 @@ You can customize this script. For example, you can remove the `module "bastion" {{< copyable "shell-regular" >}} - ```shell + ```bash terraform destroy ``` @@ -499,13 +499,13 @@ If the Kubernetes cluster is not successfully created, the `destroy` operation m {{< copyable "shell-regular" >}} -```shell +```bash terraform state list ``` {{< copyable "shell-regular" >}} -```shell +```bash terraform state rm module.ack.alicloud_cs_managed_kubernetes.k8s ``` diff --git a/en/deploy-on-aws-eks.md b/en/deploy-on-aws-eks.md index b11a0a66e55..e9c536c56a9 100644 --- a/en/deploy-on-aws-eks.md +++ b/en/deploy-on-aws-eks.md @@ -152,7 +152,7 @@ Execute the following command to create the cluster: {{< copyable "shell-regular" >}} -```shell +```bash eksctl create cluster -f cluster.yaml ``` @@ -270,7 +270,7 @@ The following `c5d.4xlarge` example shows how to configure StorageClass for the {{< copyable "shell-regular" >}} - ```shell + ```bash eksctl create nodegroups -f cluster.yaml ``` @@ -291,7 +291,7 @@ The following `c5d.4xlarge` example shows how to configure StorageClass for the {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f ``` @@ -315,7 +315,7 @@ To create a namespace to deploy the TiDB cluster, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create namespace tidb-cluster ``` @@ -329,7 +329,7 @@ First, download the sample `TidbCluster` and `TidbMonitor` configuration files: {{< copyable "shell-regular" >}} -```shell +```bash curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/aws/tidb-cluster.yaml && \ curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/aws/tidb-monitor.yaml ``` @@ -344,7 +344,7 @@ To deploy the `TidbCluster` and `TidbMonitor` CR in the EKS cluster, run the fol {{< copyable "shell-regular" >}} -```shell +```bash kubectl apply -f tidb-cluster.yaml -n tidb-cluster && \ kubectl apply -f tidb-monitor.yaml -n tidb-cluster ``` @@ -361,7 +361,7 @@ To view the status of the starting TiDB cluster, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pods -n tidb-cluster ``` @@ -393,7 +393,7 @@ Select the cluster's VPC and Subnet, and verify whether the cluster name is corr {{< copyable "shell-regular" >}} -```shell +```bash eksctl get cluster -n ${clusterName} ``` @@ -411,7 +411,7 @@ After the bastion host is created, you can connect to the bastion host via SSH a {{< copyable "shell-regular" >}} - ```shell + ```bash ssh [-i /path/to/your/private-key.pem] ec2-user@ ``` @@ -419,7 +419,7 @@ After the bastion host is created, you can connect to the bastion host via SSH a {{< copyable "shell-regular" >}} - ```shell + ```bash sudo yum install mysql -y ``` @@ -427,7 +427,7 @@ After the bastion host is created, you can connect to the bastion host via SSH a {{< copyable "shell-regular" >}} - ```shell + ```bash mysql --comments -h ${tidb-nlb-dnsname} -P 4000 -u root ``` @@ -435,7 +435,7 @@ After the bastion host is created, you can connect to the bastion host via SSH a For example: - ```shell + ```bash $ mysql --comments -h abfc623004ccb4cc3b363f3f37475af1-9774d22c27310bc1.elb.us-west-2.amazonaws.com -P 4000 -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 1189 @@ -470,7 +470,7 @@ Obtain the LoadBalancer domain name of Grafana: {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n tidb-cluster get svc basic-grafana ``` @@ -512,7 +512,7 @@ When scaling out TiKV, the node groups must be scaled out evenly among the diffe {{< copyable "shell-regular" >}} -```shell +```bash eksctl scale nodegroup --cluster ${clusterName} --name tikv-1a --nodes 2 --nodes-min 2 --nodes-max 2 eksctl scale nodegroup --cluster ${clusterName} --name tikv-1c --nodes 2 --nodes-min 2 --nodes-max 2 eksctl scale nodegroup --cluster ${clusterName} --name tikv-1d --nodes 2 --nodes-min 2 --nodes-max 2 diff --git a/en/deploy-on-azure-aks.md b/en/deploy-on-azure-aks.md index 6c4334c1e28..893ddeb2eb9 100644 --- a/en/deploy-on-azure-aks.md +++ b/en/deploy-on-azure-aks.md @@ -28,7 +28,7 @@ Before deploying a TiDB cluster on Azure AKS, perform the following operations: {{< copyable "shell-regular" >}} - ```shell + ```bash az extension add --name aks-preview ``` @@ -36,7 +36,7 @@ Before deploying a TiDB cluster on Azure AKS, perform the following operations: {{< copyable "shell-regular" >}} - ```shell + ```bash az feature register --name EnableAzureDiskFileCSIDriver --namespace Microsoft.ContainerService --subscription ${your-subscription-id} ``` @@ -54,7 +54,7 @@ To create an AKS cluster with [CSI enabled](https://docs.microsoft.com/en-us/azu {{< copyable "shell-regular" >}} -```shell +```bash # create AKS cluster az aks create \ --resource-group ${resourceGroup} \ @@ -76,7 +76,7 @@ After creating an AKS cluster, run the following commands to create component no {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name admin \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -90,7 +90,7 @@ After creating an AKS cluster, run the following commands to create component no {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name pd \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -106,7 +106,7 @@ After creating an AKS cluster, run the following commands to create component no {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tidb \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -122,7 +122,7 @@ After creating an AKS cluster, run the following commands to create component no {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -143,7 +143,7 @@ The Azure AKS cluster deploys nodes across multiple zones using "best effort zon {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv1 \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -160,7 +160,7 @@ The Azure AKS cluster deploys nodes across multiple zones using "best effort zon {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv2 \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -177,7 +177,7 @@ The Azure AKS cluster deploys nodes across multiple zones using "best effort zon {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv3 \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -222,7 +222,7 @@ To create a namespace to deploy the TiDB cluster, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create namespace tidb-cluster ``` @@ -236,7 +236,7 @@ First, download the sample `TidbCluster` and `TidbMonitor` configuration files: {{< copyable "shell-regular" >}} -```shell +```bash curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/aks/tidb-cluster.yaml && \ curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/aks/tidb-monitor.yaml ``` @@ -251,7 +251,7 @@ To deploy the `TidbCluster` and `TidbMonitor` CR in the AKS cluster, run the fol {{< copyable "shell-regular" >}} -```shell +```bash kubectl apply -f tidb-cluster.yaml -n tidb-cluster && \ kubectl apply -f tidb-monitor.yaml -n tidb-cluster ``` @@ -264,7 +264,7 @@ To view the status of the TiDB cluster, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pods -n tidb-cluster ``` @@ -314,7 +314,7 @@ After access to the internal host via SSH, you can access the TiDB cluster throu {{< copyable "shell-regular" >}} - ```shell + ```bash sudo yum install mysql -y ``` @@ -322,7 +322,7 @@ After access to the internal host via SSH, you can access the TiDB cluster throu {{< copyable "shell-regular" >}} - ```shell + ```bash mysql --comments -h ${tidb-lb-ip} -P 4000 -u root ``` @@ -330,7 +330,7 @@ After access to the internal host via SSH, you can access the TiDB cluster throu For example: - ```shell + ```bash $ mysql --comments -h 20.240.0.7 -P 4000 -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 1189 @@ -365,13 +365,13 @@ Obtain the LoadBalancer IP address of Grafana: {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n tidb-cluster get svc basic-grafana ``` For example: -```shell +```bash kubectl get svc basic-grafana NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE basic-grafana LoadBalancer 10.100.199.42 20.240.0.8 3000:30761/TCP 121m @@ -407,7 +407,7 @@ When scaling out TiKV, the node pools must be scaled out evenly among availabili {{< copyable "shell-regular" >}} -```shell +```bash az aks nodepool scale \ --resource-group ${resourceGroup} \ --cluster-name ${clusterName} \ @@ -437,7 +437,7 @@ Add a node pool for TiFlash/TiCDC respectively. You can set `--node-count` as re {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tiflash \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -453,7 +453,7 @@ Add a node pool for TiFlash/TiCDC respectively. You can set `--node-count` as re {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name ticdc \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -586,7 +586,7 @@ For instance types that provide local disks, refer to [Lsv2-series](https://docs {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -607,7 +607,7 @@ For instance types that provide local disks, refer to [Lsv2-series](https://docs {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/eks/local-volume-provisioner.yaml ``` diff --git a/en/deploy-on-gcp-gke.md b/en/deploy-on-gcp-gke.md index 67e9535a0b9..59106ba38f4 100644 --- a/en/deploy-on-gcp-gke.md +++ b/en/deploy-on-gcp-gke.md @@ -43,7 +43,7 @@ gcloud config set compute/region {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud container clusters create tidb --region us-east1 --machine-type n1-standard-4 --num-nodes=1 ``` @@ -56,7 +56,7 @@ gcloud config set compute/region {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud container node-pools create pd --cluster tidb --machine-type n1-standard-4 --num-nodes=1 \ --node-labels=dedicated=pd --node-taints=dedicated=pd:NoSchedule gcloud container node-pools create tikv --cluster tidb --machine-type n1-highmem-8 --num-nodes=1 \ @@ -81,7 +81,7 @@ To create a namespace to deploy the TiDB cluster, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create namespace tidb-cluster ``` @@ -95,7 +95,7 @@ First, download the sample `TidbCluster` and `TidbMonitor` configuration files: {{< copyable "shell-regular" >}} -```shell +```bash curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/gcp/tidb-cluster.yaml && \ curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/gcp/tidb-monitor.yaml ``` @@ -106,7 +106,7 @@ To deploy the `TidbCluster` and `TidbMonitor` CR in the GKE cluster, run the fol {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f tidb-cluster.yaml -n tidb-cluster && \ kubectl create -f tidb-monitor.yaml -n tidb-cluster ``` @@ -123,7 +123,7 @@ To view the status of the starting TiDB cluster, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pods -n tidb-cluster ``` @@ -153,7 +153,7 @@ The LoadBalancer created for your TiDB cluster is an intranet LoadBalancer. You {{< copyable "shell-regular" >}} -```shell +```bash gcloud compute instances create bastion \ --machine-type=n1-standard-4 \ --image-project=centos-cloud \ @@ -173,7 +173,7 @@ After the bastion host is created, you can connect to the bastion host via SSH a {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud compute ssh tidb@bastion ``` @@ -181,7 +181,7 @@ After the bastion host is created, you can connect to the bastion host via SSH a {{< copyable "shell-regular" >}} - ```shell + ```bash sudo yum install mysql -y ``` @@ -189,7 +189,7 @@ After the bastion host is created, you can connect to the bastion host via SSH a {{< copyable "shell-regular" >}} - ```shell + ```bash mysql --comments -h ${tidb-nlb-dnsname} -P 4000 -u root ``` @@ -197,7 +197,7 @@ After the bastion host is created, you can connect to the bastion host via SSH a For example: - ```shell + ```bash $ mysql --comments -h 10.128.15.243 -P 4000 -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 7823 @@ -232,7 +232,7 @@ Obtain the LoadBalancer IP of Grafana: {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n tidb-cluster get svc basic-grafana ``` @@ -270,7 +270,7 @@ The following example shows how to scale out the `tikv` node pool of the `tidb` {{< copyable "shell-regular" >}} -```shell +```bash gcloud container clusters resize tidb --node-pool tikv --num-nodes 2 ``` @@ -298,7 +298,7 @@ The two components are *not required* in the deployment. This section shows a qu {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud container node-pools create tiflash --cluster tidb --machine-type n1-highmem-8 --num-nodes=1 \ --node-labels dedicated=tiflash --node-taints dedicated=tiflash:NoSchedule ``` @@ -307,7 +307,7 @@ The two components are *not required* in the deployment. This section shows a qu {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud container node-pools create ticdc --cluster tidb --machine-type n1-standard-4 --num-nodes=1 \ --node-labels dedicated=ticdc --node-taints dedicated=ticdc:NoSchedule ``` @@ -395,7 +395,7 @@ Use [Zonal Persistent disks](https://cloud.google.com/compute/docs/disks#pdspecs {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud container node-pools create tikv --cluster tidb --machine-type n1-standard-4 --num-nodes=1 --local-ssd-count 1 \ --node-labels dedicated=tikv --node-taints dedicated=tikv:NoSchedule ``` @@ -408,7 +408,7 @@ Use [Zonal Persistent disks](https://cloud.google.com/compute/docs/disks#pdspecs {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/gke/local-ssd-provision/local-ssd-provision.yaml ``` diff --git a/en/deploy-on-general-kubernetes.md b/en/deploy-on-general-kubernetes.md index 458cfd8b9c4..4950c323753 100644 --- a/en/deploy-on-general-kubernetes.md +++ b/en/deploy-on-general-kubernetes.md @@ -44,7 +44,7 @@ This document describes how to deploy a TiDB cluster in general Kubernetes. To deploy a TiDB cluster, you need the following Docker images (assuming the version of the TiDB cluster is v5.2.1): - ```shell + ```bash pingcap/pd:v5.2.1 pingcap/tikv:v5.2.1 pingcap/tidb:v5.2.1 @@ -62,7 +62,7 @@ This document describes how to deploy a TiDB cluster in general Kubernetes. {{< copyable "shell-regular" >}} - ```shell + ```bash docker pull pingcap/pd:v5.2.1 docker pull pingcap/tikv:v5.2.1 docker pull pingcap/tidb:v5.2.1 @@ -92,7 +92,7 @@ This document describes how to deploy a TiDB cluster in general Kubernetes. {{< copyable "shell-regular" >}} - ```shell + ```bash docker load -i pd-v5.2.1.tar docker load -i tikv-v5.2.1.tar docker load -i tidb-v5.2.1.tar diff --git a/en/deploy-ticdc.md b/en/deploy-ticdc.md index a614c079f7c..6b515354797 100644 --- a/en/deploy-ticdc.md +++ b/en/deploy-ticdc.md @@ -52,7 +52,7 @@ To deploy TiCDC when deploying the TiDB cluster, refer to [Deploy TiDB in Genera {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- sh ``` @@ -60,11 +60,11 @@ To deploy TiCDC when deploying the TiDB cluster, refer to [Deploy TiDB in Genera {{< copyable "shell-regular" >}} - ```shell + ```bash /cdc cli capture list --pd=http://${cluster_name}-pd:2379 ``` - ```shell + ```bash [ { "id": "3ed24f6c-22cf-446f-9fe0-bf4a66d00f5b", @@ -90,7 +90,7 @@ To deploy TiCDC when deploying the TiDB cluster, refer to [Deploy TiDB in Genera {{< copyable "shell-regular" >}} - ```shell + ```bash /cdc cli capture list --pd=https://${cluster_name}-pd:2379 --ca=/var/lib/cluster-client-tls/ca.crt --cert=/var/lib/cluster-client-tls/tls.crt --key=/var/lib/cluster-client-tls/tls.key ``` diff --git a/en/deploy-tidb-binlog.md b/en/deploy-tidb-binlog.md index 27ab483fd31..3b06fc34884 100644 --- a/en/deploy-tidb-binlog.md +++ b/en/deploy-tidb-binlog.md @@ -176,13 +176,13 @@ To deploy multiple drainers using the `tidb-drainer` Helm chart for a TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash helm repo update ``` {{< copyable "shell-regular" >}} - ```shell + ```bash helm search repo tidb-drainer -l ``` @@ -190,7 +190,7 @@ To deploy multiple drainers using the `tidb-drainer` Helm chart for a TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash helm inspect values pingcap/tidb-drainer --version=${chart_version} > values.yaml ``` @@ -240,7 +240,7 @@ To deploy multiple drainers using the `tidb-drainer` Helm chart for a TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} pingcap/tidb-drainer --namespace=${namespace} --version=${chart_version} -f values.yaml ``` @@ -351,7 +351,7 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run offline-pump-${ordinal_id} --image=pingcap/tidb-binlog:${tidb_version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${cluster_name}-pd:2379 -cmd offline-pump -node-id ${cluster_name}-pump-${ordinal_id}:8250 ``` @@ -359,7 +359,7 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec binlogctl -n ${namespace} -- /binlogctl -pd-urls "https://${cluster_name}-pd:2379" -cmd offline-pump -node-id ${cluster_name}-pump-${ordinal_id}:8250 -ssl-ca "/etc/binlog-tls/ca.crt" -ssl-cert "/etc/binlog-tls/tls.crt" -ssl-key "/etc/binlog-tls/tls.key" ``` @@ -367,7 +367,7 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs -f -n ${namespace} ${release_name}-pump-${ordinal_id} ``` @@ -385,7 +385,7 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run update-pump-${ordinal_id} --image=pingcap/tidb-binlog:${tidb_version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${cluster_name}-pd:2379 -cmd update-pump -node-id ${cluster_name}-pump-${ordinal_id}:8250 --state offline ``` @@ -393,7 +393,7 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec binlogctl -n ${namespace} -- /binlogctl -pd-urls=https://${cluster_name}-pd:2379 -cmd update-pump -node-id ${cluster_name}-pump-${ordinal_id}:8250 --state offline -ssl-ca "/etc/binlog-tls/ca.crt" -ssl-cert "/etc/binlog-tls/tls.crt" -ssl-key "/etc/binlog-tls/tls.key" ``` @@ -426,7 +426,7 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run offline-drainer-0 --image=pingcap/tidb-binlog:${tidb_version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${cluster_name}-pd:2379 -cmd offline-drainer -node-id ${drainer_node_id}:8249 ``` @@ -434,7 +434,7 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec binlogctl -n ${namespace} -- /binlogctl -pd-urls "https://${cluster_name}-pd:2379" -cmd offline-drainer -node-id ${drainer_node_id}:8249 -ssl-ca "/etc/binlog-tls/ca.crt" -ssl-cert "/etc/binlog-tls/tls.crt" -ssl-key "/etc/binlog-tls/tls.key" ``` @@ -442,7 +442,7 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs -f -n ${namespace} ${drainer_node_id} ``` @@ -462,7 +462,7 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run update-drainer-${ordinal_id} --image=pingcap/tidb-binlog:${tidb_version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${cluster_name}-pd:2379 -cmd update-drainer -node-id ${drainer_node_id}:8249 --state offline ``` @@ -470,6 +470,6 @@ The steps are as follows: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec binlogctl -n ${namespace} -- /binlogctl -pd-urls=https://${cluster_name}-pd:2379 -cmd update-drainer -node-id ${drainer_node_id}:8249 --state offline -ssl-ca "/etc/binlog-tls/ca.crt" -ssl-cert "/etc/binlog-tls/tls.crt" -ssl-key "/etc/binlog-tls/tls.key" ``` diff --git a/en/deploy-tidb-dm.md b/en/deploy-tidb-dm.md index af80a75bc7b..edc61d87b1d 100644 --- a/en/deploy-tidb-dm.md +++ b/en/deploy-tidb-dm.md @@ -143,7 +143,7 @@ If the server does not have an external network, you need to download the Docker 1. Deploy a DM cluster requires the following Docker image (assuming the version of the DM cluster is v2.0.7): - ```shell + ```bash pingcap/dm:v2.0.7 ``` @@ -151,7 +151,7 @@ If the server does not have an external network, you need to download the Docker {{< copyable "shell-regular" >}} - ```shell + ```bash docker pull pingcap/dm:v2.0.7 docker save -o dm-v2.0.7.tar pingcap/dm:v2.0.7 ``` @@ -160,13 +160,13 @@ If the server does not have an external network, you need to download the Docker {{< copyable "shell-regular" >}} - ```shell + ```bash docker load -i dm-v2.0.7.tar ``` After deploying the DM cluster, execute the following command to view the Pod status: -```shell +```bash kubectl get po -n ${namespace} -l app.kubernetes.io/instance=${dm_cluster_name} ``` diff --git a/en/deploy-tidb-from-kubernetes-gke.md b/en/deploy-tidb-from-kubernetes-gke.md index edc1b4f07df..fdcf7b49be3 100644 --- a/en/deploy-tidb-from-kubernetes-gke.md +++ b/en/deploy-tidb-from-kubernetes-gke.md @@ -44,11 +44,11 @@ This tutorial requires use of the Compute and Container APIs. Please enable them This step defaults gcloud to your preferred project and [zone](https://cloud.google.com/compute/docs/regions-zones/), which simplifies the commands used for the rest of this tutorial: -```shell +```bash gcloud config set project {{project-id}} ``` -```shell +```bash gcloud config set compute/zone us-west1-a ``` @@ -58,19 +58,19 @@ It's now time to launch a 3-node kubernetes cluster! The following command launc It takes a few minutes to complete: -```shell +```bash gcloud container clusters create tidb ``` Once the cluster has launched, set it to be the default: -```shell +```bash gcloud config set container/cluster tidb ``` The last step is to verify that `kubectl` can connect to the cluster, and all three machines are running: -```shell +```bash kubectl get nodes ``` @@ -82,13 +82,13 @@ If you see `Ready` for all nodes, congratulations! You've set up your first Kube 1. Install the Helm client: - ```shell + ```bash curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash ``` 2. Add the PingCAP repository: - ```shell + ```bash helm repo add pingcap https://charts.pingcap.org/ ``` @@ -96,7 +96,7 @@ If you see `Ready` for all nodes, congratulations! You've set up your first Kube TiDB Operator uses [Custom Resource Definition (CRD)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions) to extend Kubernetes. Therefore, to use TiDB Operator, you must first create the `TidbCluster` CRD. -```shell +```bash kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml && \ kubectl get crd tidbclusters.pingcap.com ``` @@ -107,7 +107,7 @@ kubectl get crd tidbclusters.pingcap.com After the `TidbCluster` CRD is created, install TiDB Operator in your Kubernetes cluster. -```shell +```bash kubectl create namespace tidb-admin helm install --namespace tidb-admin tidb-operator pingcap/tidb-operator --version v1.2.4 kubectl get po -n tidb-admin -l app.kubernetes.io/name=tidb-operator @@ -119,7 +119,7 @@ To deploy the TiDB cluster, perform the following steps: 1. Create `Namespace`: - ```shell + ```bash kubectl create namespace demo ``` @@ -145,7 +145,7 @@ To deploy the TiDB cluster, perform the following steps: There can be a small delay between the pod being up and running, and the service being available. You can view the service status using the following command: -```shell +```bash kubectl get svc -n demo --watch ``` @@ -153,13 +153,13 @@ When you see `basic-tidb` appear, the service is ready to access. You can use /tmp/pf4000.log & ``` From your Cloud Shell: -```shell +```bash sudo apt-get install -y mysql-client && \ mysql --comments -h 127.0.0.1 -u root -P 4000 ``` @@ -200,7 +200,7 @@ To access the Grafana dashboards, you can forward a port from the Cloud Shell to To do so, use the following command: -```shell +```bash kubectl -n demo port-forward svc/basic-grafana 8080:3000 &>/tmp/pf8080.log & ``` @@ -212,19 +212,19 @@ The default username and password are both "admin". To destroy a TiDB cluster in Kubernetes, run the following command: -```shell +```bash kubectl delete tc basic -n demo ``` To destroy the monitoring component, run the following command: -```shell +```bash kubectl delete tidbmonitor basic -n demo ``` The above commands only delete the running pods, the data is persistent. If you do not need the data anymore, you should run the following commands to clean the data and the dynamically created persistent disks: -```shell +```bash kubectl delete pvc -n demo -l app.kubernetes.io/instance=basic,app.kubernetes.io/managed-by=tidb-operator && \ kubectl get pv -l app.kubernetes.io/namespace=demo,app.kubernetes.io/managed-by=tidb-operator,app.kubernetes.io/instance=basic -o name | xargs -I {} kubectl patch {} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` @@ -233,6 +233,6 @@ kubectl get pv -l app.kubernetes.io/namespace=demo,app.kubernetes.io/managed-by= Once you have finished experimenting, you can delete the Kubernetes cluster: -```shell +```bash gcloud container clusters delete tidb ``` diff --git a/en/deploy-tidb-operator.md b/en/deploy-tidb-operator.md index 6861f44a337..fab471c64fb 100644 --- a/en/deploy-tidb-operator.md +++ b/en/deploy-tidb-operator.md @@ -44,7 +44,7 @@ TiDB Operator uses [Custom Resource Definition (CRD)](https://kubernetes.io/docs {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml ``` @@ -52,7 +52,7 @@ If the server cannot access the Internet, you need to download the `crd.yaml` fi {{< copyable "shell-regular" >}} -```shell +```bash wget https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml kubectl create -f ./crd.yaml ``` @@ -65,11 +65,11 @@ If the following message is displayed, the CRD installation is successful: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get crd ``` -```shell +```bash NAME CREATED AT backups.pingcap.com 2020-06-11T07:59:40Z backupschedules.pingcap.com 2020-06-11T07:59:41Z @@ -94,7 +94,7 @@ When you use TiDB Operator, `tidb-scheduler` is not mandatory. Refer to [tidb-sc {{< copyable "shell-regular" >}} - ```shell + ```bash mkdir -p ${HOME}/tidb-operator && \ helm inspect values pingcap/tidb-operator --version=${chart_version} > ${HOME}/tidb-operator/values-tidb-operator.yaml ``` @@ -117,7 +117,7 @@ When you use TiDB Operator, `tidb-scheduler` is not mandatory. Refer to [tidb-sc {{< copyable "shell-regular" >}} - ```shell + ```bash helm install tidb-operator pingcap/tidb-operator --namespace=tidb-admin --version=${chart_version} -f ${HOME}/tidb-operator/values-tidb-operator.yaml && \ kubectl get po -n tidb-admin -l app.kubernetes.io/name=tidb-operator ``` @@ -132,7 +132,7 @@ When you use TiDB Operator, `tidb-scheduler` is not mandatory. Refer to [tidb-sc {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade tidb-operator pingcap/tidb-operator --namespace=tidb-admin -f ${HOME}/tidb-operator/values-tidb-operator.yaml ``` @@ -148,7 +148,7 @@ If your server cannot access the Internet, install TiDB Operator offline by the {{< copyable "shell-regular" >}} - ```shell + ```bash wget http://charts.pingcap.org/tidb-operator-v1.2.4.tgz ``` @@ -156,7 +156,7 @@ If your server cannot access the Internet, install TiDB Operator offline by the {{< copyable "shell-regular" >}} - ```shell + ```bash tar zxvf tidb-operator.v1.2.4.tgz ``` @@ -168,7 +168,7 @@ If your server cannot access the Internet, install TiDB Operator offline by the {{< copyable "" >}} - ```shell + ```bash pingcap/tidb-operator:v1.2.4 pingcap/tidb-backup-manager:v1.2.4 bitnami/kubectl:latest @@ -182,7 +182,7 @@ If your server cannot access the Internet, install TiDB Operator offline by the {{< copyable "shell-regular" >}} - ```shell + ```bash docker pull pingcap/tidb-operator:v1.2.4 docker pull pingcap/tidb-backup-manager:v1.2.4 docker pull bitnami/kubectl:latest @@ -198,7 +198,7 @@ If your server cannot access the Internet, install TiDB Operator offline by the {{< copyable "shell-regular" >}} - ```shell + ```bash docker load -i tidb-operator-v1.2.4.tar docker load -i tidb-backup-manager-v1.2.4.tar docker load -i bitnami-kubectl.tar @@ -209,7 +209,7 @@ If your server cannot access the Internet, install TiDB Operator offline by the TiDB Operator embeds a `kube-scheduler` to implement a custom scheduler. If you need to deploy `tidb-scheduler`, modify the `./tidb-operator/values.yaml` file to configure the Docker image's name and version of this built-in `kube-scheduler` component. For example, if `kube-scheduler` in your Kubernetes cluster uses the image `k8s.gcr.io/kube-scheduler:v1.16.9`, set `./tidb-operator/values.yaml` as follows: - ```shell + ```bash ... scheduler: serviceAccount: tidb-scheduler @@ -236,7 +236,7 @@ If your server cannot access the Internet, install TiDB Operator offline by the {{< copyable "shell-regular" >}} - ```shell + ```bash helm install tidb-operator ./tidb-operator --namespace=tidb-admin ``` @@ -250,7 +250,7 @@ If your server cannot access the Internet, install TiDB Operator offline by the {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade tidb-operator ./tidb-operator --namespace=tidb-admin ``` @@ -269,6 +269,6 @@ After modifying `values.yaml`, run the following command to apply this modificat {{< copyable "shell-regular" >}} -```shell +```bash helm upgrade tidb-operator pingcap/tidb-operator --version=${chart_version} --namespace=tidb-admin -f ${HOME}/tidb-operator/values-tidb-operator.yaml ``` diff --git a/en/deploy-tiflash.md b/en/deploy-tiflash.md index fb2e878b357..bfdc74dee1d 100644 --- a/en/deploy-tiflash.md +++ b/en/deploy-tiflash.md @@ -116,7 +116,7 @@ If the server does not have an external network, refer to [deploy the TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tidbcluster ${cluster_name} -n ${namespace} ``` @@ -126,7 +126,7 @@ If the server does not have an external network, refer to [deploy the TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod -n ${namespace} -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` @@ -134,7 +134,7 @@ If the server does not have an external network, refer to [deploy the TiDB clust To check whether the stores of the TiFlash are in the `Tombstone` state, run the following command: - ```shell + ```bash kubectl get tidbcluster ${cluster_name} -n ${namespace} -o yaml ``` @@ -170,7 +170,7 @@ If the server does not have an external network, refer to [deploy the TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tidbcluster ${cluster_name} -n ${namespace} ``` @@ -178,7 +178,7 @@ If the server does not have an external network, refer to [deploy the TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete statefulsets -n ${namespace} -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` @@ -186,7 +186,7 @@ If the server does not have an external network, refer to [deploy the TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get sts -n ${namespace} -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` @@ -200,7 +200,7 @@ If the server does not have an external network, refer to [deploy the TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete pvc -n ${namespace} -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` @@ -208,7 +208,7 @@ If the server does not have an external network, refer to [deploy the TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pv ${pv_name} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` @@ -216,7 +216,7 @@ If the server does not have an external network, refer to [deploy the TiDB clust {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pv -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` diff --git a/en/destroy-a-tidb-cluster.md b/en/destroy-a-tidb-cluster.md index ff10897a717..360205d17aa 100644 --- a/en/destroy-a-tidb-cluster.md +++ b/en/destroy-a-tidb-cluster.md @@ -14,7 +14,7 @@ To destroy a TiDB cluster managed by `TidbCluster`, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete tc ${cluster_name} -n ${namespace} ``` @@ -22,7 +22,7 @@ If you deploy the monitor in the cluster using `TidbMonitor`, run the following {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete tidbmonitor ${tidb_monitor_name} -n ${namespace} ``` @@ -32,7 +32,7 @@ To destroy a TiDB cluster managed by Helm, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash helm uninstall ${cluster_name} -n ${namespace} ``` @@ -48,12 +48,12 @@ The above commands that destroy the cluster only remove the running Pod, but the {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete pvc -n ${namespace} -l app.kubernetes.io/instance=${cluster_name},app.kubernetes.io/managed-by=tidb-operator ``` {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pv -l app.kubernetes.io/namespace=${namespace},app.kubernetes.io/managed-by=tidb-operator,app.kubernetes.io/instance=${cluster_name} -o name | xargs -I {} kubectl patch {} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` diff --git a/en/enable-admission-webhook.md b/en/enable-admission-webhook.md index 6bd83d8bd6c..6131f7a9bae 100644 --- a/en/enable-admission-webhook.md +++ b/en/enable-admission-webhook.md @@ -33,7 +33,7 @@ With a default installation, TiDB Operator disables the admission controller. Ta {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get configmap -n kube-system extension-apiserver-authentication -o=jsonpath='{.data.client-ca-file}' | base64 | tr -d '\n' ``` @@ -111,7 +111,7 @@ By default, the admission controller and Kubernetes api-server skip the [TLS ver {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > webhook-server.json ``` @@ -148,7 +148,7 @@ By default, the admission controller and Kubernetes api-server skip the [TLS ver {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server webhook-server.json | cfssljson -bare webhook-server ``` @@ -165,7 +165,7 @@ By default, the admission controller and Kubernetes api-server skip the [TLS ver {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic --namespace= --from-file=tls.crt=~/cfssl/webhook-server.pem --from-file=tls.key=~/cfssl/webhook-server-key.pem --from-file=ca.crt=~/cfssl/ca.pem ``` @@ -175,7 +175,7 @@ By default, the admission controller and Kubernetes api-server skip the [TLS ver {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get secret --namespace= -o=jsonpath='{.data.ca\.crt}' ``` @@ -219,7 +219,7 @@ TiDB Operator implements many functions using the admission controller. This sec {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate tidbcluster ${name} -n ${namespace} tidb.pingcap.com/tikv-partition=2 && tidbcluster.pingcap.com/${name} annotated ``` @@ -228,7 +228,7 @@ TiDB Operator implements many functions using the admission controller. This sec {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate tidbcluster ${name} -n ${namespace} tidb.pingcap.com/tikv-partition- && tidbcluster.pingcap.com/${name} annotated ``` diff --git a/en/enable-tidb-cluster-auto-scaling.md b/en/enable-tidb-cluster-auto-scaling.md index c948fd207c2..773d0a0ef69 100644 --- a/en/enable-tidb-cluster-auto-scaling.md +++ b/en/enable-tidb-cluster-auto-scaling.md @@ -127,19 +127,19 @@ For more information about configuration fields, refer to [API references](https {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/auto-scale/tidb-cluster.yaml -n ${namespace} ``` {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/auto-scale/tidb-monitor.yaml -n ${namespace} ``` {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/auto-scale/tidb-cluster-auto-scaler.yaml -n ${namespace} ``` @@ -165,7 +165,7 @@ For more information about configuration fields, refer to [API references](https {{< copyable "shell-regular" >}} - ```shell + ```bash sysbench --config-file=${path}/sysbench.config oltp_point_select --tables=1 --table-size=20000 prepare ``` @@ -173,7 +173,7 @@ For more information about configuration fields, refer to [API references](https {{< copyable "shell-regular" >}} - ```shell + ```bash sysbench --config-file=${path}/sysbench.config oltp_point_select --tables=1 --table-size=20000 run ``` @@ -192,7 +192,7 @@ For more information about configuration fields, refer to [API references](https {{< copyable "shell-regular" >}} - ```shell + ```bash watch -n1 "kubectl -n ${namespace} get pod" ``` @@ -217,7 +217,7 @@ For more information about configuration fields, refer to [API references](https {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete tidbcluster auto-scaling-demo -n ${namespace} kubectl delete tidbmonitor auto-scaling-demo -n ${namespace} kubectl delete tidbclusterautoscaler auto-scaling-demo -n ${namespace} diff --git a/en/enable-tls-between-components.md b/en/enable-tls-between-components.md index 2de0d7f3be7..8af8abbd4a0 100644 --- a/en/enable-tls-between-components.md +++ b/en/enable-tls-between-components.md @@ -44,7 +44,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash mkdir -p ~/bin curl -s -L -o ~/bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 curl -s -L -o ~/bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 @@ -57,7 +57,7 @@ This section describes how to issue certificates using two methods: `cfssl` and 2. Generate the `ca-config.json` configuration file: - ```shell + ```bash cat << EOF > ca-config.json { "signing": { @@ -90,7 +90,7 @@ This section describes how to issue certificates using two methods: `cfssl` and 3. Generate the `ca-csr.json` configuration file: - ```shell + ```bash cat << EOF > ca-csr.json { "CN": "TiDB", @@ -118,7 +118,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -initca ca-csr.json | cfssljson -bare ca - ``` @@ -163,7 +163,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=internal pd-server.json | cfssljson -bare pd-server ``` @@ -204,7 +204,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=internal tikv-server.json | cfssljson -bare tikv-server ``` @@ -214,7 +214,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > tidb-server.json ``` @@ -245,7 +245,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=internal tidb-server.json | cfssljson -bare tidb-server ``` @@ -255,7 +255,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > pump-server.json ``` @@ -280,7 +280,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=internal pump-server.json | cfssljson -bare pump-server ``` @@ -290,7 +290,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > drainer-server.json ``` @@ -356,7 +356,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=internal drainer-server.json | cfssljson -bare drainer-server ``` @@ -407,7 +407,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > tiflash-server.json ``` @@ -450,7 +450,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > importer-server.json ``` @@ -491,7 +491,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > lightning-server.json ``` @@ -526,7 +526,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > client.json ``` @@ -541,7 +541,7 @@ This section describes how to issue certificates using two methods: `cfssl` and Finally, generate the client-side certificate: - ```shell + ```bash cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client client.json | cfssljson -bare client ``` @@ -553,7 +553,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-pd-cluster-secret --namespace=${namespace} --from-file=tls.crt=pd-server.pem --from-file=tls.key=pd-server-key.pem --from-file=ca.crt=ca.pem ``` @@ -561,7 +561,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-tikv-cluster-secret --namespace=${namespace} --from-file=tls.crt=tikv-server.pem --from-file=tls.key=tikv-server-key.pem --from-file=ca.crt=ca.pem ``` @@ -569,7 +569,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-tidb-cluster-secret --namespace=${namespace} --from-file=tls.crt=tidb-server.pem --from-file=tls.key=tidb-server-key.pem --from-file=ca.crt=ca.pem ``` @@ -577,7 +577,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-pump-cluster-secret --namespace=${namespace} --from-file=tls.crt=pump-server.pem --from-file=tls.key=pump-server-key.pem --from-file=ca.crt=ca.pem ``` @@ -585,7 +585,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-drainer-cluster-secret --namespace=${namespace} --from-file=tls.crt=drainer-server.pem --from-file=tls.key=drainer-server-key.pem --from-file=ca.crt=ca.pem ``` @@ -593,7 +593,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-ticdc-cluster-secret --namespace=${namespace} --from-file=tls.crt=ticdc-server.pem --from-file=tls.key=ticdc-server-key.pem --from-file=ca.crt=ca.pem ``` @@ -625,7 +625,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-cluster-client-secret --namespace=${namespace} --from-file=tls.crt=client.pem --from-file=tls.key=client-key.pem --from-file=ca.crt=ca.pem ``` @@ -648,7 +648,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash mkdir -p cert-manager cd cert-manager ``` @@ -699,7 +699,7 @@ This section describes how to issue certificates using two methods: `cfssl` and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f tidb-cluster-issuer.yaml ``` diff --git a/en/enable-tls-for-dm.md b/en/enable-tls-for-dm.md index 3ff73bae9f1..f93fdcbe9b5 100644 --- a/en/enable-tls-for-dm.md +++ b/en/enable-tls-for-dm.md @@ -54,7 +54,7 @@ This section describes how to issue certificates using two methods: `cfssl` and 2. Generate the `ca-config.json` configuration file: - ```shell + ```bash cat << EOF > ca-config.json { "signing": { @@ -87,7 +87,7 @@ This section describes how to issue certificates using two methods: `cfssl` and 3. Generate the `ca-csr.json` configuration file: - ```shell + ```bash cat << EOF > ca-csr.json { "CN": "TiDB", @@ -564,7 +564,7 @@ Suppose you have deployed a MySQL/TiDB database with TLS-enabled for the MySQL c {{< copyable "shell-regular" >}} -```shell +```bash kubectl create secret generic ${mysql_secret_name1} --namespace=${namespace} --from-file=tls.crt=client.pem --from-file=tls.key=client-key.pem --from-file=ca.crt=ca.pem kubectl create secret generic ${tidb_secret_name} --namespace=${namespace} --from-file=tls.crt=client.pem --from-file=tls.key=client-key.pem --from-file=ca.crt=ca.pem ``` diff --git a/en/enable-tls-for-mysql-client.md b/en/enable-tls-for-mysql-client.md index 41dca87d38e..19a78ffc7c5 100644 --- a/en/enable-tls-for-mysql-client.md +++ b/en/enable-tls-for-mysql-client.md @@ -37,7 +37,7 @@ This section describes how to issue certificates for the TiDB cluster using two {{< copyable "shell-regular" >}} - ```shell + ```bash mkdir -p ~/bin curl -s -L -o ~/bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 curl -s -L -o ~/bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 @@ -108,7 +108,7 @@ This section describes how to issue certificates for the TiDB cluster using two {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -initca ca-csr.json | cfssljson -bare ca - ``` @@ -186,7 +186,7 @@ This section describes how to issue certificates for the TiDB cluster using two {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-tidb-server-secret --namespace=${namespace} --from-file=tls.crt=server.pem --from-file=tls.key=server-key.pem --from-file=ca.crt=ca.pem kubectl create secret generic ${cluster_name}-tidb-client-secret --namespace=${namespace} --from-file=tls.crt=client.pem --from-file=tls.key=client-key.pem --from-file=ca.crt=ca.pem ``` diff --git a/en/enable-tls-for-ticdc-sink.md b/en/enable-tls-for-ticdc-sink.md index a83bde42da6..724c75bd9df 100644 --- a/en/enable-tls-for-ticdc-sink.md +++ b/en/enable-tls-for-ticdc-sink.md @@ -20,7 +20,7 @@ Before you begin, do the following preparations: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${secret_name} --namespace=${cluster_namespace} --from-file=tls.crt=client.pem --from-file=tls.key=client-key.pem --from-file=ca.crt=ca.pem ``` @@ -52,6 +52,6 @@ Before you begin, do the following preparations: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec ${cluster_name}-ticdc-0 -- /cdc cli changefeed create --pd=https://${cluster_name}-pd:2379 --sink-uri="mysql://${user}:{$password}@${downstream_service}/?ssl-ca=/var/lib/sink-tls/${secret_name}/ca.crt&ssl-cert=/var/lib/sink-tls/${secret_name}/tls.crt&ssl-key=/var/lib/sink-tls/${secret_name}/tls.key" ``` diff --git a/en/exceptions.md b/en/exceptions.md index fdc1a05ce64..ff892282f54 100644 --- a/en/exceptions.md +++ b/en/exceptions.md @@ -15,7 +15,7 @@ Normally, when a TiKV Pod is in a healthy state (`Running`), the corresponding T {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get -n ${namespace} tidbcluster ${cluster_name} -ojson | jq '.status.tikv.stores' ``` @@ -23,7 +23,7 @@ Normally, when a TiKV Pod is in a healthy state (`Running`), the corresponding T {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get -n ${namespace} po -l app.kubernetes.io/component=tikv ``` @@ -33,7 +33,7 @@ Normally, when a TiKV Pod is in a healthy state (`Running`), the corresponding T {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd ${local_port}:2379 &>/tmp/portforward-pd.log & ``` @@ -41,7 +41,7 @@ Normally, when a TiKV Pod is in a healthy state (`Running`), the corresponding T {{< copyable "shell-regular" >}} - ```shell + ```bash curl -X POST http://127.0.0.1:2379/pd/api/v1/store/${store_id}/state?state=Up ``` @@ -51,7 +51,7 @@ Normally, when a TiKV Pod is in a healthy state (`Running`), the corresponding T {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch $(kubectl get pv -l app.kubernetes.io/instance=${release_name},tidb.pingcap.com/store-id=${store_id} -o name) -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}} ``` @@ -59,7 +59,7 @@ Normally, when a TiKV Pod is in a healthy state (`Running`), the corresponding T {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pvc tikv-${pod_name} --wait=false ``` @@ -67,7 +67,7 @@ Normally, when a TiKV Pod is in a healthy state (`Running`), the corresponding T {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pod ${pod_name} ``` diff --git a/en/faq.md b/en/faq.md index 6625f55c7bb..3b73eff75e7 100644 --- a/en/faq.md +++ b/en/faq.md @@ -16,7 +16,7 @@ The default time zone setting for each component container of a TiDB cluster in Configure the `.spec.timezone` attribute in the TidbCluster CR. For example: -```shell +```bash ... spec: timezone: Asia/Shanghai @@ -33,7 +33,7 @@ If the TiDB cluster is already running, first upgrade the cluster, and then conf Configure the `.spec.timezone` attribute in the TidbCluster CR. For example: - ```shell + ```bash ... spec: timezone: Asia/Shanghai @@ -83,7 +83,7 @@ To check the configuration of the PD, TiKV, and TiDB components of the current c {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- cat /etc/pd/pd.toml ``` @@ -91,7 +91,7 @@ To check the configuration of the PD, TiKV, and TiDB components of the current c {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- cat /etc/tikv/tikv.toml ``` @@ -99,7 +99,7 @@ To check the configuration of the PD, TiKV, and TiDB components of the current c {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -c tidb -n ${namespace} -- cat /etc/tidb/tidb.toml ``` @@ -117,7 +117,7 @@ Three possible reasons: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get deployment --all-namespaces | grep tidb-scheduler ``` diff --git a/en/get-started.md b/en/get-started.md index f42b3a59b73..276327b0156 100644 --- a/en/get-started.md +++ b/en/get-started.md @@ -68,7 +68,7 @@ The following is an example of using `kind` v0.8.1: {{< copyable "shell-regular" >}} -```shell +```bash kind create cluster ``` @@ -94,7 +94,7 @@ Check whether the cluster is successfully created: {{< copyable "shell-regular" >}} -```shell +```bash kubectl cluster-info ``` @@ -141,7 +141,7 @@ After minikube is installed, execute the following command to start a minikube K {{< copyable "shell-regular" >}} -```shell +```bash minikube start ``` @@ -176,7 +176,7 @@ If you have trouble accessing Docker Hub, you might use your local gcr.io mirror {{< copyable "shell-regular" >}} -```shell +```bash minikube start --image-repository registry.cn-hangzhou.aliyuncs.com/google_containers ``` @@ -184,7 +184,7 @@ Or you can configure HTTP/HTTPS proxy environments in your Docker: {{< copyable "shell-regular" >}} -```shell +```bash # change 127.0.0.1:1086 to your http/https proxy server IP:PORT minikube start --docker-env https_proxy=http://127.0.0.1:1086 \ --docker-env http_proxy=http://127.0.0.1:1086 @@ -251,7 +251,7 @@ Execute this command to install the CRDs into your cluster: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml ``` @@ -279,7 +279,7 @@ This section describes how to install TiDB Operator using Helm 3. {{< copyable "shell-regular" >}} - ```shell + ```bash helm repo add pingcap https://charts.pingcap.org/ ``` @@ -293,7 +293,7 @@ This section describes how to install TiDB Operator using Helm 3. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create namespace tidb-admin ``` @@ -307,7 +307,7 @@ This section describes how to install TiDB Operator using Helm 3. {{< copyable "shell-regular" >}} - ```shell + ```bash helm install --namespace tidb-admin tidb-operator pingcap/tidb-operator --version v1.2.4 ``` @@ -341,7 +341,7 @@ To confirm that the TiDB Operator components are running, execute the following {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pods --namespace tidb-admin -l app.kubernetes.io/instance=tidb-operator ``` @@ -653,7 +653,7 @@ In this case, you can use a JSON merge patch to update the version of the TiDB c {{< copyable "shell-regular" >}} -```shell +```bash kubectl patch tc basic -n tidb-cluster --type merge -p '{"spec": {"version": "release-4.0-nightly"} }' ``` @@ -736,7 +736,7 @@ The following steps show how to destroy the TiDB cluster, but do not affect the {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete tc basic -n tidb-cluster ``` @@ -746,7 +746,7 @@ The `tc` in this command is a short name for tidbclusters. {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete tidbmonitor basic -n tidb-cluster ``` @@ -756,7 +756,7 @@ If your deployment has persistent data storage, deleting the TiDB cluster does n {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete pvc -n tidb-cluster -l app.kubernetes.io/instance=basic,app.kubernetes.io/managed-by=tidb-operator && \ kubectl get pv -l app.kubernetes.io/namespace=tidb-cluster,app.kubernetes.io/managed-by=tidb-operator,app.kubernetes.io/instance=basic -o name | xargs -I {} kubectl patch {} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` @@ -767,7 +767,7 @@ To make sure there are no lingering resources, you can delete the namespace used {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete namespace tidb-cluster ``` @@ -777,7 +777,7 @@ If you still have running `kubectl` processes that are forwarding ports, end the {{< copyable "shell-regular" >}} -```shell +```bash pgrep -lfa kubectl ``` diff --git a/en/grant-permissions-to-remote-storage.md b/en/grant-permissions-to-remote-storage.md index d9eeef376f6..8cc1eaf92dd 100644 --- a/en/grant-permissions-to-remote-storage.md +++ b/en/grant-permissions-to-remote-storage.md @@ -19,7 +19,7 @@ Create the `s3-secret` secret by running the following command. Use the AWS acco {{< copyable "shell-regular" >}} -```shell +```bash kubectl create secret generic s3-secret --from-literal=access_key=xxx --from-literal=secret_key=yyy --namespace=test1 ``` @@ -46,7 +46,7 @@ If you associate the user's [IAM](https://aws.amazon.com/cn/iam/) role with the {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc demo1 -n test1 ``` @@ -74,7 +74,7 @@ When you use this method to grant permissions, you can [create the EKS cluster]( {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate sa tidb-backup-manager -n eks.amazonaws.com/role-arn=arn:aws:iam::123456789012:role/user --namespace=test1 ``` @@ -82,7 +82,7 @@ When you use this method to grant permissions, you can [create the EKS cluster]( {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc demo1 -n test1 ``` @@ -100,6 +100,6 @@ Create the `gcs-secret` secret which stores the credential used to access GCS. T {{< copyable "shell-regular" >}} -```shell +```bash kubectl create secret generic gcs-secret --from-file=credentials=./google-credentials.json -n test1 ``` diff --git a/en/initialize-a-cluster.md b/en/initialize-a-cluster.md index ec5256068fd..a7507d91f1a 100644 --- a/en/initialize-a-cluster.md +++ b/en/initialize-a-cluster.md @@ -40,7 +40,7 @@ When a cluster is created, a default account `root` is created with no password. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic tidb-secret --from-literal=root=${root_password} --namespace=${namespace} ``` @@ -48,7 +48,7 @@ When a cluster is created, a default account `root` is created with no password. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic tidb-secret --from-literal=root=${root_password} --from-literal=developer=${developer_password} --namespace=${namespace} ``` @@ -82,7 +82,7 @@ initSql: |- {{< copyable "shell-regular" >}} -```shell +```bash kubectl apply -f ${cluster_name}/tidb-initializer.yaml --namespace=${namespace} ``` @@ -104,7 +104,7 @@ Next, download all these images with the following command: {{< copyable "shell-regular" >}} -```shell +```bash docker pull tnir/mysqlclient:latest docker save -o mysqlclient-latest.tar tnir/mysqlclient:latest ``` @@ -113,6 +113,6 @@ Next, upload these Docker images to the server, and execute `docker load` to ins {{< copyable "shell-regular" >}} -```shell +```bash docker load -i mysqlclient-latest.tar ``` diff --git a/en/maintain-a-kubernetes-node.md b/en/maintain-a-kubernetes-node.md index a57b5d5d769..94042c83480 100644 --- a/en/maintain-a-kubernetes-node.md +++ b/en/maintain-a-kubernetes-node.md @@ -28,7 +28,7 @@ Migrating PD and TiDB instances from a node is relatively fast, so you can proac {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} ``` @@ -38,7 +38,7 @@ Migrating PD and TiDB instances from a node is relatively fast, so you can proac {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl cordon ${node_name} ``` @@ -46,7 +46,7 @@ Migrating PD and TiDB instances from a node is relatively fast, so you can proac {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl drain ${node_name} --ignore-daemonsets --delete-local-data ``` @@ -56,7 +56,7 @@ Migrating PD and TiDB instances from a node is relatively fast, so you can proac {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete node ${node_name} ``` @@ -64,7 +64,7 @@ Migrating PD and TiDB instances from a node is relatively fast, so you can proac {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl get node ${node_name} ``` @@ -74,7 +74,7 @@ Migrating PD and TiDB instances from a node is relatively fast, so you can proac {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl uncordon ${node_name} ``` @@ -82,7 +82,7 @@ Migrating PD and TiDB instances from a node is relatively fast, so you can proac {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl get -n $namespace pod -o wide ``` @@ -101,13 +101,13 @@ For a short-term maintenance, you can increase the TiKV instance downtime that t {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward svc/${CLUSTER_NAME}-pd 2379:2379 ``` {{< copyable "shell-regular" >}} -```shell +```bash pd-ctl -d config set max-store-down-time 10m ``` @@ -121,7 +121,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl cordon ${node_name} ``` @@ -129,7 +129,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash tkctl get -A tikv | grep ${node_name} ``` @@ -143,7 +143,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get tc ${CLUSTER_NAME} -ojson | jq '.status.tikv.stores | .[] | select ( .podName == "${POD_NAME}" ) | .id' ``` @@ -151,13 +151,13 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward svc/${CLUSTER_NAME}-pd 2379:2379 ``` {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl -d store delete ${ID} ``` @@ -165,7 +165,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash watch pd-ctl -d store ${ID} ``` @@ -175,7 +175,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get -n ${namespace} pod ${pod_name} -ojson | jq '.spec.volumes | .[] | select (.name == "tikv") | .persistentVolumeClaim.claimName' ``` @@ -183,7 +183,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pvc ${pvc_name} --wait=false ``` @@ -191,7 +191,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pod ${pod_name} ``` @@ -199,7 +199,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -209,7 +209,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl drain ${node_name} --ignore-daemonsets --delete-local-data ``` @@ -217,7 +217,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces | grep ${node_name} ``` @@ -225,7 +225,7 @@ For the maintenance on an node that cannot be recovered in a short term (for exa {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete node ${node_name} ``` diff --git a/en/migrate-tidb-to-kubernetes.md b/en/migrate-tidb-to-kubernetes.md index ba87f0f7475..59d8ac24143 100644 --- a/en/migrate-tidb-to-kubernetes.md +++ b/en/migrate-tidb-to-kubernetes.md @@ -19,7 +19,7 @@ This document describes how to migrate a TiDB cluster deployed in the physical o {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl describe svc/kube-dns -n kube-system ``` @@ -36,7 +36,7 @@ This document describes how to migrate a TiDB cluster deployed in the physical o 3. Test whether the node can successfully resolve the domain name of the Pods in Kubernetes: - ```shell + ```bash $ ping basic-pd-2.basic-pd-peer.blade.svc PING basic-pd-2.basic-pd-peer.blade.svc (10.24.66.178) 56(84) bytes of data. 64 bytes from basic-pd-2.basic-pd-peer.blade.svc (10.24.66.178): icmp_seq=1 ttl=61 time=0.213 ms @@ -51,7 +51,7 @@ This document describes how to migrate a TiDB cluster deployed in the physical o {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl -u http://
: member | jq '.members | .[] | .client_urls' ``` @@ -72,7 +72,7 @@ This document describes how to migrate a TiDB cluster deployed in the physical o {{< copyable "shell-regular" >}} - ```shell + ```bash # Get the number of stores pd-ctl -u http://
: store | jq '.count' # Get the state of stores diff --git a/en/migrate-to-helm3.md b/en/migrate-to-helm3.md index 11067bfadc1..833a90ed670 100644 --- a/en/migrate-to-helm3.md +++ b/en/migrate-to-helm3.md @@ -15,7 +15,7 @@ In this example, TiDB Operator (`tidb-operator`) managed by Helm 2 is installed {{< copyable "shell-regular" >}} -```shell +```bash helm list ``` @@ -36,7 +36,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 plugin install https://github.com/helm/helm-2to3 ``` @@ -44,7 +44,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 plugin list ``` @@ -57,7 +57,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 2to3 move config ``` @@ -67,7 +67,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 repo list ``` @@ -80,7 +80,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 2to3 convert tidb-operator ``` @@ -90,7 +90,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 list --namespace=tidb-admin ``` @@ -109,7 +109,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pods --namespace=tidb-admin -l app.kubernetes.io/instance=tidb-operator ``` @@ -144,7 +144,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 2to3 cleanup --name=tidb-operator ``` diff --git a/en/monitor-a-tidb-cluster.md b/en/monitor-a-tidb-cluster.md index a148bb4f1a1..7ae1e9dd33d 100644 --- a/en/monitor-a-tidb-cluster.md +++ b/en/monitor-a-tidb-cluster.md @@ -60,7 +60,7 @@ To verify the PVC status, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pvc -l app.kubernetes.io/instance=basic,app.kubernetes.io/component=monitor -n ${namespace} ``` @@ -105,7 +105,7 @@ You can run the `kubectl port-forward` command to access the Grafana monitoring {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-grafana 3000:3000 &>/tmp/portforward-grafana.log & ``` @@ -121,7 +121,7 @@ To access the monitoring data directly, run the `kubectl port-forward` command t {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-prometheus 9090:9090 &>/tmp/portforward-prometheus.log & ``` @@ -279,7 +279,7 @@ type: kubernetes.io/tls In a public cloud-deployed Kubernetes cluster, you can usually [configure Loadbalancer](https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/) to access Ingress through a domain name. If you cannot configure the Loadbalancer service (for example, when you use NodePort as the service type of Ingress), you can access the service in a way equivalent to the following command: -```shell +```bash curl -H "Host: example.com" ${node_ip}:${NodePort} ``` diff --git a/en/network-issues.md b/en/network-issues.md index 5474e522011..70f3ece5771 100644 --- a/en/network-issues.md +++ b/en/network-issues.md @@ -17,7 +17,7 @@ When you find some network connection issues among Pods from the log or monitori {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get endpoints ${cluster_name}-pd kubectl -n ${namespace} get endpoints ${cluster_name}-tidb kubectl -n ${namespace} get endpoints ${cluster_name}-pd-peer @@ -31,7 +31,7 @@ When you find some network connection issues among Pods from the log or monitori {{< copyable "shell-regular" >}} - ```shell + ```bash tkctl debug -n ${namespace} ${pod_name} ``` @@ -39,7 +39,7 @@ When you find some network connection issues among Pods from the log or monitori {{< copyable "shell-regular" >}} - ```shell + ```bash dig ${HOSTNAME} ``` @@ -47,7 +47,7 @@ When you find some network connection issues among Pods from the log or monitori {{< copyable "shell-regular" >}} - ```shell + ```bash ping ${TARGET_IP} ``` @@ -57,7 +57,7 @@ When you find some network connection issues among Pods from the log or monitori {{< copyable "shell-regular" >}} - ```shell + ```bash telnet ${TARGET_IP} ${TARGET_PORT} ``` @@ -65,7 +65,7 @@ When you find some network connection issues among Pods from the log or monitori {{< copyable "shell-regular" >}} - ```shell + ```bash # Checks whether the ports are consistent. kubectl -n ${namespace} get po ${pod_name} -ojson | jq '.spec.containers[].ports[].containerPort' @@ -86,7 +86,7 @@ If you cannot access the TiDB service, first check whether the TiDB service is d {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get po -n ${namespace} ``` @@ -94,7 +94,7 @@ If you cannot access the TiDB service, first check whether the TiDB service is d {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get endpoints -n ${namespaces} ${cluster_name}-tidb ``` @@ -102,7 +102,7 @@ If you cannot access the TiDB service, first check whether the TiDB service is d {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs -f ${pod_name} -n ${namespace} -c tidb ``` @@ -119,7 +119,7 @@ If the cluster is successfully deployed, check the network using the following s {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get po -n kube-system -l k8s-app=kube-proxy ``` @@ -127,7 +127,7 @@ If the cluster is successfully deployed, check the network using the following s {{< copyable "shell-regular" >}} - ```shell + ```bash iptables-save -t nat |grep ${clusterIP} ``` @@ -135,7 +135,7 @@ If the cluster is successfully deployed, check the network using the following s {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get endpoints -n ${namespaces} ${cluster_name}-tidb ``` diff --git a/en/pause-sync-of-tidb-cluster.md b/en/pause-sync-of-tidb-cluster.md index fe84092f0ce..1f28d5ba8f1 100644 --- a/en/pause-sync-of-tidb-cluster.md +++ b/en/pause-sync-of-tidb-cluster.md @@ -33,7 +33,7 @@ Here are some cases where you might need to pause sync of a TiDB cluster in Kube {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -61,7 +61,7 @@ Here are some cases where you might need to pause sync of a TiDB cluster in Kube {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs ${pod_name} -n ${namespace} | grep paused ``` @@ -86,7 +86,7 @@ To resume the sync of the TiDB cluster, configure `spec.paused: false` in the Ti {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -114,7 +114,7 @@ To resume the sync of the TiDB cluster, configure `spec.paused: false` in the Ti {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs ${pod_name} -n ${namespace} | grep "Finished syncing TidbCluster" ``` diff --git a/en/pd-recover.md b/en/pd-recover.md index 3ddab9ad84f..ff685656d0f 100644 --- a/en/pd-recover.md +++ b/en/pd-recover.md @@ -14,7 +14,7 @@ aliases: ['/docs/tidb-in-kubernetes/dev/pd-recover/'] {{< copyable "shell-regular" >}} - ```shell + ```bash wget https://download.pingcap.org/tidb-${version}-linux-amd64.tar.gz ``` @@ -24,7 +24,7 @@ aliases: ['/docs/tidb-in-kubernetes/dev/pd-recover/'] {{< copyable "shell-regular" >}} - ```shell + ```bash tar -xzf tidb-${version}-linux-amd64.tar.gz ``` @@ -38,7 +38,7 @@ This section introduces how to recover the PD cluster using PD Recover. {{< copyable "shell-regular" >}} -```shell +```bash kubectl get tc ${cluster_name} -n ${namespace} -o='go-template={{.status.clusterID}}{{"\n"}}' ``` @@ -67,7 +67,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -75,7 +75,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit sts ${cluster_name}-pd -n ${namespace} ``` @@ -83,7 +83,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod -n ${namespace} ``` @@ -91,7 +91,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete pvc -l app.kubernetes.io/component=pd,app.kubernetes.io/instance=${cluster_name} -n ${namespace} ``` @@ -101,7 +101,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -109,7 +109,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit sts ${cluster_name}-pd -n ${namespace} ``` @@ -117,7 +117,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod -n ${namespace} ``` @@ -127,7 +127,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 ``` @@ -135,7 +135,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash ./pd-recover -endpoints http://127.0.0.1:2379 -cluster-id ${cluster_id} -alloc-id ${alloc_id} ``` @@ -143,7 +143,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- After the `pd-recover` command is successfully executed, the following result is printed: - ```shell + ```bash recover success! please restart the PD cluster ``` @@ -155,7 +155,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete pod ${cluster_name}-pd-0 -n ${namespace} ``` @@ -163,7 +163,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 ``` @@ -171,7 +171,7 @@ When you use `pd-recover` to recover the PD cluster, you need to specify `alloc- {{< copyable "shell-regular" >}} - ```shell + ```bash curl 127.0.0.1:2379/pd/api/v1/cluster ``` @@ -183,7 +183,7 @@ Execute the following command to set the value of `spec.pd.replicas` to the desi {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -191,7 +191,7 @@ kubectl edit tc ${cluster_name} -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete pod -l app.kubernetes.io/component=tidb,app.kubernetes.io/instance=${cluster_name} -n ${namespace} && kubectl delete pod -l app.kubernetes.io/component=tikv,app.kubernetes.io/instance=${cluster_name} -n ${namespace} ``` diff --git a/en/prerequisites.md b/en/prerequisites.md index 6e3fe9ad1a0..cb2e6c44cc5 100644 --- a/en/prerequisites.md +++ b/en/prerequisites.md @@ -23,7 +23,7 @@ It is recommended that you disable the firewall. {{< copyable "shell-regular" >}} -```shell +```bash systemctl stop firewalld systemctl disable firewalld ``` @@ -34,7 +34,7 @@ If you cannot stop the firewalld service, to ensure the normal operation of Kube {{< copyable "shell-regular" >}} - ```shell + ```bash firewall-cmd --permanent --add-port=6443/tcp firewall-cmd --permanent --add-port=2379-2380/tcp firewall-cmd --permanent --add-port=10250/tcp @@ -53,7 +53,7 @@ If you cannot stop the firewalld service, to ensure the normal operation of Kube {{< copyable "shell-regular" >}} - ```shell + ```bash firewall-cmd --permanent --add-port=10250/tcp firewall-cmd --permanent --add-port=10255/tcp firewall-cmd --permanent --add-port=8472/udp @@ -69,7 +69,7 @@ The FORWARD chain is configured to `ACCEPT` by default and is set in the startup {{< copyable "shell-regular" >}} -```shell +```bash iptables -P FORWARD ACCEPT ``` @@ -77,7 +77,7 @@ iptables -P FORWARD ACCEPT {{< copyable "shell-regular" >}} -```shell +```bash setenforce 0 sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config ``` @@ -88,7 +88,7 @@ To make kubelet work, you need to turn off swap and comment out the swap-related {{< copyable "shell-regular" >}} -```shell +```bash swapoff -a sed -i 's/^\(.*swap.*\)$/#\1/' /etc/fstab ``` @@ -99,7 +99,7 @@ Configure the kernel parameters as follows. You can also adjust them according t {{< copyable "shell-regular" >}} -```shell +```bash modprobe br_netfilter cat < /etc/sysctl.d/k8s.conf @@ -128,7 +128,7 @@ The [Irqbalance](https://access.redhat.com/documentation/en-us/red_hat_enterpris {{< copyable "shell-regular" >}} -```shell +```bash systemctl enable irqbalance systemctl start irqbalance ``` @@ -139,7 +139,7 @@ To make full use of CPU performance, set the CPUfreq governor mode to `performan {{< copyable "shell-regular" >}} -```shell +```bash cpupower frequency-set --governor performance ``` @@ -149,7 +149,7 @@ The TiDB cluster uses many file descriptors by default. The `ulimit` of the work {{< copyable "shell-regular" >}} -```shell +```bash cat <> /etc/security/limits.conf root soft nofile 1048576 root hard nofile 1048576 @@ -168,7 +168,7 @@ After the installation, take the following steps: {{< copyable "shell-regular" >}} - ```shell + ```bash cat > /etc/docker/daemon.json <}} - ```shell + ```bash mkdir -p /etc/systemd/system/docker.service.d ``` @@ -201,7 +201,7 @@ After the installation, take the following steps: {{< copyable "shell-regular" >}} - ```shell + ```bash cat > /etc/systemd/system/docker.service.d/limit-nofile.conf <}} - ```shell + ```bash systemctl daemon-reload && systemctl restart docker ``` @@ -241,7 +241,7 @@ After Kubelet is installed, take the following steps: {{< copyable "shell-regular" >}} - ```shell + ```bash echo "KUBELET_EXTRA_ARGS=--root-dir=/data1/kubelet" > /etc/sysconfig/kubelet systemctl restart kubelet ``` diff --git a/en/recover-deleted-cluster.md b/en/recover-deleted-cluster.md index 9a7425fe252..0696b018c74 100644 --- a/en/recover-deleted-cluster.md +++ b/en/recover-deleted-cluster.md @@ -16,7 +16,7 @@ To recover the deleted cluster, use the `kubectl create` command to create a clu {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} create -f tidb-cluster.yaml ``` @@ -28,6 +28,6 @@ To recover the cluster at this time, use the `helm install` command to create a {{< copyable "shell-regular" >}} -```shell +```bash helm install ${release_name} pingcap/tidb-cluster --namespace=${namespace} --version=${chart_version} -f values.yaml ``` diff --git a/en/renew-tls-certificate.md b/en/renew-tls-certificate.md index c5fb1f9cb86..5d8e07bcc19 100644 --- a/en/renew-tls-certificate.md +++ b/en/renew-tls-certificate.md @@ -25,7 +25,7 @@ If the original TLS certificates are issued by [the `cfssl` system](enable-tls-b {{< copyable "shell-regular" >}} - ```shell + ```bash mv ca.pem ca.old.pem && \ mv ca-key.pem ca-key.old.pem ``` @@ -34,7 +34,7 @@ If the original TLS certificates are issued by [the `cfssl` system](enable-tls-b {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -initca ca-csr.json | cfssljson -bare ca - ``` @@ -46,7 +46,7 @@ If the original TLS certificates are issued by [the `cfssl` system](enable-tls-b {{< copyable "shell-regular" >}} - ```shell + ```bash mv ca.pem ca.new.pem && \ mv ca-key.pem ca-key.new.pem && \ cat ca.new.pem ca.old.pem > ca.pem @@ -56,7 +56,7 @@ If the original TLS certificates are issued by [the `cfssl` system](enable-tls-b {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-pd-cluster-secret --namespace=${namespace} --from-file=tls.crt=pd-server.pem --from-file=tls.key=pd-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tikv-cluster-secret --namespace=${namespace} --from-file=tls.crt=tikv-server.pem --from-file=tls.key=tikv-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tidb-cluster-secret --namespace=${namespace} --from-file=tls.crt=tidb-server.pem --from-file=tls.key=tidb-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - @@ -83,7 +83,7 @@ If the original TLS certificates are issued by [the `cfssl` system](enable-tls-b {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -ca=ca.new.pem -ca-key=ca-key.new.pem -config=ca-config.json -profile=internal pd-server.json | cfssljson -bare pd-server cfssl gencert -ca=ca.new.pem -ca-key=ca-key.new.pem -config=ca-config.json -profile=internal tikv-server.json | cfssljson -bare tikv-server cfssl gencert -ca=ca.new.pem -ca-key=ca-key.new.pem -config=ca-config.json -profile=internal tidb-server.json | cfssljson -bare tidb-server @@ -99,7 +99,7 @@ If the original TLS certificates are issued by [the `cfssl` system](enable-tls-b {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-pd-cluster-secret --namespace=${namespace} --from-file=tls.crt=pd-server.pem --from-file=tls.key=pd-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tikv-cluster-secret --namespace=${namespace} --from-file=tls.crt=tikv-server.pem --from-file=tls.key=tikv-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tidb-cluster-secret --namespace=${namespace} --from-file=tls.crt=tidb-server.pem --from-file=tls.key=tidb-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - @@ -124,7 +124,7 @@ After you [renew and replace the combined CA certificate](#renew-and-replace-the {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-pd-cluster-secret --namespace=${namespace} --from-file=tls.crt=pd-server.pem --from-file=tls.key=pd-server-key.pem --from-file=ca.crt=ca.new.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tikv-cluster-secret --namespace=${namespace} --from-file=tls.crt=tikv-server.pem --from-file=tls.key=tikv-server-key.pem --from-file=ca.crt=ca.new.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tidb-cluster-secret --namespace=${namespace} --from-file=tls.crt=tidb-server.pem --from-file=tls.key=tidb-server-key.pem --from-file=ca.crt=ca.new.pem --dry-run=client -o yaml | kubectl apply -f - @@ -167,7 +167,7 @@ The steps to renew and replace the CA certificates of PD, TiKV, TiDB and certifi {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete secret ${cluster_name}-pd-cluster-secret --namespace=${namespace} kubectl delete secret ${cluster_name}-tikv-cluster-secret --namespace=${namespace} kubectl delete secret ${cluster_name}-tidb-cluster-secret --namespace=${namespace} diff --git a/en/restart-a-tidb-cluster.md b/en/restart-a-tidb-cluster.md index aac6faf4aa3..6fa16cb1f6e 100644 --- a/en/restart-a-tidb-cluster.md +++ b/en/restart-a-tidb-cluster.md @@ -18,7 +18,7 @@ After [Deploying TiDB on general Kubernetes](deploy-on-general-kubernetes.md), m {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit tc ${name} -n ${namespace} ``` @@ -57,7 +57,7 @@ To trigger a graceful restart, add an annotation with the `tidb.pingcap.com/evic {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} annotate pod ${tikv_pod_name} tidb.pingcap.com/evict-leader="delete-pod" ``` diff --git a/en/restore-data-using-tidb-lightning.md b/en/restore-data-using-tidb-lightning.md index 569cfd21d37..402a8ca2622 100644 --- a/en/restore-data-using-tidb-lightning.md +++ b/en/restore-data-using-tidb-lightning.md @@ -28,13 +28,13 @@ You can deploy tikv-importer using the Helm chart. See the following example: {{< copyable "shell-regular" >}} - ```shell + ```bash helm repo update ``` {{< copyable "shell-regular" >}} - ```shell + ```bash helm search repo tikv-importer -l ``` @@ -42,7 +42,7 @@ You can deploy tikv-importer using the Helm chart. See the following example: {{< copyable "shell-regular" >}} - ```shell + ```bash helm inspect values pingcap/tikv-importer --version=${chart_version} > values.yaml ``` @@ -74,7 +74,7 @@ You can deploy tikv-importer using the Helm chart. See the following example: {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${cluster_name} pingcap/tikv-importer --namespace=${namespace} --version=${chart_version} -f values.yaml ``` @@ -90,7 +90,7 @@ Use the following command to get the default configuration of TiDB Lightning: {{< copyable "shell-regular" >}} -```shell +```bash helm inspect values pingcap/tidb-lightning --version=${chart_version} > tidb-lightning-values.yaml ``` @@ -183,7 +183,7 @@ To restore backup data from the remote source, take the following steps: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f secret.yaml -n ${namespace} ``` @@ -216,7 +216,7 @@ To restore backup data from the remote source, take the following steps: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f secret.yaml -n ${namespace} ``` @@ -240,7 +240,7 @@ The method of deploying TiDB Lightning varies with different methods of granting {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} pingcap/tidb-lightning --namespace=${namespace} --set failFast=true -f tidb-lightning-values.yaml --version=${chart_version} ``` @@ -256,7 +256,7 @@ The method of deploying TiDB Lightning varies with different methods of granting {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} pingcap/tidb-lightning --namespace=${namespace} --set failFast=true -f tidb-lightning-values.yaml --version=${chart_version} ``` @@ -278,7 +278,7 @@ The method of deploying TiDB Lightning varies with different methods of granting {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate sa ${servieaccount} -n eks.amazonaws.com/role-arn=arn:aws:iam::123456789012:role/user ``` @@ -286,7 +286,7 @@ The method of deploying TiDB Lightning varies with different methods of granting {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} pingcap/tidb-lightning --namespace=${namespace} --set-string failFast=true,serviceAccount=${servieaccount} -f tidb-lightning-values.yaml --version=${chart_version} ``` @@ -303,7 +303,7 @@ To destroy tikv-importer, execute the following command: {{< copyable "shell-regular" >}} -```shell +```bash helm uninstall ${release_name} -n ${namespace} ``` @@ -311,7 +311,7 @@ To destroy tidb-lightning, execute the following command: {{< copyable "shell-regular" >}} -```shell +```bash helm uninstall ${release_name} -n ${namespace} ``` @@ -329,7 +329,7 @@ If TiDB Lightning fails to restore data, and if you have configured to persist t {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs -n ${namespace} ${pod_name} ``` diff --git a/en/restore-from-aws-s3-using-br.md b/en/restore-from-aws-s3-using-br.md index 49db35d3c66..4e38f14ff21 100644 --- a/en/restore-from-aws-s3-using-br.md +++ b/en/restore-from-aws-s3-using-br.md @@ -22,7 +22,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -36,7 +36,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=password=${password} --namespace=test2 ``` @@ -50,7 +50,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f resotre-aws-s3.yaml ``` @@ -92,7 +92,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore-aws-s3.yaml ``` @@ -135,7 +135,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore-aws-s3.yaml ``` @@ -177,7 +177,7 @@ After creating the `Restore` CR, execute the following command to check the rest {{< copyable "shell-regular" >}} -```shell +```bash kubectl get rt -n test2 -o wide ``` diff --git a/en/restore-from-gcs-using-br.md b/en/restore-from-gcs-using-br.md index 0490b92d06f..58a7ecaecec 100644 --- a/en/restore-from-gcs-using-br.md +++ b/en/restore-from-gcs-using-br.md @@ -21,7 +21,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -33,7 +33,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=user=root --from-literal=password= --namespace=test2 ``` @@ -47,7 +47,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -91,7 +91,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get rt -n test2 -owide ``` diff --git a/en/restore-from-gcs.md b/en/restore-from-gcs.md index 2dd813b18b1..bddb63ef636 100644 --- a/en/restore-from-gcs.md +++ b/en/restore-from-gcs.md @@ -20,7 +20,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -32,7 +32,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=user=root --from-literal=password=${password} --namespace=test2 ``` @@ -54,7 +54,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -89,7 +89,7 @@ This document shows an example in which the backup data stored in the specified {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get rt -n test2 -owide ``` diff --git a/en/restore-from-pv-using-br.md b/en/restore-from-pv-using-br.md index ee11f91b3ca..6b281a42a11 100644 --- a/en/restore-from-pv-using-br.md +++ b/en/restore-from-pv-using-br.md @@ -21,7 +21,7 @@ The restore method described in this document is implemented based on Custom Res {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -29,7 +29,7 @@ The restore method described in this document is implemented based on Custom Res {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=user=root --from-literal=password= --namespace=test2 ``` @@ -45,7 +45,7 @@ The restore method described in this document is implemented based on Custom Res {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -90,7 +90,7 @@ The restore method described in this document is implemented based on Custom Res {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get rt -n test2 -owide ``` diff --git a/en/restore-from-s3.md b/en/restore-from-s3.md index 16eafd61646..2d07d9f4b31 100644 --- a/en/restore-from-s3.md +++ b/en/restore-from-s3.md @@ -18,7 +18,7 @@ TiDB Lightning supports three backends: `Importer-backend`, `Local-backend`, and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -32,7 +32,7 @@ TiDB Lightning supports three backends: `Importer-backend`, `Local-backend`, and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=password=${password} --namespace=test2 ``` @@ -67,7 +67,7 @@ TiDB Lightning supports three backends: `Importer-backend`, `Local-backend`, and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -100,7 +100,7 @@ TiDB Lightning supports three backends: `Importer-backend`, `Local-backend`, and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -133,7 +133,7 @@ TiDB Lightning supports three backends: `Importer-backend`, `Local-backend`, and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -167,7 +167,7 @@ TiDB Lightning supports three backends: `Importer-backend`, `Local-backend`, and {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -200,7 +200,7 @@ After creating the `Restore` CR, execute the following command to check the rest {{< copyable "shell-regular" >}} -```shell +```bash kubectl get rt -n test2 -owide ``` diff --git a/en/scale-a-tidb-cluster.md b/en/scale-a-tidb-cluster.md index 9bbddc68c2d..20202078b2f 100644 --- a/en/scale-a-tidb-cluster.md +++ b/en/scale-a-tidb-cluster.md @@ -22,7 +22,7 @@ Modify `spec.pd.replicas`, `spec.tidb.replicas`, and `spec.tikv.replicas` in the {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tidbcluster ${cluster_name} -n ${namespace} ``` @@ -30,7 +30,7 @@ Check whether the TiDB cluster in Kubernetes has updated to your desired definit {{< copyable "shell-regular" >}} -```shell +```bash kubectl get tidbcluster ${cluster_name} -n ${namespace} -oyaml ``` @@ -38,7 +38,7 @@ In the `TidbCluster` file output by the command above, if the values of `spec.pd {{< copyable "shell-regular" >}} -```shell +```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -60,7 +60,7 @@ If TiCDC is deployed in the cluster, you can scale out TiCDC by modifying `spec. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 ``` @@ -68,7 +68,7 @@ If TiCDC is deployed in the cluster, you can scale out TiCDC by modifying `spec. {{< copyable "shell-regular" >}} - ```shell + ```bash curl 127.0.0.1:2379/pd/api/v1/config/rules/group/tiflash | grep count ``` @@ -106,7 +106,7 @@ If TiCDC is deployed in the cluster, you can scale out TiCDC by modifying `spec. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get tidbcluster ${cluster-name} -n ${namespace} -oyaml ``` @@ -116,7 +116,7 @@ To view the scaling status of the cluster, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -155,7 +155,7 @@ To view the upgrade progress of the cluster, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash watch kubectl -n ${namespace} get pod -o wide ``` diff --git a/en/tidb-operator-rbac.md b/en/tidb-operator-rbac.md index 85d37b3875b..e55bdfc3759 100644 --- a/en/tidb-operator-rbac.md +++ b/en/tidb-operator-rbac.md @@ -15,13 +15,13 @@ To check the ClusterRole created for TiDB Operator, run the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get clusterrole | grep tidb ``` The example output is as follows: -```shell +```bash tidb-operator:tidb-controller-manager 2021-05-04T13:08:55Z tidb-operator:tidb-scheduler 2021-05-04T13:08:55Z ``` @@ -96,13 +96,13 @@ If `clusterScoped=false` is set during the TiDB Operator deployment, TiDB Operat {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get clusterrole | grep tidb ``` The output is as follows: - ```shell + ```bash tidb-operator:tidb-controller-manager 2021-05-04T13:08:55Z ``` @@ -116,13 +116,13 @@ If `clusterScoped=false` is set during the TiDB Operator deployment, TiDB Operat {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get role -n tidb-admin ``` The example output is as follows: - ```shell + ```bash tidb-admin tidb-operator:tidb-controller-manager 2021-05-04T13:08:55Z tidb-admin tidb-operator:tidb-scheduler 2021-05-04T13:08:55Z ``` diff --git a/en/tidb-scheduler.md b/en/tidb-scheduler.md index b8d09d4665c..d151a821e9a 100644 --- a/en/tidb-scheduler.md +++ b/en/tidb-scheduler.md @@ -43,7 +43,7 @@ The configuration above indicates scheduling by the node dimension (default). If {{< copyable "shell-regular" >}} -```shell +```bash kubectl label nodes node1 zone=zone1 ``` diff --git a/en/tidb-toolkit.md b/en/tidb-toolkit.md index bf570c25bf5..bc12795955d 100644 --- a/en/tidb-toolkit.md +++ b/en/tidb-toolkit.md @@ -14,7 +14,7 @@ Operations on TiDB in Kubernetes require some open source tools. In the meantime {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 &>/tmp/portforward-pd.log & ``` @@ -22,7 +22,7 @@ After the above command is executed, you can access the PD service via `127.0.0. {{< copyable "shell-regular" >}} -```shell +```bash pd-ctl -d config show ``` @@ -30,7 +30,7 @@ Assume that your local port `2379` has been occupied and you want to switch to a {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd ${local_port}:2379 &>/tmp/portforward-pd.log & ``` @@ -38,7 +38,7 @@ Then you need to explicitly assign a PD port for `pd-ctl`: {{< copyable "shell-regular" >}} -```shell +```bash pd-ctl -u 127.0.0.1:${local_port} -d config show ``` @@ -50,13 +50,13 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 &>/tmp/portforward-pd.log & ``` {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} ${pod_name} 20160:20160 &>/tmp/portforward-tikv.log & ``` @@ -64,13 +64,13 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash tikv-ctl --host 127.0.0.1:20160 ${subcommands} ``` {{< copyable "shell-regular" >}} - ```shell + ```bash tikv-ctl --pd 127.0.0.1:2379 compact-cluster ``` @@ -80,7 +80,7 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate pod ${pod_name} -n ${namespace} runmode=debug ``` @@ -88,7 +88,7 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec ${pod_name} -n ${namespace} -c tikv -- kill -s TERM 1 ``` @@ -96,7 +96,7 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- sh ``` @@ -104,7 +104,7 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash ./tikv-ctl --data-dir /var/lib/tikv size -r 2 ``` @@ -114,13 +114,13 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 &>/tmp/portforward-pd.log & ``` {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} ${pod_name} 10080:10080 &>/tmp/portforward-tidb.log & ``` @@ -128,7 +128,7 @@ Then you can use the `tidb-ctl`: {{< copyable "shell-regular" >}} -```shell +```bash tidb-ctl schema in mysql ``` @@ -144,14 +144,14 @@ If the server does not have access to the Internet, you need to download Helm on {{< copyable "shell-regular" >}} -```shell +```bash wget https://get.helm.sh/helm-v3.4.1-linux-amd64.tar.gz tar zxvf helm-v3.4.1-linux-amd64.tar.gz ``` After decompression, you can see the following files: -```shell +```bash linux-amd64/ linux-amd64/README.md linux-amd64/helm @@ -164,11 +164,11 @@ Then execute `helm verison`. If the command outputs normally, the Helm installat {{< copyable "shell-regular" >}} -```shell +```bash helm version ``` -```shell +```bash version.BuildInfo{Version:"v3.4.1", GitCommit:"c4e74854886b2efe3321e185578e6db9be0a6e29", GitTreeState:"clean", GoVersion:"go1.14.11"} ``` @@ -187,7 +187,7 @@ These charts are hosted in the Helm chart repository `https://charts.pingcap.org {{< copyable "shell-regular" >}} -```shell +```bash helm repo add pingcap https://charts.pingcap.org/ ``` @@ -195,7 +195,7 @@ Then you can search the chart provided by PingCAP using the following command: {{< copyable "shell-regular" >}} -```shell +```bash helm search repo pingcap ``` @@ -225,7 +225,7 @@ Before performing the deploy, upgrade and deploy, you can view the deployed appl {{< copyable "shell-regular" >}} -```shell +```bash helm ls ``` @@ -235,7 +235,7 @@ When performing a deployment or upgrade, you must specify the chart name (`chart {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} ${chart_name} --namespace=${namespace} --version=${chart_version} -f ${values_file} ``` @@ -243,7 +243,7 @@ When performing a deployment or upgrade, you must specify the chart name (`chart {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade ${release_name} ${chart_name} --version=${chart_version} -f ${values_file} ``` @@ -253,7 +253,7 @@ When performing a deployment or upgrade, you must specify the chart name (`chart {{< copyable "shell-regular" >}} - ```shell + ```bash helm uninstall ${release_name} -n ${namespace} ``` @@ -267,7 +267,7 @@ Use the following command to download the chart file required for cluster instal {{< copyable "shell-regular" >}} -```shell +```bash wget http://charts.pingcap.org/tidb-operator-v1.2.4.tgz wget http://charts.pingcap.org/tidb-drainer-v1.2.4.tgz wget http://charts.pingcap.org/tidb-lightning-v1.2.4.tgz @@ -277,7 +277,7 @@ Copy these chart files to the server and decompress them. You can use these char {{< copyable "shell-regular" >}} -```shell +```bash tar zxvf tidb-operator.v1.2.4.tgz helm install ${release_name} ./tidb-operator --namespace=${namespace} ``` diff --git a/en/tips.md b/en/tips.md index 51ecfb76994..20cb2c4d036 100644 --- a/en/tips.md +++ b/en/tips.md @@ -20,7 +20,7 @@ To use the diagnostic mode for troubleshooting: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate pod ${pod_name} -n ${namespace} runmode=debug ``` @@ -30,7 +30,7 @@ To use the diagnostic mode for troubleshooting: {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl get pod ${pod_name} -n ${namespace} ``` @@ -38,13 +38,13 @@ To use the diagnostic mode for troubleshooting: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- /bin/sh ``` 3. After finishing the diagnosis and resolving the problem, delete the Pod. - ```shell + ```bash kubectl delete pod ${pod_name} -n ${namespace} ``` diff --git a/en/upgrade-a-tidb-cluster.md b/en/upgrade-a-tidb-cluster.md index 07cd1e88a15..a3913841bc4 100644 --- a/en/upgrade-a-tidb-cluster.md +++ b/en/upgrade-a-tidb-cluster.md @@ -35,7 +35,7 @@ If the TiDB cluster is deployed directly using TidbCluster CR, or deployed using {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -43,7 +43,7 @@ If the TiDB cluster is deployed directly using TidbCluster CR, or deployed using {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -59,7 +59,7 @@ First, set `annotation` for the cluster: {{< copyable "shell-regular" >}} -```shell +```bash kubectl annotate --overwrite tc ${cluster_name} -n ${namespace} tidb.pingcap.com/force-upgrade=true ``` @@ -71,7 +71,7 @@ Change the related PD configuration to make sure that PD is in a normal state. > > {{< copyable "shell-regular" >}} > -> ```shell +> ```bash > kubectl annotate tc ${cluster_name} -n ${namespace} tidb.pingcap.com/force-upgrade- > ``` @@ -86,7 +86,7 @@ Change the related PD configuration to make sure that PD is in a normal state. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -94,7 +94,7 @@ Change the related PD configuration to make sure that PD is in a normal state. {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl -n ${namespace} get pod -o wide ``` diff --git a/en/upgrade-tidb-operator.md b/en/upgrade-tidb-operator.md index 12338b20d25..be97ba0f818 100644 --- a/en/upgrade-tidb-operator.md +++ b/en/upgrade-tidb-operator.md @@ -21,7 +21,7 @@ This document describes how to upgrade TiDB Operator and Kubernetes. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl replace -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml && \ kubectl get crd tidbclusters.pingcap.com ``` @@ -30,7 +30,7 @@ This document describes how to upgrade TiDB Operator and Kubernetes. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl replace -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd_v1beta1.yaml && \ kubectl get crd tidbclusters.pingcap.com ``` @@ -39,7 +39,7 @@ This document describes how to upgrade TiDB Operator and Kubernetes. {{< copyable "shell-regular" >}} - ```shell + ```bash mkdir -p ${HOME}/tidb-operator/v1.2.4 && \ helm inspect values pingcap/tidb-operator --version=v1.2.4 > ${HOME}/tidb-operator/v1.2.4/values-tidb-operator.yaml ``` @@ -48,7 +48,7 @@ This document describes how to upgrade TiDB Operator and Kubernetes. {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade tidb-operator pingcap/tidb-operator --version=v1.2.4 -f ${HOME}/tidb-operator/v1.2.4/values-tidb-operator.yaml ``` @@ -56,7 +56,7 @@ This document describes how to upgrade TiDB Operator and Kubernetes. {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get po -n tidb-admin -l app.kubernetes.io/instance=tidb-operator -o yaml | grep 'image:.*operator:' ``` @@ -85,7 +85,7 @@ If your server cannot access the Internet, you can take the following steps to u {{< copyable "shell-regular" >}} - ```shell + ```bash wget -O crd.yaml https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml ``` @@ -93,7 +93,7 @@ If your server cannot access the Internet, you can take the following steps to u {{< copyable "shell-regular" >}} - ```shell + ```bash wget -O crd.yaml https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd_v1beta1.yaml ``` @@ -101,7 +101,7 @@ If your server cannot access the Internet, you can take the following steps to u {{< copyable "shell-regular" >}} - ```shell + ```bash wget http://charts.pingcap.org/tidb-operator-v1.2.4.tgz ``` @@ -109,7 +109,7 @@ If your server cannot access the Internet, you can take the following steps to u {{< copyable "shell-regular" >}} - ```shell + ```bash docker pull pingcap/tidb-operator:v1.2.4 docker pull pingcap/tidb-backup-manager:v1.2.4 @@ -123,7 +123,7 @@ If your server cannot access the Internet, you can take the following steps to u {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl replace -f ./crd.yaml ``` @@ -131,7 +131,7 @@ If your server cannot access the Internet, you can take the following steps to u {{< copyable "shell-regular" >}} - ```shell + ```bash tar zxvf tidb-operator-v1.2.4.tgz && \ mkdir -p ${HOME}/tidb-operator/v1.2.4 && cp tidb-operator/values.yaml ${HOME}/tidb-operator/v1.2.4/values-tidb-operator.yaml @@ -141,7 +141,7 @@ If your server cannot access the Internet, you can take the following steps to u {{< copyable "shell-regular" >}} - ```shell + ```bash docker load -i tidb-operator-v1.2.4.tar docker load -i tidb-backup-manager-v1.2.4.tar ``` @@ -150,7 +150,7 @@ If your server cannot access the Internet, you can take the following steps to u {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade tidb-operator ./tidb-operator --version=v1.2.4 -f ${HOME}/tidb-operator/v1.2.4/values-tidb-operator.yaml ``` @@ -158,7 +158,7 @@ If your server cannot access the Internet, you can take the following steps to u {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get po -n tidb-admin -l app.kubernetes.io/instance=tidb-operator -o yaml | grep 'image:.*operator:' ``` diff --git a/en/use-auto-failover.md b/en/use-auto-failover.md index a857a3f3d36..a85a38c54a6 100644 --- a/en/use-auto-failover.md +++ b/en/use-auto-failover.md @@ -95,7 +95,7 @@ Configure `spec.tikv.recoverFailover: true` (Supported since TiDB Operator v1.1. {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit tc -n ${namespace} ${cluster_name} ``` @@ -122,7 +122,7 @@ Configure `spec.tiflash.recoverFailover: true` (Supported since TiDB Operator v1 {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit tc -n ${namespace} ${cluster_name} ``` diff --git a/en/use-tidb-dm.md b/en/use-tidb-dm.md index 5ef0dc9874b..a8cfc633cd2 100644 --- a/en/use-tidb-dm.md +++ b/en/use-tidb-dm.md @@ -34,7 +34,7 @@ Attach to the DM-master Pod by executing the following command: {{< copyable "shell-regular" >}} -```shell +```bash kubectl exec -ti ${dm_cluster_name}-dm-master-0 -n ${namespace} - /bin/sh ``` @@ -50,7 +50,7 @@ kubectl exec -ti ${dm_cluster_name}-dm-master-0 -n ${namespace} - /bin/sh {{< copyable "shell-regular" >}} - ```shell + ```bash /dmctl --master-addr ${dm_cluster_name}-dm-master:8261 operate-source create source1.yaml ``` diff --git a/en/use-tkctl.md b/en/use-tkctl.md index 9815676d1db..c2ca531fb3e 100644 --- a/en/use-tkctl.md +++ b/en/use-tkctl.md @@ -30,7 +30,7 @@ Requirement: [Go](https://golang.org/) >= the 1.11 version or later {{< copyable "shell-regular" >}} -```shell +```bash git clone --depth=1 https://github.com/pingcap/tidb-operator.git && \ GOOS= make cli &&\ mv tkctl /usr/local/bin/tkctl @@ -46,7 +46,7 @@ To configure the auto-completion for `BASH`, you need to first install the [bash {{< copyable "shell-regular" >}} - ```shell + ```bash source <(tkctl completion bash) ``` @@ -54,7 +54,7 @@ To configure the auto-completion for `BASH`, you need to first install the [bash {{< copyable "shell-regular" >}} - ```shell + ```bash echo "if hash tkctl 2>/dev/null; then source <(tkctl completion bash); fi" >> ~/.bashrc ``` @@ -64,7 +64,7 @@ To configure the auto-completion for `ZSH`, you can choose from either of the tw {{< copyable "shell-regular" >}} - ```shell + ```bash source <(tkctl completion zsh) ``` @@ -72,7 +72,7 @@ To configure the auto-completion for `ZSH`, you can choose from either of the tw {{< copyable "shell-regular" >}} - ```shell + ```bash echo "if hash tkctl 2>/dev/null; then source <(tkctl completion zsh); fi" >> ~/.zshrc ``` @@ -82,7 +82,7 @@ To configure the auto-completion for `ZSH`, you can choose from either of the tw {{< copyable "shell-regular" >}} -```shell +```bash tkctl version ``` @@ -98,7 +98,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash tkctl version ``` @@ -121,7 +121,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash tkctl list -A ``` @@ -139,7 +139,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash tkctl use --namespace=foo demo-cluster ``` @@ -159,7 +159,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash tkctl info ``` @@ -193,7 +193,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash tkctl get tikv ``` @@ -206,7 +206,7 @@ demo-cluster-tikv-2 2/2 Running 2098Mi/4196Mi 2/2 0 4m45s {{< copyable "shell-regular" >}} -```shell +```bash tkctl get volume ``` @@ -240,13 +240,13 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash tkctl debug demo-cluster-tikv-0 ``` {{< copyable "shell-regular" >}} -```shell +```bash ps -ef ``` @@ -258,13 +258,13 @@ When you use GDB to debug the process in the target container, make sure you set {{< copyable "shell-regular" >}} -```shell +```bash tkctl debug demo-cluster-tikv-0 ``` {{< copyable "shell-regular" >}} -```shell +```bash gdb /proc/${pid:-1}/root/tikv-server 1 ``` @@ -274,7 +274,7 @@ The `.gdbinit` pre-configured in the `tidb-debug` image will set `sysroot` to `/ {{< copyable "shell-regular" >}} -```shell +```bash (gdb) set sysroot /proc/${pid}/root/ ``` @@ -282,13 +282,13 @@ Start debugging: {{< copyable "shell-regular" >}} -```shell +```bash (gdb) thread apply all bt ``` {{< copyable "shell-regular" >}} -```shell +```bash (gdb) info threads ``` @@ -298,19 +298,19 @@ To use the `perf` command and the `run_flamegraph.sh` script properly, you must {{< copyable "shell-regular" >}} -```shell +```bash tkctl debug demo-cluster-tikv-0 ``` {{< copyable "shell-regular" >}} -```shell +```bash cp /proc/1/root/tikv-server / ``` {{< copyable "shell-regular" >}} -```shell +```bash ./run_flamegraph.sh 1 ``` @@ -331,13 +331,13 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash tkctl ctop node/172.16.4.155 ``` {{< copyable "shell-regular" >}} -```shell +```bash tkctl ctop demo-cluster-tikv-0 ``` @@ -349,7 +349,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash tkctl help debug ``` @@ -361,7 +361,7 @@ For example: {{< copyable "shell-regular" >}} -```shell +```bash tkctl options ``` diff --git a/en/view-logs.md b/en/view-logs.md index 1d9eaed69b2..a4f73ec5254 100644 --- a/en/view-logs.md +++ b/en/view-logs.md @@ -14,7 +14,7 @@ The TiDB components deployed by TiDB Operator output the logs in the `stdout` an {{< copyable "shell-regular" >}} -```shell +```bash kubectl logs -n ${namespace} ${pod_name} ``` @@ -22,7 +22,7 @@ If the Pod has multiple containers, you can also view the logs of a container in {{< copyable "shell-regular" >}} -```shell +```bash kubectl logs -n ${namespace} ${pod_name} -c ${container_name} ``` @@ -34,7 +34,7 @@ For TiDB 3.0 or later versions, TiDB separates slow query logs from application {{< copyable "shell-regular" >}} -```shell +```bash kubectl logs -n ${namespace} ${pod_name} -c slowlog ``` diff --git a/zh/access-dashboard.md b/zh/access-dashboard.md index 89e86bb10fe..9a468ef45e3 100644 --- a/zh/access-dashboard.md +++ b/zh/access-dashboard.md @@ -77,7 +77,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward svc/basic-discovery -n ${namespace} 10262:10262 ``` diff --git a/zh/access-tidb.md b/zh/access-tidb.md index c4ae11ea474..cdaafebbb49 100644 --- a/zh/access-tidb.md +++ b/zh/access-tidb.md @@ -12,7 +12,7 @@ Service 可以根据场景配置不同的类型,比如 `ClusterIP`、`NodePort {{< copyable "shell-regular" >}} -```shell +```bash kubectl get svc ${serviceName} -n ${namespace} ``` @@ -45,7 +45,7 @@ basic-tidb NodePort 10.233.6.240 4000:32498/TCP,10080:30171/ {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} get svc ${cluster_name}-tidb -ojsonpath="{.spec.ports[?(@.name=='mysql-client')].nodePort}{'\n'}" ``` @@ -56,7 +56,7 @@ kubectl -n ${namespace} get svc ${cluster_name}-tidb -ojsonpath="{.spec.ports[?( {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pods -l "app.kubernetes.io/component=tidb,app.kubernetes.io/instance=${cluster_name}" -ojsonpath="{range .items[*]}{.spec.nodeName}{'\n'}{end}" ``` diff --git a/zh/advanced-statefulset.md b/zh/advanced-statefulset.md index f9e6f9ef99c..03444d86a7e 100644 --- a/zh/advanced-statefulset.md +++ b/zh/advanced-statefulset.md @@ -22,7 +22,7 @@ Kubernetes 内置 [StatefulSet](https://kubernetes.io/docs/concepts/workloads/co {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/advanced-statefulset-crd.v1beta1.yaml ``` @@ -59,7 +59,7 @@ Kubernetes 内置 [StatefulSet](https://kubernetes.io/docs/concepts/workloads/co {{< copyable "shell-regular" >}} -```shell +```bash kubectl get -n ${namespace} asts ``` diff --git a/zh/aggregate-multiple-cluster-monitor-data.md b/zh/aggregate-multiple-cluster-monitor-data.md index ca30158393a..3f92907c98e 100644 --- a/zh/aggregate-multiple-cluster-monitor-data.md +++ b/zh/aggregate-multiple-cluster-monitor-data.md @@ -59,7 +59,7 @@ Thanos 提供了跨 Prometheus 的统一查询方案 [Thanos Query](https://than {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${thanos_namespace} svc/thanos-query 9090 ``` diff --git a/zh/backup-and-restore-using-helm-charts.md b/zh/backup-and-restore-using-helm-charts.md index 956f4dd26a6..8f866ad78cf 100644 --- a/zh/backup-and-restore-using-helm-charts.md +++ b/zh/backup-and-restore-using-helm-charts.md @@ -57,7 +57,7 @@ Kubernetes 上的 TiDB 集群支持两种备份策略: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-secret -n ${namespace} --from-literal=user=${user} --from-literal=password=${password} ``` @@ -65,7 +65,7 @@ Kubernetes 上的 TiDB 集群支持两种备份策略: {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade ${release_name} pingcap/tidb-cluster -f values.yaml --version=${version} ``` @@ -89,7 +89,7 @@ Ad-hoc 全量备份封装在 `pingcap/tidb-backup` 这个 Helm chart 中。根 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-secret -n ${namespace} --from-literal=user=${user} --from-literal=password=${password} ``` @@ -97,7 +97,7 @@ Ad-hoc 全量备份封装在 `pingcap/tidb-backup` 这个 Helm chart 中。根 {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${backup_name} pingcap/tidb-backup --namespace=${namespace} -f values.yaml --version=${version} ``` @@ -107,7 +107,7 @@ Ad-hoc 全量备份封装在 `pingcap/tidb-backup` 这个 Helm chart 中。根 {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pvc -n ${namespace} -l app.kubernetes.io/component=backup,pingcap.com/backup-cluster-name=${cluster_name} ``` @@ -125,7 +125,7 @@ kubectl get pvc -n ${namespace} -l app.kubernetes.io/component=backup,pingcap.co {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-secret -n ${namespace} --from-literal=user=${user} --from-literal=password=${password} ``` @@ -133,7 +133,7 @@ kubectl get pvc -n ${namespace} -l app.kubernetes.io/component=backup,pingcap.co {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${restore_name} pingcap/tidb-backup --namespace=${namespace} -f values.yaml --version=${version} ``` @@ -153,7 +153,7 @@ kubectl get pvc -n ${namespace} -l app.kubernetes.io/component=backup,pingcap.co {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run offline-pump-${ordinal_id} --image=pingcap/tidb-binlog:${version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${release_name}-pd:2379 -cmd offline-pump -node-id ${release_name}-pump-${ordinal_id}:8250 ``` @@ -161,7 +161,7 @@ kubectl get pvc -n ${namespace} -l app.kubernetes.io/component=backup,pingcap.co {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs -f -n ${namespace} ${release_name}-pump-${ordinal_id} ``` @@ -171,6 +171,6 @@ kubectl get pvc -n ${namespace} -l app.kubernetes.io/component=backup,pingcap.co {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade ${release_name} pingcap/tidb-cluster -f values.yaml --version=${chart_version} ``` diff --git a/zh/backup-restore-overview.md b/zh/backup-restore-overview.md index b4a01a72eb4..77374fa89ea 100644 --- a/zh/backup-restore-overview.md +++ b/zh/backup-restore-overview.md @@ -84,7 +84,7 @@ TiDB Operator 1.1 及以上版本推荐使用基于 CustomResourceDefinition (CR {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path} ``` @@ -234,7 +234,7 @@ TiDB Operator 1.1 及以上版本推荐使用基于 CustomResourceDefinition (CR {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path} ``` @@ -282,7 +282,7 @@ TiDB Operator 1.1 及以上版本推荐使用基于 CustomResourceDefinition (CR {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete backup ${name} -n ${namespace} kubectl delete backupschedule ${name} -n ${namespace} ``` @@ -297,7 +297,7 @@ kubectl delete backupschedule ${name} -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit backup ${name} -n ${namespace} ``` diff --git a/zh/backup-to-aws-s3-using-br.md b/zh/backup-to-aws-s3-using-br.md index 8cd7a9ed7ca..4186f3310a6 100644 --- a/zh/backup-to-aws-s3-using-br.md +++ b/zh/backup-to-aws-s3-using-br.md @@ -28,7 +28,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test1 ``` @@ -40,7 +40,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password=${password} --namespace=test1 ``` @@ -54,7 +54,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-aws-s3.yaml ``` @@ -99,7 +99,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-aws-s3.yaml ``` @@ -145,7 +145,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-aws-s3.yaml ``` @@ -198,7 +198,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bk -n test1 -o wide ``` @@ -216,7 +216,7 @@ kubectl get bk -n test1 -o wide {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-scheduler-aws-s3.yaml ``` @@ -264,7 +264,7 @@ kubectl get bk -n test1 -o wide {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-scheduler-aws-s3.yaml ``` @@ -313,7 +313,7 @@ kubectl get bk -n test1 -o wide {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-scheduler-aws-s3.yaml ``` @@ -361,7 +361,7 @@ kubectl get bk -n test1 -o wide {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bks -n test1 -o wide ``` @@ -369,7 +369,7 @@ kubectl get bks -n test1 -o wide {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-s3 -n test1 ``` diff --git a/zh/backup-to-gcs-using-br.md b/zh/backup-to-gcs-using-br.md index f73489dc18f..53518e6b2ed 100644 --- a/zh/backup-to-gcs-using-br.md +++ b/zh/backup-to-gcs-using-br.md @@ -26,7 +26,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test1 ``` @@ -38,7 +38,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password= --namespace=test1 ``` @@ -52,7 +52,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-gcs.yaml ``` @@ -108,7 +108,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -n test1 -owide ``` @@ -126,7 +126,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-gcs.yaml ``` @@ -174,7 +174,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bks -n test1 -owide ``` @@ -182,7 +182,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-gcs -n test1 ``` diff --git a/zh/backup-to-gcs.md b/zh/backup-to-gcs.md index 97c0880127e..a6599a47013 100644 --- a/zh/backup-to-gcs.md +++ b/zh/backup-to-gcs.md @@ -30,7 +30,7 @@ Ad-hoc 全量备份通过创建一个自定义的 `Backup` custom resource (CR) {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test1 ``` @@ -42,7 +42,7 @@ Ad-hoc 全量备份通过创建一个自定义的 `Backup` custom resource (CR) {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password=${password} --namespace=test1 ``` @@ -52,7 +52,7 @@ Ad-hoc 全量备份通过创建一个自定义的 `Backup` custom resource (CR) {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-gcs.yaml ``` @@ -108,7 +108,7 @@ Ad-hoc 全量备份通过创建一个自定义的 `Backup` custom resource (CR) {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -n test1 -owide ``` @@ -126,7 +126,7 @@ Ad-hoc 全量备份通过创建一个自定义的 `Backup` custom resource (CR) {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-gcs.yaml ``` @@ -173,7 +173,7 @@ Ad-hoc 全量备份通过创建一个自定义的 `Backup` custom resource (CR) {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bks -n test1 -owide ``` @@ -181,7 +181,7 @@ Ad-hoc 全量备份通过创建一个自定义的 `Backup` custom resource (CR) {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-gcs -n test1 ``` diff --git a/zh/backup-to-pv-using-br.md b/zh/backup-to-pv-using-br.md index ac67922617a..8e2c0376ac3 100644 --- a/zh/backup-to-pv-using-br.md +++ b/zh/backup-to-pv-using-br.md @@ -29,7 +29,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test1 ``` @@ -37,7 +37,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password= --namespace=test1 ``` @@ -68,7 +68,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-nfs.yaml ``` @@ -127,7 +127,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -n test1 -owide ``` @@ -145,7 +145,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-nfs.yaml ``` @@ -194,7 +194,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bks -n test1 -owide ``` @@ -202,7 +202,7 @@ Ad-hoc 备份支持全量备份与增量备份。Ad-hoc 备份通过创建一个 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-nfs -n test1 ``` diff --git a/zh/backup-to-s3.md b/zh/backup-to-s3.md index c907b8bd795..a6afc9dc0a7 100644 --- a/zh/backup-to-s3.md +++ b/zh/backup-to-s3.md @@ -23,7 +23,7 @@ Ad-hoc 全量备份通过创建一个自定义的 `Backup` custom resource (CR) {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/backup/backup-rbac.yaml -n tidb-cluster ``` @@ -35,7 +35,7 @@ Ad-hoc 全量备份通过创建一个自定义的 `Backup` custom resource (CR) {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-demo1-tidb-secret --from-literal=password=${password} --namespace=tidb-cluster ``` @@ -86,7 +86,7 @@ GRANT {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-s3.yaml ``` @@ -128,7 +128,7 @@ GRANT {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-s3.yaml ``` @@ -167,7 +167,7 @@ GRANT {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-s3.yaml ``` @@ -211,7 +211,7 @@ GRANT {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-s3.yaml ``` @@ -266,7 +266,7 @@ options: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bk -n tidb-cluster -owide ``` @@ -274,7 +274,7 @@ kubectl get bk -n tidb-cluster -owide {{< copyable "shell-regular" >}} -```shell +```bash kubectl describe bk -n tidb-cluster $backup_job_name ``` @@ -309,7 +309,7 @@ kubectl describe bk -n tidb-cluster $backup_job_name {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-s3.yaml ``` @@ -356,7 +356,7 @@ kubectl describe bk -n tidb-cluster $backup_job_name {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-s3.yaml ``` @@ -400,7 +400,7 @@ kubectl describe bk -n tidb-cluster $backup_job_name {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-s3.yaml ``` @@ -448,7 +448,7 @@ kubectl describe bk -n tidb-cluster $backup_job_name {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-schedule-s3.yaml ``` @@ -495,7 +495,7 @@ kubectl describe bk -n tidb-cluster $backup_job_name {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bks -n tidb-cluster -owide ``` @@ -503,7 +503,7 @@ kubectl get bks -n tidb-cluster -owide {{< copyable "shell-regular" >}} -```shell +```bash kubectl get bk -l tidb.pingcap.com/backup-schedule=demo1-backup-schedule-s3 -n tidb-cluster ``` diff --git a/zh/benchmark-sysbench.md b/zh/benchmark-sysbench.md index c2b728146a2..b7239980358 100644 --- a/zh/benchmark-sysbench.md +++ b/zh/benchmark-sysbench.md @@ -120,7 +120,7 @@ GKE 支持两种操作系统:COS (Container Optimized OS) 和 Ubuntu 。Point 内核统一做了如下配置: -```shell +```bash sysctl net.core.somaxconn=32768 sysctl vm.swappiness=0 sysctl net.ipv4.tcp_syncookies=0 @@ -134,7 +134,7 @@ sysctl net.ipv4.tcp_syncookies=0 #### 初始化 -```shell +```bash sysbench \ --mysql-host=${tidb_host} \ --mysql-port=4000 \ @@ -156,7 +156,7 @@ sysbench \ #### 预热 -```shell +```bash sysbench \ --mysql-host=${tidb_host} \ --mysql-port=4000 \ @@ -176,7 +176,7 @@ sysbench \ #### 压测 -```shell +```bash sysbench \ --mysql-host=${tidb_host} \ --mysql-port=4000 \ diff --git a/zh/canary-upgrade-tidb-operator.md b/zh/canary-upgrade-tidb-operator.md index 66004d23a18..6e7136f8480 100644 --- a/zh/canary-upgrade-tidb-operator.md +++ b/zh/canary-upgrade-tidb-operator.md @@ -61,7 +61,7 @@ summary: 介绍如何灰度升级 TiDB Operator。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} label tc ${cluster_name} version=canary ``` @@ -69,7 +69,7 @@ summary: 介绍如何灰度升级 TiDB Operator。 1. 查看当前 TiDB Operator `tidb-controller-manager` 的日志: - ```shell + ```bash kubectl -n tidb-admin logs tidb-controller-manager-55b887bdc9-lzdwv ``` @@ -79,7 +79,7 @@ summary: 介绍如何灰度升级 TiDB Operator。 2. 查看灰度 TiDB Operator `tidb-controller-manager` 的日志: - ```shell + ```bash kubectl -n tidb-admin-canary logs tidb-controller-manager-canary-6dcb9bdd95-qf4qr ``` @@ -91,13 +91,13 @@ summary: 介绍如何灰度升级 TiDB Operator。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} edit tc ${cluster_name} ``` 修改后,集群内各组件会滚动升级,可以通过查看灰度 TiDB Operator `tidb-scheduler` 的日志确认集群已经使用灰度 `tidb-scheduler`: - ```shell + ```bash kubectl -n tidb-admin-canary logs tidb-scheduler-canary-7f7b6c7c6-j5p2j -c tidb-scheduler ``` @@ -105,19 +105,19 @@ summary: 介绍如何灰度升级 TiDB Operator。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} label tc ${cluster_name} version- ``` {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} edit tc ${cluster_name} ``` 6. 删除灰度 TiDB Operator。 - ```shell + ```bash helm -n tidb-admin-canary uninstall ${release_name} ``` diff --git a/zh/cheat-sheet.md b/zh/cheat-sheet.md index c84e0f08fce..c1cb20eab24 100644 --- a/zh/cheat-sheet.md +++ b/zh/cheat-sheet.md @@ -16,7 +16,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get crd ``` @@ -24,7 +24,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get tc ${name} ``` @@ -32,7 +32,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get tidbmonitor ${name} ``` @@ -40,7 +40,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get bk ${name} ``` @@ -48,7 +48,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get bks ${name} ``` @@ -56,7 +56,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get restore ${name} ``` @@ -64,7 +64,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get tidbclusterautoscaler ${name} ``` @@ -72,7 +72,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get tidbinitializer ${name} ``` @@ -80,7 +80,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get asts ${name} ``` @@ -88,7 +88,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pod ${name} ``` @@ -96,19 +96,19 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pod -l app.kubernetes.io/component=tikv ``` 持续观察 Pod 状态变化: - ```shell + ```bash watch kubectl -n ${namespace} get pod ``` 查看 Pod 详细信息: - ```shell + ```bash kubectl -n ${namespace} describe pod ${name} ``` @@ -116,7 +116,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pods -l "app.kubernetes.io/component=tidb,app.kubernetes.io/instance=${cluster_name}" -ojsonpath="{range .items[*]}{.spec.nodeName}{'\n'}{end}" ``` @@ -124,7 +124,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get service ${name} ``` @@ -132,7 +132,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get cm ${name} ``` @@ -140,7 +140,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pv ${name} ``` @@ -148,7 +148,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pv -l app.kubernetes.io/namespace=${namespace},app.kubernetes.io/managed-by=tidb-operator,app.kubernetes.io/instance=${cluster_name} ``` @@ -156,7 +156,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pvc ${name} ``` @@ -164,7 +164,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get sc ``` @@ -172,7 +172,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get sts ${name} ``` @@ -180,7 +180,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} describe sts ${name} ``` @@ -190,7 +190,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} annotate tc ${cluster_name} ${key}=${value} ``` @@ -198,7 +198,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} annotate --overwrite tc ${cluster_name} tidb.pingcap.com/force-upgrade=true ``` @@ -206,7 +206,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} annotate tc ${cluster_name} tidb.pingcap.com/force-upgrade- ``` @@ -214,7 +214,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} annotate pod ${pod_name} runmode=debug ``` @@ -224,7 +224,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} edit tc ${name} ``` @@ -234,7 +234,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pv ${name} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` @@ -242,7 +242,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} patch pvc ${name} -p '{"spec": {"resources": {"requests": {"storage": "100Gi"}}}' ``` @@ -250,7 +250,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch storageclass ${name} -p '{"allowVolumeExpansion": true}' ``` @@ -260,7 +260,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} apply -f ${file} ``` @@ -268,7 +268,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create ns ${namespace} ``` @@ -278,7 +278,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} create secret generic ${secret_name} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path} ``` @@ -286,7 +286,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} create secret generic ${secret_name} --from-literal=user=${user} --from-literal=password=${password} ``` @@ -296,7 +296,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} -it exec ${pod_name} -- cat /etc/pd/pd.toml ``` @@ -304,7 +304,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} -it exec ${pod_name} -- cat /etc/tidb/tidb.toml ``` @@ -312,7 +312,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} -it exec ${pod_name} -- cat /etc/tikv/tikv.toml ``` @@ -320,7 +320,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} logs ${pod_name} -f ``` @@ -328,7 +328,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} logs ${pod_name} -p ``` @@ -336,7 +336,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} logs ${pod_name} -c ${container_name} ``` @@ -344,7 +344,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} port-forward svc/${service_name} ${local_port}:${port_in_pod} ``` @@ -352,7 +352,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} port-forward svc/${cluster_name}-pd 2379:2379 ``` @@ -362,7 +362,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl cordon ${node_name} ``` @@ -370,7 +370,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl uncordon ${node_name} ``` @@ -380,7 +380,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pod ${pod_name} ``` @@ -388,7 +388,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pvc ${pvc_name} ``` @@ -396,7 +396,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} tc ${tc_name} ``` @@ -404,7 +404,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} tidbmonitor ${tidb_monitor_name} ``` @@ -412,7 +412,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} delete tidbclusterautoscaler ${name} ``` @@ -426,7 +426,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/cheat-sheet/'] {{< copyable "shell-regular" >}} -```shell +```bash helm repo add pingcap https://charts.pingcap.org/ ``` @@ -434,7 +434,7 @@ helm repo add pingcap https://charts.pingcap.org/ {{< copyable "shell-regular" >}} -```shell +```bash helm repo update ``` @@ -444,7 +444,7 @@ helm repo update {{< copyable "shell-regular" >}} - ```shell + ```bash helm search hub ${chart_name} ``` @@ -452,7 +452,7 @@ helm repo update {{< copyable "shell-regular" >}} - ```shell + ```bash helm search hub mysql ``` @@ -460,7 +460,7 @@ helm repo update {{< copyable "shell-regular" >}} - ```shell + ```bash helm search repo ${chart_name} -l --devel ``` @@ -468,7 +468,7 @@ helm repo update {{< copyable "shell-regular" >}} - ```shell + ```bash helm search repo tidb-operator -l --devel ``` @@ -476,7 +476,7 @@ helm repo update {{< copyable "shell-regular" >}} -```shell +```bash helm inspect values ${chart_name} --version=${chart_version} > values.yaml ``` @@ -484,7 +484,7 @@ helm inspect values ${chart_name} --version=${chart_version} > values.yaml {{< copyable "shell-regular" >}} -```shell +```bash helm inspect values pingcap/tidb-operator --version=v1.2.4 > values-tidb-operator.yaml ``` @@ -492,7 +492,7 @@ helm inspect values pingcap/tidb-operator --version=v1.2.4 > values-tidb-operato {{< copyable "shell-regular" >}} -```shell +```bash helm install ${name} ${chart_name} --namespace=${namespace} --version=${chart_version} -f ${values_file} ``` @@ -500,7 +500,7 @@ helm install ${name} ${chart_name} --namespace=${namespace} --version=${chart_ve {{< copyable "shell-regular" >}} -```shell +```bash helm install tidb-operator pingcap/tidb-operator --namespace=tidb-admin --version=v1.2.4 -f values-tidb-operator.yaml ``` @@ -508,7 +508,7 @@ helm install tidb-operator pingcap/tidb-operator --namespace=tidb-admin --versio {{< copyable "shell-regular" >}} -```shell +```bash helm ls ``` @@ -516,7 +516,7 @@ helm ls {{< copyable "shell-regular" >}} -```shell +```bash helm upgrade ${name} ${chart_name} --version=${chart_version} -f ${values_file} ``` @@ -524,7 +524,7 @@ helm upgrade ${name} ${chart_name} --version=${chart_version} -f ${values_file} {{< copyable "shell-regular" >}} -```shell +```bash helm upgrade tidb-operator pingcap/tidb-operator --version=v1.2.4 -f values-tidb-operator.yaml ``` @@ -532,7 +532,7 @@ helm upgrade tidb-operator pingcap/tidb-operator --version=v1.2.4 -f values-tidb {{< copyable "shell-regular" >}} -```shell +```bash helm uninstall ${name} -n ${namespace} ``` @@ -540,7 +540,7 @@ helm uninstall ${name} -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash helm uninstall tidb-operator -n tidb-admin ``` diff --git a/zh/configure-a-tidb-cluster.md b/zh/configure-a-tidb-cluster.md index fdee634d6af..c5b20f933ae 100644 --- a/zh/configure-a-tidb-cluster.md +++ b/zh/configure-a-tidb-cluster.md @@ -629,7 +629,7 @@ topologySpreadConstraints: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl label node ${node_name} region=${region_name} zone=${zone_name} rack=${rack_name} kubernetes.io/hostname=${host_name} ``` diff --git a/zh/configure-backup.md b/zh/configure-backup.md index 2ae058dbb55..c37d1df412a 100644 --- a/zh/configure-backup.md +++ b/zh/configure-backup.md @@ -38,7 +38,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/configure-backup/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic backup-secret -n ${namespace} --from-literal=user=root --from-literal=password=${password} ``` @@ -83,7 +83,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/configure-backup/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic gcp-backup-secret -n ${namespace} --from-file=./credentials.json ``` @@ -111,6 +111,6 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/configure-backup/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ceph-backup-secret -n ${namespace} --from-literal=access_key=${access_key} --from-literal=secret_key=${secret_key} ``` diff --git a/zh/configure-storage-class.md b/zh/configure-storage-class.md index c2ca06da4d0..ec1ce6c07e7 100644 --- a/zh/configure-storage-class.md +++ b/zh/configure-storage-class.md @@ -38,7 +38,7 @@ Kubernetes 1.11 及以上的版本支持[网络 PV 的动态扩容](https://kube {{< copyable "shell-regular" >}} -```shell +```bash kubectl patch storageclass ${storage_class} -p '{"allowVolumeExpansion": true}' ``` @@ -50,7 +50,7 @@ kubectl patch storageclass ${storage_class} -p '{"allowVolumeExpansion": true}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pvc -n ${namespace} ${pvc_name} -p '{"spec": {"resources": {"requests": {"storage": "100Gi"}}}' ``` @@ -60,7 +60,7 @@ kubectl patch storageclass ${storage_class} -p '{"allowVolumeExpansion": true}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pv | grep ${pvc_name} ``` @@ -76,7 +76,7 @@ Kubernetes 当前支持静态分配的本地存储。可使用 [local-static-pro {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/local-dind/local-volume-provisioner.yaml ``` @@ -84,7 +84,7 @@ Kubernetes 当前支持静态分配的本地存储。可使用 [local-static-pro {{< copyable "shell-regular" >}} - ```shell + ```bash wget https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/local-dind/local-volume-provisioner.yaml kubectl apply -f ./local-volume-provisioner.yaml ``` @@ -110,7 +110,7 @@ Kubernetes 当前支持静态分配的本地存储。可使用 [local-static-pro {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get po -n kube-system -l app=local-volume-provisioner && \ kubectl get pv | grep local-storage ``` @@ -253,7 +253,7 @@ data: {{< copyable "shell-regular" >}} -```shell +```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/local-dind/local-volume-provisioner.yaml ``` @@ -285,7 +285,7 @@ kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/ {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pv ${pv_name} -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' ``` @@ -301,7 +301,7 @@ PV 保留策略是 `Retain` 时,如果确认某个 PV 的数据可以被删除 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete pvc ${pvc_name} --namespace=${namespace} ``` @@ -309,7 +309,7 @@ PV 保留策略是 `Retain` 时,如果确认某个 PV 的数据可以被删除 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pv ${pv_name} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` diff --git a/zh/deploy-failures.md b/zh/deploy-failures.md index 7d867fa10fb..260c37043fc 100644 --- a/zh/deploy-failures.md +++ b/zh/deploy-failures.md @@ -14,7 +14,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-failures/'] {{< copyable "shell-regular" >}} -```shell +```bash kubectl get tidbclusters -n ${namespace} kubectl describe tidbclusters -n ${namespace} ${cluster_name} kubectl get statefulsets -n ${namespace} @@ -25,7 +25,7 @@ kubectl describe statefulsets -n ${namespace} ${cluster_name}-pd {{< copyable "shell-regular" >}} -```shell +```bash kubectl get backups -n ${namespace} kubectl get jobs -n ${namespace} kubectl describe backups -n ${namespace} ${backup_name} @@ -100,7 +100,7 @@ Pod 处于 CrashLoopBackOff 状态意味着 Pod 内的容器重复地异常退 {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} logs -f ${pod_name} ``` @@ -108,7 +108,7 @@ kubectl -n ${namespace} logs -f ${pod_name} {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} logs -p ${pod_name} ``` diff --git a/zh/deploy-heterogeneous-tidb-cluster.md b/zh/deploy-heterogeneous-tidb-cluster.md index 2e5adda558c..e6910594609 100644 --- a/zh/deploy-heterogeneous-tidb-cluster.md +++ b/zh/deploy-heterogeneous-tidb-cluster.md @@ -66,7 +66,7 @@ spec: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f cluster.yaml -n ${namespace} ``` @@ -106,7 +106,7 @@ spec: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f tidbmonitor.yaml -n ${namespace} ``` @@ -174,7 +174,7 @@ spec: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f cluster.yaml -n ${namespace} ``` diff --git a/zh/deploy-multiple-tidb-operator.md b/zh/deploy-multiple-tidb-operator.md index f7fad92fa4d..3827b9fc897 100644 --- a/zh/deploy-multiple-tidb-operator.md +++ b/zh/deploy-multiple-tidb-operator.md @@ -84,7 +84,7 @@ aliases: ['/zh/tidb-in-kubernetes/dev/canary-deployment-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} label tidbcluster ${cluster_name} user=dev ``` @@ -134,7 +134,7 @@ aliases: ['/zh/tidb-in-kubernetes/dev/canary-deployment-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} label tidbcluster ${cluster_name} user=qa ``` @@ -146,7 +146,7 @@ aliases: ['/zh/tidb-in-kubernetes/dev/canary-deployment-tidb-operator/'] 查看第一套 TiDB Operator `tidb-controller-manager` 的日志: - ```shell + ```bash kubectl -n tidb-admin logs tidb-controller-manager-55b887bdc9-lzdwv ``` @@ -164,7 +164,7 @@ aliases: ['/zh/tidb-in-kubernetes/dev/canary-deployment-tidb-operator/'] 查看第二套 TiDB Operator `tidb-controller-manager` 的日志: - ```shell + ```bash kubectl -n tidb-admin-qa logs tidb-controller-manager-qa-5dfcd7f9-vll4c ``` diff --git a/zh/deploy-on-alibaba-cloud.md b/zh/deploy-on-alibaba-cloud.md index e60d8849a2b..b9a3380a3eb 100644 --- a/zh/deploy-on-alibaba-cloud.md +++ b/zh/deploy-on-alibaba-cloud.md @@ -64,7 +64,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-alibaba-cloud/'] {{< copyable "shell-regular" >}} - ```shell + ```bash export TF_VAR_ALICLOUD_REGION=${REGION} && \ export TF_VAR_ALICLOUD_ACCESS_KEY=${ACCESS_KEY} && \ export TF_VAR_ALICLOUD_SECRET_KEY=${SECRET_KEY} @@ -76,7 +76,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-alibaba-cloud/'] {{< copyable "shell-regular" >}} - ```shell + ```bash git clone --depth=1 https://github.com/pingcap/tidb-operator && \ cd tidb-operator/deploy/aliyun ``` @@ -104,7 +104,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-alibaba-cloud/'] {{< copyable "shell-regular" >}} - ```shell + ```bash terraform init ``` @@ -112,7 +112,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-alibaba-cloud/'] {{< copyable "shell-regular" >}} - ```shell + ```bash terraform apply ``` @@ -140,19 +140,19 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-alibaba-cloud/'] {{< copyable "shell-regular" >}} - ```shell + ```bash export KUBECONFIG=$PWD/credentials/kubeconfig ``` {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl version ``` {{< copyable "shell-regular" >}} - ```shell + ```bash helm ls ``` @@ -162,7 +162,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-alibaba-cloud/'] {{< copyable "shell-regular" >}} - ```shell + ```bash cp manifests/db.yaml.example db.yaml && cp manifests/db-monitor.yaml.example db-monitor.yaml ``` @@ -242,7 +242,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-alibaba-cloud/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl --kubeconfig credentials/kubeconfig create namespace ${namespace} ``` @@ -254,7 +254,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-alibaba-cloud/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl --kubeconfig credentials/kubeconfig create -f db.yaml -n ${namespace} && kubectl --kubeconfig credentials/kubeconfig create -f db-monitor.yaml -n ${namespace} ``` @@ -269,13 +269,13 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-alibaba-cloud/'] {{< copyable "shell-regular" >}} -```shell +```bash ssh -i credentials/${cluster_name}-key.pem root@${bastion_ip} ``` {{< copyable "shell-regular" >}} -```shell +```bash mysql --comments -h ${tidb_lb_ip} -P 4000 -u root ``` @@ -330,7 +330,7 @@ kubectl get pods --namespace ${namespace} -o wide --watch {{< copyable "shell-regular" >}} -```shell +```bash terraform destroy ``` @@ -338,13 +338,13 @@ terraform destroy {{< copyable "shell-regular" >}} -```shell +```bash terraform state list ``` {{< copyable "shell-regular" >}} -```shell +```bash terraform state rm module.ack.alicloud_cs_managed_kubernetes.k8s ``` @@ -445,7 +445,7 @@ module "tidb-cluster-staging" { {{< copyable "shell-regular" >}} - ```shell + ```bash mkdir -p deploy/aliyun-staging ``` diff --git a/zh/deploy-on-aws-eks.md b/zh/deploy-on-aws-eks.md index b1fe2ab0977..502d4ec6844 100644 --- a/zh/deploy-on-aws-eks.md +++ b/zh/deploy-on-aws-eks.md @@ -148,7 +148,7 @@ nodeGroups: {{< copyable "shell-regular" >}} -```shell +```bash eksctl create cluster -f cluster.yaml ``` @@ -259,7 +259,7 @@ mountOptions: {{< copyable "shell-regular" >}} - ```shell + ```bash eksctl create nodegroups -f cluster.yaml ``` @@ -277,7 +277,7 @@ mountOptions: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f ``` @@ -301,7 +301,7 @@ mountOptions: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create namespace tidb-cluster ``` @@ -315,7 +315,7 @@ kubectl create namespace tidb-cluster {{< copyable "shell-regular" >}} -```shell +```bash curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/aws/tidb-cluster.yaml && curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/aws/tidb-monitor.yaml ``` @@ -330,7 +330,7 @@ curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/ {{< copyable "shell-regular" >}} -```shell +```bash kubectl apply -f tidb-cluster.yaml -n tidb-cluster && \ kubectl apply -f tidb-monitor.yaml -n tidb-cluster ``` @@ -347,7 +347,7 @@ kubectl apply -f tidb-monitor.yaml -n tidb-cluster {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pods -n tidb-cluster ``` @@ -379,7 +379,7 @@ VPC 和 Subnet 需选择集群的 VPC 和 Subnet,在下拉框通过集群名 {{< copyable "shell-regular" >}} -```shell +```bash eksctl get cluster -n ${clusterName} ``` @@ -397,7 +397,7 @@ eksctl get cluster -n ${clusterName} {{< copyable "shell-regular" >}} -```shell +```bash ssh [-i /path/to/your/private-key.pem] ec2-user@ ``` @@ -405,7 +405,7 @@ ssh [-i /path/to/your/private-key.pem] ec2-user@ {{< copyable "shell-regular" >}} -```shell +```bash sudo yum install mysql -y ``` @@ -413,7 +413,7 @@ sudo yum install mysql -y {{< copyable "shell-regular" >}} -```shell +```bash mysql --comments -h ${tidb-nlb-dnsname} -P 4000 -u root ``` @@ -421,7 +421,7 @@ mysql --comments -h ${tidb-nlb-dnsname} -P 4000 -u root 以下为一个连接 TiDB 集群的示例: -```shell +```bash $ mysql --comments -h abfc623004ccb4cc3b363f3f37475af1-9774d22c27310bc1.elb.us-west-2.amazonaws.com -P 4000 -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 1189 @@ -456,7 +456,7 @@ MySQL [(none)]> show status; {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n tidb-cluster get svc basic-grafana ``` @@ -496,7 +496,7 @@ TiKV 扩容需要保证在各可用区均匀扩容。以下是将集群 `${clust {{< copyable "shell-regular" >}} -```shell +```bash eksctl scale nodegroup --cluster ${clusterName} --name tikv-1a --nodes 2 --nodes-min 2 --nodes-max 2 eksctl scale nodegroup --cluster ${clusterName} --name tikv-1c --nodes 2 --nodes-min 2 --nodes-max 2 eksctl scale nodegroup --cluster ${clusterName} --name tikv-1d --nodes 2 --nodes-min 2 --nodes-max 2 diff --git a/zh/deploy-on-azure-aks.md b/zh/deploy-on-azure-aks.md index ff0e0e77f44..27a90be7f11 100644 --- a/zh/deploy-on-azure-aks.md +++ b/zh/deploy-on-azure-aks.md @@ -27,7 +27,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-azure-aks/'] {{< copyable "shell-regular" >}} - ```shell + ```bash az extension add --name aks-preview ``` @@ -35,7 +35,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-azure-aks/'] {{< copyable "shell-regular" >}} - ```shell + ```bash az feature register --name EnableAzureDiskFileCSIDriver --namespace Microsoft.ContainerService --subscription ${your-subscription-id} ``` @@ -51,7 +51,7 @@ TiDB 集群大部分组件使用 Azure 磁盘作为存储,根据 AKS 中的[ {{< copyable "shell-regular" >}} -```shell +```bash az aks create \ --resource-group ${resourceGroup} \ --name ${clusterName} \ @@ -72,7 +72,7 @@ az aks create \ {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name admin \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -86,7 +86,7 @@ az aks create \ {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name pd \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -102,7 +102,7 @@ az aks create \ {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tidb \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -118,7 +118,7 @@ az aks create \ {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -139,7 +139,7 @@ Azure AKS 集群使用 "尽量实现区域均衡" 在多个可用区间部署节 {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv1 \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -156,7 +156,7 @@ Azure AKS 集群使用 "尽量实现区域均衡" 在多个可用区间部署节 {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv2 \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -173,7 +173,7 @@ Azure AKS 集群使用 "尽量实现区域均衡" 在多个可用区间部署节 {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv3 \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -218,7 +218,7 @@ mountOptions: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create namespace tidb-cluster ``` @@ -232,7 +232,7 @@ kubectl create namespace tidb-cluster {{< copyable "shell-regular" >}} -```shell +```bash curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/aks/tidb-cluster.yaml && \ curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/aks/tidb-monitor.yaml ``` @@ -247,7 +247,7 @@ curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/ {{< copyable "shell-regular" >}} -```shell +```bash kubectl apply -f tidb-cluster.yaml -n tidb-cluster && \ kubectl apply -f tidb-monitor.yaml -n tidb-cluster ``` @@ -260,7 +260,7 @@ kubectl apply -f tidb-monitor.yaml -n tidb-cluster {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pods -n tidb-cluster ``` @@ -310,7 +310,7 @@ tidb-tikv-2 1/1 Running 0 47h {{< copyable "shell-regular" >}} -```shell +```bash sudo yum install mysql -y ``` @@ -318,7 +318,7 @@ sudo yum install mysql -y {{< copyable "shell-regular" >}} -```shell +```bash mysql --comments -h ${tidb-lb-ip} -P 4000 -u root ``` @@ -326,7 +326,7 @@ mysql --comments -h ${tidb-lb-ip} -P 4000 -u root 以下为一个连接 TiDB 集群的示例: -```shell +```bash mysql --comments -h 20.240.0.7 -P 4000 -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 1189 @@ -361,13 +361,13 @@ MySQL [(none)]> show status; {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n tidb-cluster get svc basic-grafana ``` 示例输出: -```shell +```bash kubectl get svc basic-grafana NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE basic-grafana LoadBalancer 10.100.199.42 20.240.0.8 3000:30761/TCP 121m @@ -401,7 +401,7 @@ TiKV 扩容需要保证在各可用区均匀扩容。以下是将集群 `${clust {{< copyable "shell-regular" >}} -```shell +```bash az aks nodepool scale \ --resource-group ${resourceGroup} \ --cluster-name ${clusterName} \ @@ -431,7 +431,7 @@ az aks nodepool scale \ {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tiflash \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -447,7 +447,7 @@ az aks nodepool scale \ {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name ticdc \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -579,7 +579,7 @@ Azure Disk 支持多种磁盘类型。若需要低延迟、高吞吐,可以选 {{< copyable "shell-regular" >}} - ```shell + ```bash az aks nodepool add --name tikv \ --cluster-name ${clusterName} \ --resource-group ${resourceGroup} \ @@ -600,7 +600,7 @@ Azure Disk 支持多种磁盘类型。若需要低延迟、高吞吐,可以选 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/eks/local-volume-provisioner.yaml ``` diff --git a/zh/deploy-on-gcp-gke.md b/zh/deploy-on-gcp-gke.md index a5d1d6cb7c4..72da8acaddf 100644 --- a/zh/deploy-on-gcp-gke.md +++ b/zh/deploy-on-gcp-gke.md @@ -29,7 +29,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-gcp-gke/'] {{< copyable "shell-regular" >}} -```shell +```bash gcloud config set core/project gcloud config set compute/region ``` @@ -42,7 +42,7 @@ gcloud config set compute/region {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud container clusters create tidb --region us-east1 --machine-type n1-standard-4 --num-nodes=1 ``` @@ -54,7 +54,7 @@ gcloud config set compute/region {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud container node-pools create pd --cluster tidb --machine-type n1-standard-4 --num-nodes=1 \ --node-labels=dedicated=pd --node-taints=dedicated=pd:NoSchedule gcloud container node-pools create tikv --cluster tidb --machine-type n1-highmem-8 --num-nodes=1 \ @@ -79,7 +79,7 @@ gcloud config set compute/region {{< copyable "shell-regular" >}} -```shell +```bash kubectl create namespace tidb-cluster ``` @@ -93,7 +93,7 @@ kubectl create namespace tidb-cluster {{< copyable "shell-regular" >}} -```shell +```bash curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/gcp/tidb-cluster.yaml && curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/gcp/tidb-monitor.yaml ``` @@ -104,7 +104,7 @@ curl -O https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/ {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f tidb-cluster.yaml -n tidb-cluster && \ kubectl create -f tidb-monitor.yaml -n tidb-cluster ``` @@ -121,7 +121,7 @@ kubectl create -f tidb-monitor.yaml -n tidb-cluster {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pods -n tidb-cluster ``` @@ -149,7 +149,7 @@ tidb-tikv-2 1/1 Running 0 47h {{< copyable "shell-regular" >}} -```shell +```bash gcloud compute instances create bastion \ --machine-type=n1-standard-4 \ --image-project=centos-cloud \ @@ -169,7 +169,7 @@ gcloud compute instances create bastion \ {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud compute ssh tidb@bastion ``` @@ -177,7 +177,7 @@ gcloud compute instances create bastion \ {{< copyable "shell-regular" >}} - ```shell + ```bash sudo yum install mysql -y ``` @@ -185,7 +185,7 @@ gcloud compute instances create bastion \ {{< copyable "shell-regular" >}} - ```shell + ```bash mysql --comments -h ${tidb-nlb-dnsname} -P 4000 -u root ``` @@ -193,7 +193,7 @@ gcloud compute instances create bastion \ 示例: - ```shell + ```bash $ mysql --comments -h 10.128.15.243 -P 4000 -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 7823 @@ -228,7 +228,7 @@ gcloud compute instances create bastion \ {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n tidb-cluster get svc basic-grafana ``` @@ -264,7 +264,7 @@ basic-grafana LoadBalancer 10.15.255.169 34.123.168.114 3000:30 {{< copyable "shell-regular" >}} -```shell +```bash gcloud container clusters resize tidb --node-pool tikv --num-nodes 2 ``` @@ -288,7 +288,7 @@ gcloud container clusters resize tidb --node-pool tikv --num-nodes 2 {{< copyable "shell-regular" >}} -```shell +```bash gcloud container node-pools create tiflash --cluster tidb --machine-type n1-highmem-8 --num-nodes=1 \ --node-labels dedicated=tiflash --node-taints dedicated=tiflash:NoSchedule ``` @@ -297,7 +297,7 @@ gcloud container node-pools create tiflash --cluster tidb --machine-type n1-high {{< copyable "shell-regular" >}} -```shell +```bash gcloud container node-pools create ticdc --cluster tidb --machine-type n1-standard-4 --num-nodes=1 \ --node-labels dedicated=ticdc --node-taints dedicated=ticdc:NoSchedule ``` @@ -385,7 +385,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash gcloud container node-pools create tikv --cluster tidb --machine-type n1-standard-4 --num-nodes=1 --local-ssd-count 1 \ --node-labels dedicated=tikv --node-taints dedicated=tikv:NoSchedule ``` @@ -398,7 +398,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/gke/local-ssd-provision/local-ssd-provision.yaml ``` diff --git a/zh/deploy-on-general-kubernetes.md b/zh/deploy-on-general-kubernetes.md index bbbf19d112f..917c6786eb4 100644 --- a/zh/deploy-on-general-kubernetes.md +++ b/zh/deploy-on-general-kubernetes.md @@ -22,7 +22,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-general-kubernetes/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create namespace ${namespace} ``` @@ -46,7 +46,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-general-kubernetes/'] 部署一套 TiDB 集群会用到下面这些 Docker 镜像(假设 TiDB 集群的版本是 v5.2.1): - ```shell + ```bash pingcap/pd:v5.2.1 pingcap/tikv:v5.2.1 pingcap/tidb:v5.2.1 @@ -64,7 +64,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-general-kubernetes/'] {{< copyable "shell-regular" >}} - ```shell + ```bash docker pull pingcap/pd:v5.2.1 docker pull pingcap/tikv:v5.2.1 docker pull pingcap/tidb:v5.2.1 @@ -94,7 +94,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-on-general-kubernetes/'] {{< copyable "shell-regular" >}} - ```shell + ```bash docker load -i pd-v5.2.1.tar docker load -i tikv-v5.2.1.tar docker load -i tidb-v5.2.1.tar diff --git a/zh/deploy-ticdc.md b/zh/deploy-ticdc.md index f6568167648..5c2f85e1b8f 100644 --- a/zh/deploy-ticdc.md +++ b/zh/deploy-ticdc.md @@ -49,7 +49,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-ticdc/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- sh ``` @@ -57,11 +57,11 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-ticdc/'] {{< copyable "shell-regular" >}} - ```shell + ```bash /cdc cli capture list --pd=http://${cluster_name}-pd:2379 ``` - ```shell + ```bash [ { "id": "3ed24f6c-22cf-446f-9fe0-bf4a66d00f5b", @@ -87,7 +87,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/deploy-ticdc/'] {{< copyable "shell-regular" >}} - ```shell + ```bash /cdc cli capture list --pd=https://${cluster_name}-pd:2379 --ca=/var/lib/cluster-client-tls/ca.crt --cert=/var/lib/cluster-client-tls/tls.crt --key=/var/lib/cluster-client-tls/tls.key ``` diff --git a/zh/deploy-tidb-binlog.md b/zh/deploy-tidb-binlog.md index b4d7f38fbf3..e706d5f6b53 100644 --- a/zh/deploy-tidb-binlog.md +++ b/zh/deploy-tidb-binlog.md @@ -170,13 +170,13 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash helm repo update ``` {{< copyable "shell-regular" >}} - ```shell + ```bash helm search repo tidb-drainer -l ``` @@ -184,7 +184,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash helm inspect values pingcap/tidb-drainer --version=${chart_version} > values.yaml ``` @@ -234,7 +234,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} pingcap/tidb-drainer --namespace=${namespace} --version=${chart_version} -f values.yaml ``` @@ -343,7 +343,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run offline-pump-${ordinal_id} --image=pingcap/tidb-binlog:${tidb_version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${cluster_name}-pd:2379 -cmd offline-pump -node-id ${cluster_name}-pump-${ordinal_id}:8250 ``` @@ -351,7 +351,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec binlogctl -n ${namespace} -- /binlogctl -pd-urls "https://${cluster_name}-pd:2379" -cmd offline-pump -node-id ${cluster_name}-pump-${ordinal_id}:8250 -ssl-ca "/etc/binlog-tls/ca.crt" -ssl-cert "/etc/binlog-tls/tls.crt" -ssl-key "/etc/binlog-tls/tls.key" ``` @@ -359,7 +359,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs -f -n ${namespace} ${release_name}-pump-${ordinal_id} ``` @@ -375,7 +375,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run update-pump-${ordinal_id} --image=pingcap/tidb-binlog:${tidb_version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${cluster_name}-pd:2379 -cmd update-pump -node-id ${cluster_name}-pump-${ordinal_id}:8250 --state offline ``` @@ -383,7 +383,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec binlogctl -n ${namespace} -- /binlogctl -pd-urls=https://${cluster_name}-pd:2379 -cmd update-pump -node-id ${cluster_name}-pump-${ordinal_id}:8250 --state offline -ssl-ca "/etc/binlog-tls/ca.crt" -ssl-cert "/etc/binlog-tls/tls.crt" -ssl-key "/etc/binlog-tls/tls.key" ``` @@ -409,7 +409,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run offline-drainer-0 --image=pingcap/tidb-binlog:${tidb_version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${cluster_name}-pd:2379 -cmd offline-drainer -node-id ${drainer_node_id}:8249 ``` @@ -417,7 +417,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec binlogctl -n ${namespace} -- /binlogctl -pd-urls "https://${cluster_name}-pd:2379" -cmd offline-drainer -node-id ${drainer_node_id}:8249 -ssl-ca "/etc/binlog-tls/ca.crt" -ssl-cert "/etc/binlog-tls/tls.crt" -ssl-key "/etc/binlog-tls/tls.key" ``` @@ -425,7 +425,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs -f -n ${namespace} ${drainer_node_id} ``` @@ -443,7 +443,7 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl run update-drainer-${ordinal_id} --image=pingcap/tidb-binlog:${tidb_version} --namespace=${namespace} --restart=OnFailure -- /binlogctl -pd-urls=http://${cluster_name}-pd:2379 -cmd update-drainer -node-id ${drainer_node_id}:8249 --state offline ``` @@ -451,6 +451,6 @@ spec: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec binlogctl -n ${namespace} -- /binlogctl -pd-urls=https://${cluster_name}-pd:2379 -cmd update-drainer -node-id ${drainer_node_id}:8249 --state offline -ssl-ca "/etc/binlog-tls/ca.crt" -ssl-cert "/etc/binlog-tls/tls.crt" -ssl-key "/etc/binlog-tls/tls.key" ``` diff --git a/zh/deploy-tidb-dm.md b/zh/deploy-tidb-dm.md index 79bcd29f716..975a8f96c6a 100644 --- a/zh/deploy-tidb-dm.md +++ b/zh/deploy-tidb-dm.md @@ -141,7 +141,7 @@ kubectl apply -f ${dm_cluster_name}.yaml -n ${namespace} 1. 部署一套 DM 集群会用到下面这些 Docker 镜像(假设 DM 集群的版本是 v2.0.7): - ```shell + ```bash pingcap/dm:v2.0.7 ``` @@ -149,7 +149,7 @@ kubectl apply -f ${dm_cluster_name}.yaml -n ${namespace} {{< copyable "shell-regular" >}} - ```shell + ```bash docker pull pingcap/dm:v2.0.7 docker save -o dm-v2.0.7.tar pingcap/dm:v2.0.7 @@ -159,7 +159,7 @@ kubectl apply -f ${dm_cluster_name}.yaml -n ${namespace} {{< copyable "shell-regular" >}} - ```shell + ```bash docker load -i dm-v2.0.7.tar ``` diff --git a/zh/deploy-tidb-from-kubernetes-gke.md b/zh/deploy-tidb-from-kubernetes-gke.md index e0747f90160..f033d68c3c3 100644 --- a/zh/deploy-tidb-from-kubernetes-gke.md +++ b/zh/deploy-tidb-from-kubernetes-gke.md @@ -79,13 +79,13 @@ kubectl get nodes 1. 安装 Helm 服务端 - ```shell + ```bash curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash ``` 2. 通过下面的命令添加仓库: - ```shell + ```bash helm repo add pingcap https://charts.pingcap.org/ ``` @@ -93,7 +93,7 @@ kubectl get nodes TiDB Operator 使用 [Custom Resource Definition (CRD)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions) 扩展 Kubernetes,所以要使用 TiDB Operator,必须先创建 `TidbCluster` 等各种自定义资源类型: -```shell +```bash kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml && \ kubectl get crd tidbclusters.pingcap.com ``` @@ -104,7 +104,7 @@ kubectl get crd tidbclusters.pingcap.com 创建 `TidbCluster` 自定义资源类型后,接下来在 Kubernetes 集群上安装 TiDB Operator。 -```shell +```bash kubectl create namespace tidb-admin helm install --namespace tidb-admin tidb-operator pingcap/tidb-operator --version v1.2.4 kubectl get po -n tidb-admin -l app.kubernetes.io/name=tidb-operator @@ -116,7 +116,7 @@ kubectl get po -n tidb-admin -l app.kubernetes.io/name=tidb-operator 1. 创建 `Namespace`: - ```shell + ```bash kubectl create namespace demo ``` @@ -213,13 +213,13 @@ kubectl -n demo port-forward svc/basic-grafana 8080:3000 &>/tmp/pf8080.log & 要删除 TiDB 集群,执行以下命令: -```shell +```bash kubectl delete tc basic -n demo ``` 要删除监控组件,执行以下命令: -```shell +```bash kubectl delete tidbmonitor basic -n demo ``` diff --git a/zh/deploy-tidb-operator.md b/zh/deploy-tidb-operator.md index c2eceff45b2..8167dac6190 100644 --- a/zh/deploy-tidb-operator.md +++ b/zh/deploy-tidb-operator.md @@ -44,7 +44,7 @@ TiDB Operator 使用 [Custom Resource Definition (CRD)](https://kubernetes.io/do {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml ``` @@ -52,7 +52,7 @@ kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/master {{< copyable "shell-regular" >}} -```shell +```bash wget https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml kubectl create -f ./crd.yaml ``` @@ -65,11 +65,11 @@ kubectl create -f ./crd.yaml {{< copyable "shell-regular" >}} -```shell +```bash kubectl get crd ``` -```shell +```bash NAME CREATED AT backups.pingcap.com 2020-06-11T07:59:40Z backupschedules.pingcap.com 2020-06-11T07:59:41Z @@ -94,7 +94,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z {{< copyable "shell-regular" >}} - ```shell + ```bash mkdir -p ${HOME}/tidb-operator && \ helm inspect values pingcap/tidb-operator --version=${chart_version} > ${HOME}/tidb-operator/values-tidb-operator.yaml ``` @@ -119,7 +119,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z {{< copyable "shell-regular" >}} - ```shell + ```bash helm install tidb-operator pingcap/tidb-operator --namespace=tidb-admin --version=${chart_version} -f ${HOME}/tidb-operator/values-tidb-operator.yaml && \ kubectl get po -n tidb-admin -l app.kubernetes.io/name=tidb-operator ``` @@ -134,7 +134,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade tidb-operator pingcap/tidb-operator --namespace=tidb-admin -f ${HOME}/tidb-operator/values-tidb-operator.yaml ``` @@ -150,7 +150,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z {{< copyable "shell-regular" >}} - ```shell + ```bash wget http://charts.pingcap.org/tidb-operator-v1.2.4.tgz ``` @@ -158,7 +158,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z {{< copyable "shell-regular" >}} - ```shell + ```bash tar zxvf tidb-operator.v1.2.4.tgz ``` @@ -168,7 +168,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z TiDB Operator 用到的 Docker 镜像有: - ```shell + ```bash pingcap/tidb-operator:v1.2.4 pingcap/tidb-backup-manager:v1.2.4 bitnami/kubectl:latest @@ -182,7 +182,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z {{< copyable "shell-regular" >}} - ```shell + ```bash docker pull pingcap/tidb-operator:v1.2.4 docker pull pingcap/tidb-backup-manager:v1.2.4 docker pull bitnami/kubectl:latest @@ -198,7 +198,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z {{< copyable "shell-regular" >}} - ```shell + ```bash docker load -i tidb-operator-v1.2.4.tar docker load -i tidb-backup-manager-v1.2.4.tar docker load -i bitnami-kubectl.tar @@ -209,7 +209,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z 如果需要部署 `tidb-scheduler`,请修改 `./tidb-operator/values.yaml` 文件来配置内置 `kube-scheduler` 组件的 Docker 镜像名字和版本,例如你的 Kubernetes 集群中的 `kube-scheduler` 使用的镜像为 `k8s.gcr.io/kube-scheduler:v1.16.9`,请这样设置 `./tidb-operator/values.yaml`: - ```shell + ```bash ... scheduler: serviceAccount: tidb-scheduler @@ -236,7 +236,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z {{< copyable "shell-regular" >}} - ```shell + ```bash helm install tidb-operator ./tidb-operator --namespace=tidb-admin ``` @@ -250,7 +250,7 @@ tidbmonitors.pingcap.com 2020-06-11T07:59:41Z {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade tidb-operator ./tidb-operator --namespace=tidb-admin ``` @@ -269,6 +269,6 @@ TiDB Operator 包含两个组件: {{< copyable "shell-regular" >}} -```shell +```bash helm upgrade tidb-operator pingcap/tidb-operator --version=${chart_version} --namespace=tidb-admin -f ${HOME}/tidb-operator/values-tidb-operator.yaml ``` diff --git a/zh/deploy-tiflash.md b/zh/deploy-tiflash.md index 40fefb5e645..b15b0832e66 100644 --- a/zh/deploy-tiflash.md +++ b/zh/deploy-tiflash.md @@ -114,7 +114,7 @@ TiDB Operator 通过创建 [StatefulSet](https://kubernetes.io/docs/concepts/wor {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tidbcluster ${cluster_name} -n ${namespace} ``` @@ -124,7 +124,7 @@ TiDB Operator 通过创建 [StatefulSet](https://kubernetes.io/docs/concepts/wor {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod -n ${namespace} -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` @@ -132,7 +132,7 @@ TiDB Operator 通过创建 [StatefulSet](https://kubernetes.io/docs/concepts/wor 使用以下命令检查 TiFlash 节点 store 状态是否为 Tombstone: - ```shell + ```bash kubectl get tidbcluster ${cluster_name} -n ${namespace} -o yaml ``` @@ -168,7 +168,7 @@ TiDB Operator 通过创建 [StatefulSet](https://kubernetes.io/docs/concepts/wor {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tidbcluster ${cluster_name} -n ${namespace} ``` @@ -176,7 +176,7 @@ TiDB Operator 通过创建 [StatefulSet](https://kubernetes.io/docs/concepts/wor {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete statefulsets -n ${namespace} -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` @@ -184,7 +184,7 @@ TiDB Operator 通过创建 [StatefulSet](https://kubernetes.io/docs/concepts/wor {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get sts -n ${namespace} -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` @@ -198,7 +198,7 @@ TiDB Operator 通过创建 [StatefulSet](https://kubernetes.io/docs/concepts/wor {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete pvc -n ${namespace} -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` @@ -206,7 +206,7 @@ TiDB Operator 通过创建 [StatefulSet](https://kubernetes.io/docs/concepts/wor {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch pv ${pv_name} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` @@ -214,7 +214,7 @@ TiDB Operator 通过创建 [StatefulSet](https://kubernetes.io/docs/concepts/wor {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pv -l app.kubernetes.io/component=tiflash,app.kubernetes.io/instance=${cluster_name} ``` diff --git a/zh/destroy-a-tidb-cluster.md b/zh/destroy-a-tidb-cluster.md index 55ab1212754..245e2bc69ad 100644 --- a/zh/destroy-a-tidb-cluster.md +++ b/zh/destroy-a-tidb-cluster.md @@ -14,7 +14,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/destroy-a-tidb-cluster/'] {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete tc ${cluster_name} -n ${namespace} ``` @@ -22,7 +22,7 @@ kubectl delete tc ${cluster_name} -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete tidbmonitor ${tidb_monitor_name} -n ${namespace} ``` @@ -32,7 +32,7 @@ kubectl delete tidbmonitor ${tidb_monitor_name} -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash helm uninstall ${cluster_name} -n ${namespace} ``` @@ -48,12 +48,12 @@ helm uninstall ${cluster_name} -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete pvc -n ${namespace} -l app.kubernetes.io/instance=${cluster_name},app.kubernetes.io/managed-by=tidb-operator ``` {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pv -l app.kubernetes.io/namespace=${namespace},app.kubernetes.io/managed-by=tidb-operator,app.kubernetes.io/instance=${cluster_name} -o name | xargs -I {} kubectl patch {} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` diff --git a/zh/enable-admission-webhook.md b/zh/enable-admission-webhook.md index 3054e4f1d1b..609b69794d2 100644 --- a/zh/enable-admission-webhook.md +++ b/zh/enable-admission-webhook.md @@ -31,7 +31,7 @@ TiDB Operator 在默认安装情况下不会开启准入控制器,你需要手 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get configmap -n kube-system extension-apiserver-authentication -o=jsonpath='{.data.client-ca-file}' | base64 | tr -d '\n' ``` @@ -107,7 +107,7 @@ TiDB Operator 在默认安装情况下不会开启准入控制器,你需要手 {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > webhook-server.json ``` @@ -144,7 +144,7 @@ TiDB Operator 在默认安装情况下不会开启准入控制器,你需要手 {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server webhook-server.json | cfssljson -bare webhook-server ``` @@ -161,7 +161,7 @@ TiDB Operator 在默认安装情况下不会开启准入控制器,你需要手 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=~/cfssl/webhook-server.pem --from-file=tls.key=~/cfssl/webhook-server-key.pem --from-file=ca.crt=~/cfssl/ca.pem ``` @@ -171,7 +171,7 @@ TiDB Operator 在默认安装情况下不会开启准入控制器,你需要手 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get secret ${secret_name} --namespace=${namespace} -o=jsonpath='{.data.ca\.crt}' ``` @@ -215,7 +215,7 @@ TiDB Operator 通过准入控制器的帮助实现了许多功能。我们将在 {{< copyable "shell-regular" >}} - ```shell + ```bash $ kubectl annotate tidbcluster ${name} -n ${namespace} tidb.pingcap.com/tikv-partition=2 tidbcluster.pingcap.com/${name} annotated ``` @@ -224,7 +224,7 @@ TiDB Operator 通过准入控制器的帮助实现了许多功能。我们将在 {{< copyable "shell-regular" >}} - ```shell + ```bash $ kubectl annotate tidbcluster ${name} -n ${namespace} tidb.pingcap.com/tikv-partition- tidbcluster.pingcap.com/${name} annotated ``` diff --git a/zh/enable-tidb-cluster-auto-scaling.md b/zh/enable-tidb-cluster-auto-scaling.md index 51bfe8d9547..dffc1fff3eb 100644 --- a/zh/enable-tidb-cluster-auto-scaling.md +++ b/zh/enable-tidb-cluster-auto-scaling.md @@ -127,19 +127,19 @@ TiDB Operator 会根据 TidbClusterAutoScaler CR 的配置,向 PD 发起请求 {{< copyable "shell-regular" >}} - ```shell + ```bash $ kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/auto-scale/tidb-cluster.yaml -n ${namespace} ``` {{< copyable "shell-regular" >}} - ```shell + ```bash $ kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/auto-scale/tidb-monitor.yaml -n ${namespace} ``` {{< copyable "shell-regular" >}} - ```shell + ```bash $ kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/auto-scale/tidb-cluster-auto-scaler.yaml -n ${namespace} ``` @@ -163,7 +163,7 @@ TiDB Operator 会根据 TidbClusterAutoScaler CR 的配置,向 PD 发起请求 {{< copyable "shell-regular" >}} - ```shell + ```bash sysbench --config-file=${path}/sysbench.config oltp_point_select --tables=1 --table-size=20000 prepare ``` @@ -171,7 +171,7 @@ TiDB Operator 会根据 TidbClusterAutoScaler CR 的配置,向 PD 发起请求 {{< copyable "shell-regular" >}} - ```shell + ```bash sysbench --config-file=${path}/sysbench.config oltp_point_select --tables=1 --table-size=20000 run ``` @@ -190,7 +190,7 @@ TiDB Operator 会根据 TidbClusterAutoScaler CR 的配置,向 PD 发起请求 {{< copyable "shell-regular" >}} - ```shell + ```bash watch -n1 "kubectl -n ${namespace} get pod" ``` @@ -211,7 +211,7 @@ TiDB Operator 会根据 TidbClusterAutoScaler CR 的配置,向 PD 发起请求 5. 使用如下命令销毁环境: - ```shell + ```bash kubectl delete tidbcluster auto-scaling-demo -n ${namespace} kubectl delete tidbmonitor auto-scaling-demo -n ${namespace} kubectl delete tidbclusterautoscaler auto-scaling-demo -n ${namespace} diff --git a/zh/enable-tls-between-components.md b/zh/enable-tls-between-components.md index f5a2eb871ae..af359e3ca50 100644 --- a/zh/enable-tls-between-components.md +++ b/zh/enable-tls-between-components.md @@ -52,7 +52,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/enable-tls-between-components/'] 2. 生成 `ca-config.json` 配置文件: - ```shell + ```bash cat << EOF > ca-config.json { "signing": { @@ -85,7 +85,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/enable-tls-between-components/'] 3. 生成 `ca-csr.json` 配置文件: - ```shell + ```bash cat << EOF > ca-csr.json { "CN": "TiDB", @@ -402,7 +402,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/enable-tls-between-components/'] {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > tiflash-server.json ``` @@ -445,7 +445,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/enable-tls-between-components/'] {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > importer-server.json ``` @@ -485,7 +485,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/enable-tls-between-components/'] {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl print-defaults csr > lightning-server.json ``` diff --git a/zh/enable-tls-for-dm.md b/zh/enable-tls-for-dm.md index 58d437a2fc5..a053fbc36a2 100644 --- a/zh/enable-tls-for-dm.md +++ b/zh/enable-tls-for-dm.md @@ -50,7 +50,7 @@ TiDB Operator 从 v1.2 开始已经支持为 Kubernetes 上 DM 集群组件间 2. 生成 `ca-config.json` 配置文件: - ```shell + ```bash cat << EOF > ca-config.json { "signing": { @@ -83,7 +83,7 @@ TiDB Operator 从 v1.2 开始已经支持为 Kubernetes 上 DM 集群组件间 3. 生成 `ca-csr.json` 配置文件: - ```shell + ```bash cat << EOF > ca-csr.json { "CN": "TiDB", @@ -535,7 +535,7 @@ cd /var/lib/dm-master-tls {{< copyable "shell-regular" >}} -```shell +```bash kubectl create secret generic ${mysql_secret_name1} --namespace=${namespace} --from-file=tls.crt=client.pem --from-file=tls.key=client-key.pem --from-file=ca.crt=ca.pem kubectl create secret generic ${tidb_secret_name} --namespace=${namespace} --from-file=tls.crt=client.pem --from-file=tls.key=client-key.pem --from-file=ca.crt=ca.pem ``` diff --git a/zh/enable-tls-for-ticdc-sink.md b/zh/enable-tls-for-ticdc-sink.md index 5646a3e48a9..eb4af1e7fb3 100644 --- a/zh/enable-tls-for-ticdc-sink.md +++ b/zh/enable-tls-for-ticdc-sink.md @@ -20,7 +20,7 @@ summary: 了解如何让 TiCDC 组件同步数据到开启 TLS 的下游服务 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${secret_name} --namespace=${cluster_namespace} --from-file=tls.crt=client.pem --from-file=tls.key=client-key.pem --from-file=ca.crt=ca.pem ``` @@ -52,6 +52,6 @@ summary: 了解如何让 TiCDC 组件同步数据到开启 TLS 的下游服务 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec ${cluster_name}-ticdc-0 -- /cdc cli changefeed create --pd=https://${cluster_name}-pd:2379 --sink-uri="mysql://${user}:{$password}@${downstream_service}/?ssl-ca=/var/lib/sink-tls/${secret_name}/ca.crt&ssl-cert=/var/lib/sink-tls/${secret_name}/tls.crt&ssl-key=/var/lib/sink-tls/${secret_name}/tls.key" ``` diff --git a/zh/exceptions.md b/zh/exceptions.md index 33b20525127..1ccea5096cd 100644 --- a/zh/exceptions.md +++ b/zh/exceptions.md @@ -16,7 +16,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/exceptions/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get -n ${namespace} tidbcluster ${cluster_name} -ojson | jq '.status.tikv.stores' ``` @@ -24,7 +24,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/exceptions/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get -n ${namespace} po -l app.kubernetes.io/component=tikv ``` @@ -34,7 +34,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/exceptions/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd ${local_port}:2379 &>/tmp/portforward-pd.log & ``` @@ -42,7 +42,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/exceptions/'] {{< copyable "shell-regular" >}} - ```shell + ```bash curl -X POST http://127.0.0.1:2379/pd/api/v1/store/${store_id}/state?state=Up ``` @@ -52,7 +52,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/exceptions/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl patch $(kubectl get pv -l app.kubernetes.io/instance=${cluster_name},tidb.pingcap.com/store-id=${store_id} -o name) -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}} ``` @@ -60,7 +60,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/exceptions/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pvc tikv-${pod_name} --wait=false ``` @@ -68,7 +68,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/exceptions/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pod ${pod_name} ``` diff --git a/zh/faq.md b/zh/faq.md index 3d51fb36215..6bab8adffd7 100644 --- a/zh/faq.md +++ b/zh/faq.md @@ -16,7 +16,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/faq/'] 配置 TidbCluster CR 的 `.spec.timezone` 属性,例如: -```shell +```bash ... spec: timezone: Asia/Shanghai @@ -33,7 +33,7 @@ spec: 配置 TidbCluster CR 的 `.spec.timezone` 属性,例如: - ```shell + ```bash ... spec: timezone: Asia/Shanghai @@ -83,7 +83,7 @@ TiDB Operator 尚不支持自动编排 TiSpark。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- cat /etc/pd/pd.toml ``` @@ -91,7 +91,7 @@ TiDB Operator 尚不支持自动编排 TiSpark。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- cat /etc/tikv/tikv.toml ``` @@ -99,7 +99,7 @@ TiDB Operator 尚不支持自动编排 TiSpark。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -c tidb -n ${namespace} -- cat /etc/tidb/tidb.toml ``` @@ -117,7 +117,7 @@ TiDB Operator 调度 Pod 失败的原因可能有三种情况: {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get deployment --all-namespaces | grep tidb-scheduler ``` diff --git a/zh/get-started.md b/zh/get-started.md index 6acb0e79c11..4f034c8d7a1 100644 --- a/zh/get-started.md +++ b/zh/get-started.md @@ -67,7 +67,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/get-started/','/docs-cn/dev/tidb-in-k {{< copyable "shell-regular" >}} -```shell +```bash kind create cluster ``` @@ -93,7 +93,7 @@ Thanks for using kind! 😊 {{< copyable "shell-regular" >}} -```shell +```bash kubectl cluster-info ``` @@ -140,7 +140,7 @@ kind delete cluster {{< copyable "shell-regular" >}} -```shell +```bash minikube start ``` @@ -246,7 +246,7 @@ TiDB Operator 包含许多实现 TiDB 集群不同组件的自定义资源类型 {{< copyable "shell-regular" >}} -```shell +```bash kubectl create -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml ``` @@ -274,7 +274,7 @@ TiDB Operator 使用 Helm 3 安装。 {{< copyable "shell-regular" >}} - ```shell + ```bash helm repo add pingcap https://charts.pingcap.org/ ``` @@ -288,7 +288,7 @@ TiDB Operator 使用 Helm 3 安装。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create namespace tidb-admin ``` @@ -302,7 +302,7 @@ TiDB Operator 使用 Helm 3 安装。 {{< copyable "shell-regular" >}} - ```shell + ```bash helm install --namespace tidb-admin tidb-operator pingcap/tidb-operator --version v1.2.4 ``` @@ -336,7 +336,7 @@ TiDB Operator 使用 Helm 3 安装。 {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pods --namespace tidb-admin -l app.kubernetes.io/instance=tidb-operator ``` @@ -643,7 +643,7 @@ TiDB Operator 还可简化 TiDB 集群的滚动升级。以下展示使用 kubec {{< copyable "shell-regular" >}} -```shell +```bash kubectl patch tc basic -n tidb-cluster --type merge -p '{"spec": {"version": "release-4.0-nightly"} }' ``` @@ -722,7 +722,7 @@ Check Table Before Drop: false {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete tc basic -n tidb-cluster ``` @@ -732,7 +732,7 @@ kubectl delete tc basic -n tidb-cluster {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete tidbmonitor basic -n tidb-cluster ``` @@ -742,7 +742,7 @@ kubectl delete tidbmonitor basic -n tidb-cluster {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete pvc -n tidb-cluster -l app.kubernetes.io/instance=basic,app.kubernetes.io/managed-by=tidb-operator && \ kubectl get pv -l app.kubernetes.io/namespace=tidb-cluster,app.kubernetes.io/managed-by=tidb-operator,app.kubernetes.io/instance=basic -o name | xargs -I {} kubectl patch {} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}' ``` @@ -753,7 +753,7 @@ kubectl get pv -l app.kubernetes.io/namespace=tidb-cluster,app.kubernetes.io/man {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete namespace tidb-cluster ``` @@ -763,7 +763,7 @@ kubectl delete namespace tidb-cluster {{< copyable "shell-regular" >}} -```shell +```bash pgrep -lfa kubectl ``` diff --git a/zh/grant-permissions-to-remote-storage.md b/zh/grant-permissions-to-remote-storage.md index 83b7c3e537f..8bbd17711da 100644 --- a/zh/grant-permissions-to-remote-storage.md +++ b/zh/grant-permissions-to-remote-storage.md @@ -19,7 +19,7 @@ AWS 的客户端支持读取进程环境变量中的 `AWS_ACCESS_KEY_ID` 以及 {{< copyable "shell-regular" >}} -```shell +```bash kubectl create secret generic s3-secret --from-literal=access_key=xxx --from-literal=secret_key=yyy --namespace=test1 ``` @@ -42,7 +42,7 @@ kubectl create secret generic s3-secret --from-literal=access_key=xxx --from-lit {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc demo1 -n test1 ``` @@ -70,7 +70,7 @@ kubectl create secret generic s3-secret --from-literal=access_key=xxx --from-lit {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate sa tidb-backup-manager -n eks.amazonaws.com/role-arn=arn:aws:iam::123456789012:role/user --namespace=test1 ``` @@ -78,7 +78,7 @@ kubectl create secret generic s3-secret --from-literal=access_key=xxx --from-lit {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc demo1 -n test1 ``` @@ -96,6 +96,6 @@ kubectl create secret generic s3-secret --from-literal=access_key=xxx --from-lit {{< copyable "shell-regular" >}} -```shell +```bash kubectl create secret generic gcs-secret --from-file=credentials=./google-credentials.json -n test1 ``` diff --git a/zh/initialize-a-cluster.md b/zh/initialize-a-cluster.md index c191f44fddc..6aecc4d9ffa 100644 --- a/zh/initialize-a-cluster.md +++ b/zh/initialize-a-cluster.md @@ -40,7 +40,7 @@ spec: {{< copyable "shell-regular" >}} -```shell +```bash kubectl create secret generic tidb-secret --from-literal=root=${root_password} --namespace=${namespace} ``` @@ -48,7 +48,7 @@ kubectl create secret generic tidb-secret --from-literal=root=${root_password} - {{< copyable "shell-regular" >}} -```shell +```bash kubectl create secret generic tidb-secret --from-literal=root=${root_password} --from-literal=developer=${developer_password} --namespace=${namespace} ``` @@ -82,7 +82,7 @@ initSql: |- {{< copyable "shell-regular" >}} -```shell +```bash kubectl apply -f ${cluster_name}/tidb-initializer.yaml --namespace=${namespace} ``` @@ -92,7 +92,7 @@ kubectl apply -f ${cluster_name}/tidb-initializer.yaml --namespace=${namespace} 初始化一套 TiDB 集群会用到下面这些 Docker 镜像: -```shell +```bash tnir/mysqlclient:latest ``` @@ -100,7 +100,7 @@ tnir/mysqlclient:latest {{< copyable "shell-regular" >}} -```shell +```bash docker pull tnir/mysqlclient:latest docker save -o mysqlclient-latest.tar tnir/mysqlclient:latest ``` @@ -109,6 +109,6 @@ docker save -o mysqlclient-latest.tar tnir/mysqlclient:latest {{< copyable "shell-regular" >}} -```shell +```bash docker load -i mysqlclient-latest.tar ``` diff --git a/zh/maintain-a-kubernetes-node.md b/zh/maintain-a-kubernetes-node.md index c84f793a0d5..9048ad1bdd4 100644 --- a/zh/maintain-a-kubernetes-node.md +++ b/zh/maintain-a-kubernetes-node.md @@ -25,7 +25,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl cordon ${node_name} ``` @@ -33,7 +33,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} | grep tikv ``` @@ -47,7 +47,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl config set max-store-down-time 60m ``` @@ -57,7 +57,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} | grep pd ``` @@ -67,7 +67,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} ``` @@ -75,7 +75,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl drain ${node_name} --ignore-daemonsets ``` @@ -85,7 +85,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} ``` @@ -93,7 +93,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl get node ${node_name} ``` @@ -103,7 +103,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl uncordon ${node_name} ``` @@ -111,7 +111,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} ``` @@ -123,7 +123,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} | grep tikv ``` @@ -133,7 +133,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} | grep pd ``` @@ -143,7 +143,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} ``` @@ -151,7 +151,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl drain ${node_name} --ignore-daemonsets ``` @@ -161,7 +161,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} ``` @@ -169,7 +169,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete node ${node_name} ``` @@ -185,7 +185,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl cordon ${node_name} ``` @@ -193,7 +193,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} | grep pd ``` @@ -203,7 +203,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pod ${pod_name} ``` @@ -211,7 +211,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -223,7 +223,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl cordon ${node_name} ``` @@ -231,7 +231,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} | grep pd ``` @@ -241,7 +241,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl member delete name ${pod_name} ``` @@ -249,7 +249,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl member ``` @@ -259,7 +259,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pvc -l tidb.pingcap.com/pod-name=${pod_name} ``` @@ -267,7 +267,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pvc ${pvc_name} --wait=false ``` @@ -275,7 +275,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pod ${pod_name} ``` @@ -283,7 +283,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -299,7 +299,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl cordon ${node_name} ``` @@ -307,7 +307,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} | grep tikv ``` @@ -317,7 +317,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pod ${pod_name} ``` @@ -325,7 +325,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -333,7 +333,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl scheduler remove evict-leader-scheduler-${ID} ``` @@ -345,7 +345,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl cordon ${node_name} ``` @@ -353,7 +353,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod --all-namespaces -o wide | grep ${node_name} | grep tikv ``` @@ -369,7 +369,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get tc ${cluster_name} -ojson | jq ".status.tikv.stores | .[] | select ( .podName == \"${pod_name}\" ) | .id" ``` @@ -377,7 +377,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl store delete ${ID} ``` @@ -385,7 +385,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash watch pd-ctl store ${ID} ``` @@ -395,7 +395,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get pvc -l tidb.pingcap.com/pod-name=${pod_name} ``` @@ -403,7 +403,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pvc ${pvc_name} --wait=false ``` @@ -411,7 +411,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete -n ${namespace} pod ${pod_name} ``` @@ -419,7 +419,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -427,7 +427,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl scheduler remove evict-leader-scheduler-${ID} ``` @@ -437,7 +437,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl member leader show ``` @@ -445,7 +445,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl member leader transfer ${pod_name} ``` @@ -457,7 +457,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get tc ${cluster_name} -ojson | jq ".status.tikv.stores | .[] | select ( .podName == \"${pod_name}\" ) | .id" ``` @@ -465,7 +465,7 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl scheduler add evict-leader-scheduler ${ID} ``` @@ -473,6 +473,6 @@ TiDB 是高可用数据库,可以在部分数据库节点下线的情况下正 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get tc ${cluster_name} -ojson | jq ".status.tikv.stores | .[] | select ( .podName == \"${pod_name}\" ) | .leaderCount" ``` diff --git a/zh/migrate-tidb-to-kubernetes.md b/zh/migrate-tidb-to-kubernetes.md index cf6590fa7b0..d924d56e4af 100644 --- a/zh/migrate-tidb-to-kubernetes.md +++ b/zh/migrate-tidb-to-kubernetes.md @@ -19,7 +19,7 @@ summary: 介绍如何将部署在物理机或虚拟机中的 TiDB 迁移至 Kube {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl describe svc/kube-dns -n kube-system ``` @@ -27,7 +27,7 @@ summary: 介绍如何将部署在物理机或虚拟机中的 TiDB 迁移至 Kube {{< copyable "shell-regular" >}} - ```shell + ```bash search default.svc.cluster.local svc.cluster.local cluster.local nameserver nameserver @@ -36,7 +36,7 @@ summary: 介绍如何将部署在物理机或虚拟机中的 TiDB 迁移至 Kube 3. 测试解析 Kubernetes 集群内部域名是否成功: - ```shell + ```bash $ ping basic-pd-2.basic-pd-peer.blade.svc PING basic-pd-2.basic-pd-peer.blade.svc (10.24.66.178) 56(84) bytes of data. 64 bytes from basic-pd-2.basic-pd-peer.blade.svc (10.24.66.178): icmp_seq=1 ttl=61 time=0.213 ms @@ -51,7 +51,7 @@ summary: 介绍如何将部署在物理机或虚拟机中的 TiDB 迁移至 Kube {{< copyable "shell-regular" >}} - ```shell + ```bash pd-ctl -u http://
: member | jq '.members | .[] | .client_urls' ``` @@ -72,7 +72,7 @@ summary: 介绍如何将部署在物理机或虚拟机中的 TiDB 迁移至 Kube {{< copyable "shell-regular" >}} - ```shell + ```bash # store 个数 pd-ctl -u http://
: store | jq '.count' # store 状态 diff --git a/zh/migrate-to-helm3.md b/zh/migrate-to-helm3.md index 7b4faffbbb9..b4db3ccca1e 100644 --- a/zh/migrate-to-helm3.md +++ b/zh/migrate-to-helm3.md @@ -15,7 +15,7 @@ summary: 介绍如何将由 Helm 2 管理的组件迁移到由 Helm 3 管理。 {{< copyable "shell-regular" >}} -```shell +```bash helm list ``` @@ -36,7 +36,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 plugin install https://github.com/helm/helm-2to3 ``` @@ -44,7 +44,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 plugin list ``` @@ -57,7 +57,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 2to3 move config ``` @@ -67,7 +67,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 repo list ``` @@ -80,7 +80,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 2to3 convert tidb-operator ``` @@ -90,7 +90,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 list --namespace=tidb-admin ``` @@ -109,7 +109,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pods --namespace=tidb-admin -l app.kubernetes.io/instance=tidb-operator ``` @@ -144,7 +144,7 @@ tidb-operator 1 Tue Jan 5 15:28:00 2021 DEPLOYED {{< copyable "shell-regular" >}} - ```shell + ```bash helm3 2to3 cleanup --name=tidb-operator ``` diff --git a/zh/monitor-a-tidb-cluster.md b/zh/monitor-a-tidb-cluster.md index 2600181083e..f19986c09e2 100644 --- a/zh/monitor-a-tidb-cluster.md +++ b/zh/monitor-a-tidb-cluster.md @@ -58,7 +58,7 @@ spec: {{< copyable "shell-regular" >}} -```shell +```bash kubectl get pvc -l app.kubernetes.io/instance=basic,app.kubernetes.io/component=monitor -n ${namespace} ``` @@ -103,7 +103,7 @@ basic-monitor Bound pvc-6db79253-cc9e-4730-bbba-ba987c29db6f 5G R {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-grafana 3000:3000 &>/tmp/portforward-grafana.log & ``` @@ -119,7 +119,7 @@ kubectl port-forward -n ${namespace} svc/${cluster_name}-grafana 3000:3000 &>/tm {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-prometheus 9090:9090 &>/tmp/portforward-prometheus.log & ``` @@ -275,7 +275,7 @@ type: kubernetes.io/tls 在公有云 Kubernetes 集群中,通常可以[配置 Loadbalancer](https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/) 通过域名访问 Ingress。如果无法配置 Loadbalancer 服务,比如使用了 NodePort 作为 Ingress 的服务类型,可通过与如下命令等价的方式访问服务: -```shell +```bash curl -H "Host: example.com" ${node_ip}:${NodePort} ``` diff --git a/zh/network-issues.md b/zh/network-issues.md index 1029a929e3f..be3eea9ff3e 100644 --- a/zh/network-issues.md +++ b/zh/network-issues.md @@ -18,7 +18,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/network-issues/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl -n ${namespace} get endpoints ${cluster_name}-pd kubectl -n ${namespace} get endpoints ${cluster_name}-tidb kubectl -n ${namespace} get endpoints ${cluster_name}-pd-peer @@ -40,7 +40,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/network-issues/'] {{< copyable "shell-regular" >}} - ```shell + ```bash dig ${HOSTNAME} ``` @@ -48,7 +48,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/network-issues/'] {{< copyable "shell-regular" >}} - ```shell + ```bash ping ${TARGET_IP} ``` @@ -58,7 +58,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/network-issues/'] {{< copyable "shell-regular" >}} - ```shell + ```bash telnet ${TARGET_IP} ${TARGET_PORT} ``` @@ -66,7 +66,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/network-issues/'] {{< copyable "shell-regular" >}} - ```shell + ```bash # 检查端口是否一致 kubectl -n ${namespace} get po ${pod_name} -ojson | jq '.spec.containers[].ports[].containerPort' @@ -87,7 +87,7 @@ TiDB 服务访问不了时,首先确认 TiDB 服务是否部署成功,确认 {{< copyable "shell-regular" >}} -```shell +```bash kubectl get po -n ${namespace} ``` @@ -95,7 +95,7 @@ kubectl get po -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash kubectl get endpoints -n ${namespaces} ${cluster_name}-tidb ``` @@ -103,7 +103,7 @@ kubectl get endpoints -n ${namespaces} ${cluster_name}-tidb {{< copyable "shell-regular" >}} -```shell +```bash kubectl logs -f ${pod_name} -n ${namespace} -c tidb ``` @@ -120,7 +120,7 @@ kubectl logs -f ${pod_name} -n ${namespace} -c tidb {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get po -n kube-system -l k8s-app=kube-proxy ``` @@ -128,7 +128,7 @@ kubectl logs -f ${pod_name} -n ${namespace} -c tidb {{< copyable "shell-regular" >}} - ```shell + ```bash iptables-save -t nat |grep ${clusterIP} ``` @@ -136,7 +136,7 @@ kubectl logs -f ${pod_name} -n ${namespace} -c tidb {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get endpoints -n ${namespaces} ${cluster_name}-tidb ``` diff --git a/zh/pause-sync-of-tidb-cluster.md b/zh/pause-sync-of-tidb-cluster.md index 907ec3cd9f3..262ff5881f1 100644 --- a/zh/pause-sync-of-tidb-cluster.md +++ b/zh/pause-sync-of-tidb-cluster.md @@ -33,7 +33,7 @@ summary: 介绍如何暂停同步 Kubernetes 上的 TiDB 集群 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -61,7 +61,7 @@ summary: 介绍如何暂停同步 Kubernetes 上的 TiDB 集群 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs ${pod_name} -n ${namespace} | grep paused ``` @@ -86,7 +86,7 @@ summary: 介绍如何暂停同步 Kubernetes 上的 TiDB 集群 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -114,7 +114,7 @@ summary: 介绍如何暂停同步 Kubernetes 上的 TiDB 集群 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl logs ${pod_name} -n ${namespace} | grep "Finished syncing TidbCluster" ``` diff --git a/zh/pd-recover.md b/zh/pd-recover.md index eca5567be16..1143e0ca4a0 100644 --- a/zh/pd-recover.md +++ b/zh/pd-recover.md @@ -14,7 +14,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/pd-recover/'] {{< copyable "shell-regular" >}} - ```shell + ```bash wget https://download.pingcap.org/tidb-${version}-linux-amd64.tar.gz ``` @@ -24,7 +24,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/pd-recover/'] {{< copyable "shell-regular" >}} - ```shell + ```bash tar -xzf tidb-${version}-linux-amd64.tar.gz ``` @@ -38,7 +38,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/pd-recover/'] {{< copyable "shell-regular" >}} -```shell +```bash kubectl get tc ${cluster_name} -n ${namespace} -o='go-template={{.status.clusterID}}{{"\n"}}' ``` @@ -67,7 +67,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -75,7 +75,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit sts ${cluster_name}-pd -n ${namespace} ``` @@ -83,7 +83,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod -n ${namespace} ``` @@ -91,7 +91,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete pvc -l app.kubernetes.io/component=pd,app.kubernetes.io/instance=${cluster_name} -n ${namespace} ``` @@ -101,7 +101,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -109,7 +109,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit sts ${cluster_name}-pd -n ${namespace} ``` @@ -117,7 +117,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get pod -n ${namespace} ``` @@ -127,7 +127,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 ``` @@ -135,7 +135,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash ./pd-recover -endpoints http://127.0.0.1:2379 -cluster-id ${cluster_id} -alloc-id ${alloc_id} ``` @@ -143,7 +143,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' `pd-recover` 命令执行成功后,会打印如下输出: - ```shell + ```bash recover success! please restart the PD cluster ``` @@ -155,7 +155,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete pod ${cluster_name}-pd-0 -n ${namespace} ``` @@ -163,7 +163,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 ``` @@ -171,7 +171,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} - ```shell + ```bash curl 127.0.0.1:2379/pd/api/v1/cluster ``` @@ -183,7 +183,7 @@ kubectl get tc test -n test -o='go-template={{.status.clusterID}}{{"\n"}}' {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -191,7 +191,7 @@ kubectl edit tc ${cluster_name} -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash kubectl delete pod -l app.kubernetes.io/component=tidb,app.kubernetes.io/instance=${cluster_name} -n ${namespace} && kubectl delete pod -l app.kubernetes.io/component=tikv,app.kubernetes.io/instance=${cluster_name} -n ${namespace} ``` diff --git a/zh/prerequisites.md b/zh/prerequisites.md index a43bb77f485..8279665bad0 100644 --- a/zh/prerequisites.md +++ b/zh/prerequisites.md @@ -23,7 +23,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/prerequisites/'] {{< copyable "shell-regular" >}} -```shell +```bash systemctl stop firewalld systemctl disable firewalld ``` @@ -34,7 +34,7 @@ systemctl disable firewalld {{< copyable "shell-regular" >}} - ```shell + ```bash firewall-cmd --permanent --add-port=6443/tcp firewall-cmd --permanent --add-port=2379-2380/tcp firewall-cmd --permanent --add-port=10250/tcp @@ -54,7 +54,7 @@ systemctl disable firewalld {{< copyable "shell-regular" >}} - ```shell + ```bash firewall-cmd --permanent --add-port=10250/tcp firewall-cmd --permanent --add-port=10255/tcp firewall-cmd --permanent --add-port=8472/udp @@ -70,7 +70,7 @@ FORWARD 链默认配置成 ACCEPT,并将其设置到开机启动脚本里: {{< copyable "shell-regular" >}} -```shell +```bash iptables -P FORWARD ACCEPT ``` @@ -78,7 +78,7 @@ iptables -P FORWARD ACCEPT {{< copyable "shell-regular" >}} -```shell +```bash setenforce 0 sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config ``` @@ -89,7 +89,7 @@ Kubelet 正常工作需要关闭 Swap,并且把 `/etc/fstab` 里面有关 Swap {{< copyable "shell-regular" >}} -```shell +```bash swapoff -a sed -i 's/^\(.*swap.*\)$/#\1/' /etc/fstab ``` @@ -100,7 +100,7 @@ sed -i 's/^\(.*swap.*\)$/#\1/' /etc/fstab {{< copyable "shell-regular" >}} -```shell +```bash modprobe br_netfilter cat < /etc/sysctl.d/k8s.conf @@ -129,7 +129,7 @@ sysctl --system {{< copyable "shell-regular" >}} -```shell +```bash systemctl enable irqbalance systemctl start irqbalance ``` @@ -140,7 +140,7 @@ systemctl start irqbalance {{< copyable "shell-regular" >}} -```shell +```bash cpupower frequency-set --governor performance ``` @@ -150,7 +150,7 @@ TiDB 集群默认会使用很多文件描述符,需要将工作节点上面的 {{< copyable "shell-regular" >}} -```shell +```bash cat <> /etc/security/limits.conf root soft nofile 1048576 root hard nofile 1048576 @@ -170,7 +170,7 @@ sysctl --system {{< copyable "shell-regular" >}} - ```shell + ```bash cat > /etc/docker/daemon.json <}} - ```shell + ```bash mkdir -p /etc/systemd/system/docker.service.d ``` @@ -203,7 +203,7 @@ sysctl --system {{< copyable "shell-regular" >}} - ```shell + ```bash cat > /etc/systemd/system/docker.service.d/limit-nofile.conf <}} - ```shell + ```bash systemctl daemon-reload && systemctl restart docker ``` @@ -243,7 +243,7 @@ Kubernetes Master 节点的配置取决于 Kubernetes 集群中 Node 节点个 {{< copyable "shell-regular" >}} - ```shell + ```bash echo "KUBELET_EXTRA_ARGS=--root-dir=/data1/kubelet" > /etc/sysconfig/kubelet systemctl restart kubelet ``` diff --git a/zh/recover-deleted-cluster.md b/zh/recover-deleted-cluster.md index eca6176d363..32723029a6b 100644 --- a/zh/recover-deleted-cluster.md +++ b/zh/recover-deleted-cluster.md @@ -16,7 +16,7 @@ TiDB Operator 使用 PV (Persistent Volume)、PVC (Persistent Volume Claim) 来 {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} create -f tidb-cluster.yaml ``` @@ -28,6 +28,6 @@ TiDB Operator 使用 PV (Persistent Volume)、PVC (Persistent Volume Claim) 来 {{< copyable "shell-regular" >}} -```shell +```bash helm install ${release_name} pingcap/tidb-cluster --namespace=${namespace} --version=${chart_version} -f values.yaml ``` diff --git a/zh/renew-tls-certificate.md b/zh/renew-tls-certificate.md index 91f3736840b..046adbb323e 100644 --- a/zh/renew-tls-certificate.md +++ b/zh/renew-tls-certificate.md @@ -25,7 +25,7 @@ summary: 介绍如何更新和替换 TiDB 组件间的 TLS 证书。 {{< copyable "shell-regular" >}} - ```shell + ```bash mv ca.pem ca.old.pem && \ mv ca-key.pem ca-key.old.pem ``` @@ -34,7 +34,7 @@ summary: 介绍如何更新和替换 TiDB 组件间的 TLS 证书。 {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -initca ca-csr.json | cfssljson -bare ca - ``` @@ -46,7 +46,7 @@ summary: 介绍如何更新和替换 TiDB 组件间的 TLS 证书。 {{< copyable "shell-regular" >}} - ```shell + ```bash mv ca.pem ca.new.pem && \ mv ca-key.pem ca-key.new.pem && \ cat ca.new.pem ca.old.pem > ca.pem @@ -56,7 +56,7 @@ summary: 介绍如何更新和替换 TiDB 组件间的 TLS 证书。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-pd-cluster-secret --namespace=${namespace} --from-file=tls.crt=pd-server.pem --from-file=tls.key=pd-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tikv-cluster-secret --namespace=${namespace} --from-file=tls.crt=tikv-server.pem --from-file=tls.key=tikv-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tidb-cluster-secret --namespace=${namespace} --from-file=tls.crt=tidb-server.pem --from-file=tls.key=tidb-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - @@ -83,7 +83,7 @@ summary: 介绍如何更新和替换 TiDB 组件间的 TLS 证书。 {{< copyable "shell-regular" >}} - ```shell + ```bash cfssl gencert -ca=ca.new.pem -ca-key=ca-key.new.pem -config=ca-config.json -profile=internal pd-server.json | cfssljson -bare pd-server cfssl gencert -ca=ca.new.pem -ca-key=ca-key.new.pem -config=ca-config.json -profile=internal tikv-server.json | cfssljson -bare tikv-server cfssl gencert -ca=ca.new.pem -ca-key=ca-key.new.pem -config=ca-config.json -profile=internal tidb-server.json | cfssljson -bare tidb-server @@ -99,7 +99,7 @@ summary: 介绍如何更新和替换 TiDB 组件间的 TLS 证书。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-pd-cluster-secret --namespace=${namespace} --from-file=tls.crt=pd-server.pem --from-file=tls.key=pd-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tikv-cluster-secret --namespace=${namespace} --from-file=tls.crt=tikv-server.pem --from-file=tls.key=tikv-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tidb-cluster-secret --namespace=${namespace} --from-file=tls.crt=tidb-server.pem --from-file=tls.key=tidb-server-key.pem --from-file=ca.crt=ca.pem --dry-run=client -o yaml | kubectl apply -f - @@ -124,7 +124,7 @@ summary: 介绍如何更新和替换 TiDB 组件间的 TLS 证书。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic ${cluster_name}-pd-cluster-secret --namespace=${namespace} --from-file=tls.crt=pd-server.pem --from-file=tls.key=pd-server-key.pem --from-file=ca.crt=ca.new.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tikv-cluster-secret --namespace=${namespace} --from-file=tls.crt=tikv-server.pem --from-file=tls.key=tikv-server-key.pem --from-file=ca.crt=ca.new.pem --dry-run=client -o yaml | kubectl apply -f - kubectl create secret generic ${cluster_name}-tidb-cluster-secret --namespace=${namespace} --from-file=tls.crt=tidb-server.pem --from-file=tls.key=tidb-server-key.pem --from-file=ca.crt=ca.new.pem --dry-run=client -o yaml | kubectl apply -f - @@ -167,7 +167,7 @@ summary: 介绍如何更新和替换 TiDB 组件间的 TLS 证书。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl delete secret ${cluster_name}-pd-cluster-secret --namespace=${namespace} kubectl delete secret ${cluster_name}-tikv-cluster-secret --namespace=${namespace} kubectl delete secret ${cluster_name}-tidb-cluster-secret --namespace=${namespace} diff --git a/zh/restart-a-tidb-cluster.md b/zh/restart-a-tidb-cluster.md index b991eba1af6..882a236e891 100644 --- a/zh/restart-a-tidb-cluster.md +++ b/zh/restart-a-tidb-cluster.md @@ -47,7 +47,7 @@ spec: {{< copyable "shell-regular" >}} -```shell +```bash kubectl -n ${namespace} annotate pod ${tikv_pod_name} tidb.pingcap.com/evict-leader="delete-pod" ``` diff --git a/zh/restore-data-using-tidb-lightning.md b/zh/restore-data-using-tidb-lightning.md index 3476e65c867..caa36d6ea90 100644 --- a/zh/restore-data-using-tidb-lightning.md +++ b/zh/restore-data-using-tidb-lightning.md @@ -26,13 +26,13 @@ TiDB Lightning 包含两个组件:tidb-lightning 和 tikv-importer。在 Kuber {{< copyable "shell-regular" >}} - ```shell + ```bash helm repo update ``` {{< copyable "shell-regular" >}} - ```shell + ```bash helm search repo tikv-importer -l ``` @@ -40,7 +40,7 @@ TiDB Lightning 包含两个组件:tidb-lightning 和 tikv-importer。在 Kuber {{< copyable "shell-regular" >}} - ```shell + ```bash helm inspect values pingcap/tikv-importer --version=${chart_version} > values.yaml ``` @@ -72,7 +72,7 @@ TiDB Lightning 包含两个组件:tidb-lightning 和 tikv-importer。在 Kuber {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${cluster_name} pingcap/tikv-importer --namespace=${namespace} --version=${chart_version} -f values.yaml ``` @@ -88,7 +88,7 @@ TiDB Lightning 包含两个组件:tidb-lightning 和 tikv-importer。在 Kuber {{< copyable "shell-regular" >}} -```shell +```bash helm inspect values pingcap/tidb-lightning --version=${chart_version} > tidb-lightning-values.yaml ``` @@ -179,7 +179,7 @@ tidb-lightning Helm chart 支持恢复本地或远程的备份数据。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f secret.yaml -n ${namespace} ``` @@ -212,7 +212,7 @@ tidb-lightning Helm chart 支持恢复本地或远程的备份数据。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f secret.yaml -n ${namespace} ``` @@ -236,7 +236,7 @@ tidb-lightning Helm chart 支持恢复本地或远程的备份数据。 {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} pingcap/tidb-lightning --namespace=${namespace} --set failFast=true -f tidb-lightning-values.yaml --version=${chart_version} ``` @@ -252,7 +252,7 @@ tidb-lightning Helm chart 支持恢复本地或远程的备份数据。 {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} pingcap/tidb-lightning --namespace=${namespace} --set failFast=true -f tidb-lightning-values.yaml --version=${chart_version} ``` @@ -274,7 +274,7 @@ tidb-lightning Helm chart 支持恢复本地或远程的备份数据。 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate sa ${servieaccount} -n eks.amazonaws.com/role-arn=arn:aws:iam::123456789012:role/user ``` @@ -282,7 +282,7 @@ tidb-lightning Helm chart 支持恢复本地或远程的备份数据。 {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} pingcap/tidb-lightning --namespace=${namespace} --set-string failFast=true,serviceAccount=${servieaccount} -f tidb-lightning-values.yaml --version=${chart_version} ``` diff --git a/zh/restore-from-aws-s3-using-br.md b/zh/restore-from-aws-s3-using-br.md index 932c39ef7d3..01c54b592a5 100644 --- a/zh/restore-from-aws-s3-using-br.md +++ b/zh/restore-from-aws-s3-using-br.md @@ -22,7 +22,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-aws-s3-using-br/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -34,7 +34,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-aws-s3-using-br/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=password=${password} --namespace=test2 ``` @@ -48,7 +48,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-aws-s3-using-br/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f resotre-aws-s3.yaml ``` @@ -90,7 +90,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-aws-s3-using-br/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore-aws-s3.yaml ``` @@ -133,7 +133,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-aws-s3-using-br/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore-aws-s3.yaml ``` @@ -175,7 +175,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-aws-s3-using-br/'] {{< copyable "shell-regular" >}} -```shell +```bash kubectl get rt -n test2 -o wide ``` diff --git a/zh/restore-from-gcs-using-br.md b/zh/restore-from-gcs-using-br.md index 583a0bc21a1..642bc5a84fe 100644 --- a/zh/restore-from-gcs-using-br.md +++ b/zh/restore-from-gcs-using-br.md @@ -22,7 +22,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-gcs-using-br/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -34,7 +34,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-gcs-using-br/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=user=root --from-literal=password= --namespace=test2 ``` @@ -48,7 +48,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-gcs-using-br/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -92,7 +92,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-gcs-using-br/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get rt -n test2 -owide ``` diff --git a/zh/restore-from-gcs.md b/zh/restore-from-gcs.md index 5313e46a3ee..a876596b0ba 100644 --- a/zh/restore-from-gcs.md +++ b/zh/restore-from-gcs.md @@ -20,7 +20,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-gcs/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -32,7 +32,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-gcs/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=user=root --from-literal=password=${password} --namespace=test2 ``` @@ -54,7 +54,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-gcs/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -89,7 +89,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-gcs/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get rt -n test2 -owide ``` diff --git a/zh/restore-from-pv-using-br.md b/zh/restore-from-pv-using-br.md index 4facca99aee..d52db6afdf0 100644 --- a/zh/restore-from-pv-using-br.md +++ b/zh/restore-from-pv-using-br.md @@ -21,7 +21,7 @@ summary: 介绍如何使用 BR 将存储在持久卷上的备份数据恢复到 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -29,7 +29,7 @@ summary: 介绍如何使用 BR 将存储在持久卷上的备份数据恢复到 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=user=root --from-literal=password= --namespace=test2 ``` @@ -45,7 +45,7 @@ summary: 介绍如何使用 BR 将存储在持久卷上的备份数据恢复到 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -90,7 +90,7 @@ summary: 介绍如何使用 BR 将存储在持久卷上的备份数据恢复到 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get rt -n test2 -owide ``` diff --git a/zh/restore-from-s3.md b/zh/restore-from-s3.md index 935f42290bb..2e7ec31e946 100644 --- a/zh/restore-from-s3.md +++ b/zh/restore-from-s3.md @@ -20,7 +20,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-s3/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f backup-rbac.yaml -n test2 ``` @@ -32,7 +32,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-s3/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl create secret generic restore-demo2-tidb-secret --from-literal=user=root --from-literal=password=${password} --namespace=test2 ``` @@ -69,7 +69,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-s3/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -102,7 +102,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-s3/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -135,7 +135,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-s3/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -169,7 +169,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-s3/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl apply -f restore.yaml ``` @@ -202,7 +202,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/restore-from-s3/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get rt -n test2 -owide ``` diff --git a/zh/scale-a-tidb-cluster.md b/zh/scale-a-tidb-cluster.md index 8fe650a94fd..1e4cbfddaa0 100644 --- a/zh/scale-a-tidb-cluster.md +++ b/zh/scale-a-tidb-cluster.md @@ -20,7 +20,7 @@ TiDB 水平扩缩容操作指的是通过增加或减少节点的数量,来达 {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit tidbcluster ${cluster_name} -n ${namespace} ``` @@ -28,7 +28,7 @@ kubectl edit tidbcluster ${cluster_name} -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash kubectl get tidbcluster ${cluster_name} -n ${namespace} -oyaml ``` @@ -36,7 +36,7 @@ kubectl get tidbcluster ${cluster_name} -n ${namespace} -oyaml {{< copyable "shell-regular" >}} -```shell +```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -54,7 +54,7 @@ watch kubectl -n ${namespace} get pod -o wide {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 ``` @@ -62,7 +62,7 @@ watch kubectl -n ${namespace} get pod -o wide {{< copyable "shell-regular" >}} - ```shell + ```bash curl 127.0.0.1:2379/pd/api/v1/config/rules/group/tiflash | grep count ``` @@ -94,7 +94,7 @@ watch kubectl -n ${namespace} get pod -o wide {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get tidbcluster ${cluster-name} -n ${namespace} -oyaml ``` @@ -102,7 +102,7 @@ watch kubectl -n ${namespace} get pod -o wide {{< copyable "shell-regular" >}} -```shell +```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -137,7 +137,7 @@ watch kubectl -n ${namespace} get pod -o wide {{< copyable "shell-regular" >}} -```shell +```bash watch kubectl -n ${namespace} get pod -o wide ``` diff --git a/zh/tidb-operator-rbac.md b/zh/tidb-operator-rbac.md index 7a37d173c7b..587944a3748 100644 --- a/zh/tidb-operator-rbac.md +++ b/zh/tidb-operator-rbac.md @@ -15,13 +15,13 @@ Kubernetes [基于角色的访问控制 (RBAC)](https://kubernetes.io/docs/refer {{< copyable "shell-regular" >}} -```shell +```bash kubectl get clusterrole | grep tidb ``` 输出结果如下: -```shell +```bash tidb-operator:tidb-controller-manager 2021-05-04T13:08:55Z tidb-operator:tidb-scheduler 2021-05-04T13:08:55Z ``` @@ -95,13 +95,13 @@ tidb-operator:tidb-scheduler 2021-05-0 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get clusterrole | grep tidb ``` 输出结果如下: - ```shell + ```bash tidb-operator:tidb-controller-manager 2021-05-04T13:08:55Z ``` @@ -115,13 +115,13 @@ tidb-operator:tidb-scheduler 2021-05-0 {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get role -n tidb-admin ``` 输出结果如下: - ```shell + ```bash tidb-admin tidb-operator:tidb-controller-manager 2021-05-04T13:08:55Z tidb-admin tidb-operator:tidb-scheduler 2021-05-04T13:08:55Z ``` diff --git a/zh/tidb-scheduler.md b/zh/tidb-scheduler.md index 3f671cd27e2..bbf92569ba5 100644 --- a/zh/tidb-scheduler.md +++ b/zh/tidb-scheduler.md @@ -43,7 +43,7 @@ metadata: {{< copyable "shell-regular" >}} -```shell +```bash kubectl label nodes node1 zone=zone1 ``` diff --git a/zh/tidb-toolkit.md b/zh/tidb-toolkit.md index aefd1d3ee1a..8fc3b9f1dba 100644 --- a/zh/tidb-toolkit.md +++ b/zh/tidb-toolkit.md @@ -14,7 +14,7 @@ Kubernetes 上的 TiDB 运维管理需要使用一些开源工具。同时,在 {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 &>/tmp/portforward-pd.log & ``` @@ -22,7 +22,7 @@ kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 &>/tmp/por {{< copyable "shell-regular" >}} -```shell +```bash pd-ctl -d config show ``` @@ -30,7 +30,7 @@ pd-ctl -d config show {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd ${local_port}:2379 &>/tmp/portforward-pd.log & ``` @@ -38,7 +38,7 @@ kubectl port-forward -n ${namespace} svc/${cluster_name}-pd ${local_port}:2379 & {{< copyable "shell-regular" >}} -```shell +```bash pd-ctl -u 127.0.0.1:${local_port} -d config show ``` @@ -50,13 +50,13 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 &>/tmp/portforward-pd.log & ``` {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl port-forward -n ${namespace} ${pod_name} 20160:20160 &>/tmp/portforward-tikv.log & ``` @@ -64,13 +64,13 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash $ tikv-ctl --host 127.0.0.1:20160 ${subcommands} ``` {{< copyable "shell-regular" >}} - ```shell + ```bash tikv-ctl --pd 127.0.0.1:2379 compact-cluster ``` @@ -80,7 +80,7 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate pod ${pod_name} -n ${namespace} runmode=debug ``` @@ -88,7 +88,7 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec ${pod_name} -n ${namespace} -c tikv -- kill -s TERM 1 ``` @@ -96,7 +96,7 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- sh ``` @@ -104,7 +104,7 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} - ```shell + ```bash ./tikv-ctl --data-dir /var/lib/tikv size -r 2 ``` @@ -114,13 +114,13 @@ pd-ctl -u 127.0.0.1:${local_port} -d config show {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} svc/${cluster_name}-pd 2379:2379 &>/tmp/portforward-pd.log & ``` {{< copyable "shell-regular" >}} -```shell +```bash kubectl port-forward -n ${namespace} ${pod_name} 10080:10080 &>/tmp/portforward-tidb.log & ``` @@ -128,7 +128,7 @@ kubectl port-forward -n ${namespace} ${pod_name} 10080:10080 &>/tmp/portforward- {{< copyable "shell-regular" >}} -```shell +```bash tidb-ctl schema in mysql ``` @@ -144,14 +144,14 @@ tidb-ctl schema in mysql {{< copyable "shell-regular" >}} -```shell +```bash wget https://get.helm.sh/helm-v3.4.1-linux-amd64.tar.gz tar zxvf helm-v3.4.1-linux-amd64.tar.gz ``` 解压之后,有以下文件: -```shell +```bash linux-amd64/ linux-amd64/README.md linux-amd64/helm @@ -164,11 +164,11 @@ linux-amd64/LICENSE {{< copyable "shell-regular" >}} -```shell +```bash helm version ``` -```shell +```bash version.BuildInfo{Version:"v3.4.1", GitCommit:"c4e74854886b2efe3321e185578e6db9be0a6e29", GitTreeState:"clean", GoVersion:"go1.14.11"} ``` @@ -187,7 +187,7 @@ Kubernetes 应用在 Helm 中被打包为 chart。PingCAP 针对 Kubernetes 上 {{< copyable "shell-regular" >}} -```shell +```bash helm repo add pingcap https://charts.pingcap.org/ ``` @@ -195,7 +195,7 @@ helm repo add pingcap https://charts.pingcap.org/ {{< copyable "shell-regular" >}} -```shell +```bash helm search repo pingcap ``` @@ -225,7 +225,7 @@ Helm 的常用操作有部署(`helm install`)、升级(`helm upgrade`)、 {{< copyable "shell-regular" >}} -```shell +```bash helm ls ``` @@ -235,7 +235,7 @@ helm ls {{< copyable "shell-regular" >}} - ```shell + ```bash helm install ${release_name} ${chart_name} --namespace=${namespace} --version=${chart_version} -f ${values_file} ``` @@ -243,7 +243,7 @@ helm ls {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade ${release_name} ${chart_name} --version=${chart_version} -f ${values_file} ``` @@ -251,7 +251,7 @@ helm ls {{< copyable "shell-regular" >}} -```shell +```bash helm uninstall ${release_name} -n ${namespace} ``` @@ -265,7 +265,7 @@ helm uninstall ${release_name} -n ${namespace} {{< copyable "shell-regular" >}} -```shell +```bash wget http://charts.pingcap.org/tidb-operator-v1.2.4.tgz wget http://charts.pingcap.org/tidb-drainer-v1.2.4.tgz wget http://charts.pingcap.org/tidb-lightning-v1.2.4.tgz @@ -275,7 +275,7 @@ wget http://charts.pingcap.org/tidb-lightning-v1.2.4.tgz {{< copyable "shell-regular" >}} -```shell +```bash tar zxvf tidb-operator.v1.2.4.tgz helm install ${release_name} ./tidb-operator --namespace=${namespace} ``` diff --git a/zh/tips.md b/zh/tips.md index 621bd1dba6e..16d950d9abf 100644 --- a/zh/tips.md +++ b/zh/tips.md @@ -18,7 +18,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/tips/','/zh/tidb-in-kubernetes/dev/tr {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl annotate pod ${pod_name} -n ${namespace} runmode=debug ``` @@ -28,7 +28,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/tips/','/zh/tidb-in-kubernetes/dev/tr {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl get pod ${pod_name} -n ${namespace} ``` @@ -36,13 +36,13 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/tips/','/zh/tidb-in-kubernetes/dev/tr {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl exec -it ${pod_name} -n ${namespace} -- /bin/sh ``` 3. 诊断完毕,修复问题后,删除 Pod: - ```shell + ```bash kubectl delete pod ${pod_name} -n ${namespace} ``` diff --git a/zh/upgrade-a-tidb-cluster.md b/zh/upgrade-a-tidb-cluster.md index 34bd6851199..4b2aa72d7ca 100644 --- a/zh/upgrade-a-tidb-cluster.md +++ b/zh/upgrade-a-tidb-cluster.md @@ -31,7 +31,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-a-tidb-cluster/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -39,7 +39,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-a-tidb-cluster/'] {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl -n ${namespace} get pod -o wide ``` @@ -59,7 +59,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-a-tidb-cluster/'] {{< copyable "shell-regular" >}} -```shell +```bash kubectl annotate --overwrite tc ${cluster_name} -n ${namespace} tidb.pingcap.com/force-upgrade=true ``` @@ -71,7 +71,7 @@ kubectl annotate --overwrite tc ${cluster_name} -n ${namespace} tidb.pingcap.com > > {{< copyable "shell-regular" >}} > -> ```shell +> ```bash > kubectl annotate tc ${cluster_name} -n ${namespace} tidb.pingcap.com/force-upgrade- > ``` @@ -86,7 +86,7 @@ kubectl annotate --overwrite tc ${cluster_name} -n ${namespace} tidb.pingcap.com {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl edit tc ${cluster_name} -n ${namespace} ``` @@ -94,7 +94,7 @@ kubectl annotate --overwrite tc ${cluster_name} -n ${namespace} tidb.pingcap.com {{< copyable "shell-regular" >}} - ```shell + ```bash watch kubectl -n ${namespace} get pod -o wide ``` diff --git a/zh/upgrade-tidb-operator.md b/zh/upgrade-tidb-operator.md index b6bd56844a5..222f8658e24 100644 --- a/zh/upgrade-tidb-operator.md +++ b/zh/upgrade-tidb-operator.md @@ -21,7 +21,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl replace -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml && \ kubectl get crd tidbclusters.pingcap.com ``` @@ -30,7 +30,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl replace -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd_v1beta1.yaml && \ kubectl get crd tidbclusters.pingcap.com ``` @@ -39,7 +39,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash mkdir -p ${HOME}/tidb-operator/v1.2.4 && \ helm inspect values pingcap/tidb-operator --version=v1.2.4 > ${HOME}/tidb-operator/v1.2.4/values-tidb-operator.yaml ``` @@ -48,7 +48,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade tidb-operator pingcap/tidb-operator --version=v1.2.4 -f ${HOME}/tidb-operator/v1.2.4/values-tidb-operator.yaml ``` @@ -56,7 +56,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get po -n tidb-admin -l app.kubernetes.io/instance=tidb-operator -o yaml | grep 'image:.*operator:' ``` @@ -85,7 +85,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash wget -O crd.yaml https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml ``` @@ -93,7 +93,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash wget -O crd.yaml https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd_v1beta1.yaml ``` @@ -101,7 +101,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash wget http://charts.pingcap.org/tidb-operator-v1.2.4.tgz ``` @@ -109,7 +109,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash docker pull pingcap/tidb-operator:v1.2.4 docker pull pingcap/tidb-backup-manager:v1.2.4 @@ -123,7 +123,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl replace -f ./crd.yaml ``` @@ -131,7 +131,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash tar zxvf tidb-operator-v1.2.4.tgz && \ mkdir -p ${HOME}/tidb-operator/v1.2.4 && \ cp tidb-operator/values.yaml ${HOME}/tidb-operator/v1.2.4/values-tidb-operator.yaml @@ -141,7 +141,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash docker load -i tidb-operator-v1.2.4.tar docker load -i tidb-backup-manager-v1.2.4.tar ``` @@ -150,7 +150,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash helm upgrade tidb-operator ./tidb-operator --version=v1.2.4 -f ${HOME}/tidb-operator/v1.2.4/values-tidb-operator.yaml ``` @@ -158,7 +158,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/upgrade-tidb-operator/'] {{< copyable "shell-regular" >}} - ```shell + ```bash kubectl get po -n tidb-admin -l app.kubernetes.io/instance=tidb-operator -o yaml | grep 'image:.*operator:' ``` diff --git a/zh/use-auto-failover.md b/zh/use-auto-failover.md index e3592d3ac61..872398202b5 100644 --- a/zh/use-auto-failover.md +++ b/zh/use-auto-failover.md @@ -95,7 +95,7 @@ TiDB Operator 通过访问 PD API 获取 TiKV store 健康状况,并记录到 {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit tc -n ${namespace} ${cluster_name} ``` @@ -122,7 +122,7 @@ TiDB Operator 通过访问 PD API 获取 TiFlash store 健康状况,并记录 {{< copyable "shell-regular" >}} -```shell +```bash kubectl edit tc -n ${namespace} ${cluster_name} ``` diff --git a/zh/use-tkctl.md b/zh/use-tkctl.md index 538ef304582..5df628f3c53 100644 --- a/zh/use-tkctl.md +++ b/zh/use-tkctl.md @@ -30,7 +30,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/use-tkctl/'] {{< copyable "shell-regular" >}} -```shell +```bash git clone https://github.com/pingcap/tidb-operator.git && \ GOOS=${YOUR_GOOS} make cli && \ mv tkctl /usr/local/bin/tkctl @@ -46,7 +46,7 @@ mv tkctl /usr/local/bin/tkctl {{< copyable "shell-regular" >}} -```shell +```bash source <(tkctl completion bash) ``` @@ -54,7 +54,7 @@ source <(tkctl completion bash) {{< copyable "shell-regular" >}} -```shell +```bash echo "if hash tkctl 2>/dev/null; then source <(tkctl completion bash); fi" >> ~/.bashrc ``` @@ -64,7 +64,7 @@ echo "if hash tkctl 2>/dev/null; then source <(tkctl completion bash); fi" >> ~/ {{< copyable "shell-regular" >}} -```shell +```bash source <(tkctl completion zsh) ``` @@ -72,7 +72,7 @@ source <(tkctl completion zsh) {{< copyable "shell-regular" >}} -```shell +```bash echo "if hash tkctl 2>/dev/null; then source <(tkctl completion zsh); fi" >> ~/.zshrc ``` @@ -82,7 +82,7 @@ echo "if hash tkctl 2>/dev/null; then source <(tkctl completion zsh); fi" >> ~/. {{< copyable "shell-regular" >}} -```shell +```bash tkctl version ``` @@ -98,7 +98,7 @@ tkctl version {{< copyable "shell-regular" >}} -```shell +```bash tkctl version ``` @@ -121,7 +121,7 @@ TiDB Scheduler Version: pingcap/tidb-operator:latest {{< copyable "shell-regular" >}} -```shell +```bash tkctl list -A ``` @@ -139,7 +139,7 @@ bar demo-cluster 3/3 3/3 1/2 11m {{< copyable "shell-regular" >}} -```shell +```bash tkctl use --namespace=foo demo-cluster ``` @@ -159,7 +159,7 @@ Tidb cluster switched to foo/demo-cluster {{< copyable "shell-regular" >}} -```shell +```bash tkctl info ``` @@ -193,7 +193,7 @@ Endpoints(NodePort): {{< copyable "shell-regular" >}} -```shell +```bash tkctl get tikv ``` @@ -206,7 +206,7 @@ demo-cluster-tikv-2 2/2 Running 2098Mi/4196Mi 2/2 0 4m45s {{< copyable "shell-regular" >}} -```shell +```bash tkctl get volume ``` @@ -242,13 +242,13 @@ local-pv-e54c122a pd-demo-cluster-pd-2 Bound 1476Gi 172.16.4.156 {{< copyable "shell-regular" >}} -```shell +```bash tkctl debug demo-cluster-tikv-0 ``` {{< copyable "shell-regular" >}} -```shell +```bash ps -ef ``` @@ -260,13 +260,13 @@ ps -ef {{< copyable "shell-regular" >}} -```shell +```bash tkctl debug demo-cluster-tikv-0 ``` {{< copyable "shell-regular" >}} -```shell +```bash gdb /proc/${pid:-1}/root/tikv-server 1 ``` @@ -274,7 +274,7 @@ gdb /proc/${pid:-1}/root/tikv-server 1 {{< copyable "shell-regular" >}} -```shell +```bash (gdb) set sysroot /proc/${pid}/root/ ``` @@ -282,13 +282,13 @@ gdb /proc/${pid:-1}/root/tikv-server 1 {{< copyable "shell-regular" >}} -```shell +```bash (gdb) thread apply all bt ``` {{< copyable "shell-regular" >}} -```shell +```bash (gdb) info threads ``` @@ -298,19 +298,19 @@ gdb /proc/${pid:-1}/root/tikv-server 1 {{< copyable "shell-regular" >}} -```shell +```bash tkctl debug demo-cluster-tikv-0 ``` {{< copyable "shell-regular" >}} -```shell +```bash cp /proc/1/root/tikv-server / ``` {{< copyable "shell-regular" >}} -```shell +```bash ./run_flamegraph.sh 1 ``` @@ -331,13 +331,13 @@ cp /proc/1/root/tikv-server / {{< copyable "shell-regular" >}} -```shell +```bash tkctl ctop demo-cluster-tikv-0 ``` {{< copyable "shell-regular" >}} -```shell +```bash tkctl ctop node/172.16.4.155 ``` @@ -349,7 +349,7 @@ tkctl ctop node/172.16.4.155 {{< copyable "shell-regular" >}} -```shell +```bash tkctl help debug ``` @@ -361,7 +361,7 @@ tkctl help debug {{< copyable "shell-regular" >}} -```shell +```bash tkctl options ``` diff --git a/zh/view-logs.md b/zh/view-logs.md index aa0d9bd9846..6a32bb596e5 100644 --- a/zh/view-logs.md +++ b/zh/view-logs.md @@ -14,7 +14,7 @@ aliases: ['/docs-cn/tidb-in-kubernetes/dev/view-logs/'] {{< copyable "shell-regular" >}} -```shell +```bash kubectl logs -n ${namespace} ${pod_name} ``` @@ -22,7 +22,7 @@ kubectl logs -n ${namespace} ${pod_name} {{< copyable "shell-regular" >}} -```shell +```bash kubectl logs -n ${namespace} ${pod_name} -c ${container_name} ``` @@ -34,7 +34,7 @@ TiDB 3.0 及以上的版本中,慢查询日志和应用日志区分开,可 {{< copyable "shell-regular" >}} -```shell +```bash kubectl logs -n ${namespace} ${pod_name} -c slowlog ```