Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
just1900 committed Jan 18, 2022
1 parent 0b9c260 commit a5fb63d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
6 changes: 4 additions & 2 deletions zh/TOC.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!-- markdownlint-disable MD007 -->
span

<!-- markdownlint-disable MD041 -->

- 关于 TiDB Operator
- [简介](tidb-operator-overview.md)
- [What's New in v1.2](whats-new-in-v1.2.md)
- [What&#39;s New in v1.2](whats-new-in-v1.2.md)
- [快速上手](get-started.md)
- 部署
- 部署 TiDB 集群
Expand All @@ -29,6 +30,7 @@
- [TiDB 集群监控与告警](monitor-a-tidb-cluster.md)
- [访问 TiDB Dashboard](access-dashboard.md)
- [聚合多个 TiDB 集群的监控数据](aggregate-multiple-cluster-monitor-data.md)
- [跨多个 Kubernetes 集群监控 TiDB 集群](deploy-tidb-monitor-across-multiple-kubernetes.md)
- 安全
- [为 MySQL 客户端开启 TLS](enable-tls-for-mysql-client.md)
- [为 TiDB 组件间开启 TLS](enable-tls-between-components.md)
Expand Down
34 changes: 23 additions & 11 deletions zh/deploy-tidb-monitor-across-multiple-kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ summary: 介绍如何对跨多个 Kubernetes 集群的 TiDB 集群进行监控

### 部署 TiDB 集群监控

根据不同 TiDB 集群所在的 Kubernetes 集群设置以下环境变量,其中`cluster_name`为TiDB集群名称,`cluster_namespace`为TiDB集群所在的命名空间,`kubernetes_cluster_name`为自定义的 kubernetes 集群名称,作为标识 Prometheus 的`externallabels``storageclass_name`设置为当前集群中的存储,`remote_write_url``thanos-receiver`(或其他兼容 Prometheus remote API)组件的 host 信息,关于 thanos 部署方案参考 [kube-thanos](https://github.com/thanos-io/kube-thanos) 以及 [Example](https://github.com/pingcap/tidb-operator/tree/master/examples/monitor-prom-remotewrite)
根据不同 TiDB 集群所在的 Kubernetes 集群设置以下环境变量,其中 `cluster_name` 为TiDB集群名称, `cluster_namespace` 为TiDB集群所在的命名空间, `kubernetes_cluster_name` 为自定义的 kubernetes 集群名称,在标识 Prometheus 的 `externallabels` 中使用, `storageclass_name` 设置为当前集群中的存储, `remote_write_url``thanos-receiver` (或其他兼容 Prometheus remote API)组件的 host ,关于 thanos 部署方案参考 [kube-thanos](https://github.com/thanos-io/kube-thanos) 以及 [Example](https://github.com/pingcap/tidb-operator/tree/master/examples/monitor-prom-remotewrite)

{{< copyable "shell-regular" >}}

```sh
cluster_name="cluster1"
Expand All @@ -34,7 +36,9 @@ storageclass_name="local-storage"
remote_write_url="http://thanos-receiver:19291/api/v1/receive"
```

执行以下指令,创建`TidbMonitor`
执行以下指令,创建 `TidbMonitor`

{{< copyable "shell-regular" >}}

```sh
cat << EOF | kubectl apply -n ${cluster_namespace} -f -
Expand All @@ -47,7 +51,7 @@ spec:
- name: ${cluster_name}
namespace: ${cluster_namespace}
externalLabels:
#kubernetes indicates the k8s cluster name, you can change the label's name on your own, but you should notice that `cluster` label has been used by tidb already. For more information, please refer to issue #4219.
#kubernetes indicates the k8s cluster name, you can change the label's name on your own, but you should notice that `cluster` label has been used by tidb already. For more information, please refer to issue https://github.com/pingcap/tidb-operator/issues/4219.
kubernetes: ${kubernetes_cluster_name}
#add other meta labels here
#region: us-east-1
Expand Down Expand Up @@ -79,7 +83,7 @@ spec:
#### 部署架构图
为每个 prometheus(TidbMonitor) 组件部署 thanos sidecar,并使用 thanos-query 组件进行聚合查询,其中 thanos-store、S3 等组件在不需要对监控数据做长期存储时可以选择不部署。
为每个 prometheus(TidbMonitor) 组件部署 thanos sidecar,并使用 thanos-query 组件进行聚合查询,其中 thanos-store、 S3 等组件在不需要对监控数据做长期存储时可以选择不部署。
![pull-thanos-query.png](/media/pull-thanos-query.png)
Expand All @@ -92,7 +96,9 @@ spec:
#### 部署 TiDB 集群监控
根据不同 TiDB 集群所在的 Kubernetes 集群设置以下环境变量,其中 `cluster_name`为TiDB集群名称,`cluster_namespace`为TiDB集群所在的命名空间,`kubernetes_cluster_name`为自定义的 kubernetes 集群名称,作为标识 Prometheus 的`externallabels``storageclass_name`设置为当前集群中的存储,关于 thanos 部署方案参考 [kube-thanos](https://github.com/thanos-io/kube-thanos) 以及 [Example](https://github.com/pingcap/tidb-operator/tree/master/examples/monitor-with-thanos)。
根据不同 TiDB 集群所在的 Kubernetes 集群设置以下环境变量,其中 `cluster_name`为TiDB集群名称, `cluster_namespace` 为TiDB集群所在的命名空间, `kubernetes_cluster_name` 为自定义的 kubernetes 集群名称,在标识 Prometheus 的 `externallabels` 中使用, `storageclass_name` 设置为当前集群中的存储,关于 thanos 部署方案参考 [kube-thanos](https://github.com/thanos-io/kube-thanos) 以及 [Example](https://github.com/pingcap/tidb-operator/tree/master/examples/monitor-with-thanos)。
{{< copyable "shell-regular" >}}
```sh
cluster_name="cluster1"
Expand All @@ -103,6 +109,8 @@ storageclass_name="local-storage"
执行以下指令,创建 `TidbMonitor`
{{< copyable "shell-regular" >}}
```sh
cat << EOF | kubectl apply -n ${cluster1_namespace} -f -
apiVersion: pingcap.com/v1alpha1
Expand All @@ -114,7 +122,7 @@ spec:
- name: ${cluster1_name}
namespace: ${cluster1_namespace}
externalLabels:
#kubernetes indicates the k8s cluster name, you can change the label's name on your own, but you should notice that `cluster` label has been used by tidb already. For more information, please refer to issue #4219.
#kubernetes indicates the k8s cluster name, you can change the label's name on your own, but you should notice that `cluster` label has been used by tidb already. For more information, please refer to issue https://github.com/pingcap/tidb-operator/issues/4219.
kubernetes: ${kubernetes_cluster1_name}
#add other meta labels here
#region: us-east-1
Expand Down Expand Up @@ -149,7 +157,7 @@ spec:
#### 部署架构图
使用 Federation Prometheus Server 作为数据统一存储与查询的入口,以笔者的经验来看,该方案只建议在数据规模较小的环境下使用
使用 Federation Prometheus Server 作为数据统一存储与查询的入口,建议在数据规模较小的环境下使用
![pull-prom-federation.png](/media/pull-prom-federation.png)
Expand All @@ -162,7 +170,9 @@ spec:
#### 部署 TiDB 集群监控
根据不同 TiDB 集群所在的 Kubernetes 集群设置以下环境变量,其中 `cluster_name`为TiDB集群名称,`cluster_namespace`为TiDB集群所在的命名空间,`kubernetes_cluster_name`为自定义的 kubernetes 集群名称,作为标识 Prometheus 的`externallabels``storageclass_name`设置为当前集群中的存储。
根据不同 TiDB 集群所在的 Kubernetes 集群设置以下环境变量,其中 `cluster_name` 为TiDB集群名称, `cluster_namespace` 为TiDB集群所在的命名空间, `kubernetes_cluster_name` 为自定义的 kubernetes 集群名称,在标识 Prometheus 的 `externallabels` 中使用, `storageclass_name` 设置为当前集群中的存储。
{{< copyable "shell-regular" >}}
```sh
cluster_name="cluster1"
Expand All @@ -171,7 +181,9 @@ kubernetes_cluster_name="kind-cluster-1"
storageclass_name="local-storage"
```
执行以下指令,创建 `TidbMonitor`
执行以下指令,创建 `TidbMonitor`
{{< copyable "shell-regular" >}}
```sh
cat << EOF | kubectl apply -n ${cluster1_namespace} -f -
Expand All @@ -184,7 +196,7 @@ spec:
- name: ${cluster1_name}
namespace: ${cluster1_namespace}
externalLabels:
#kubernetes indicates the k8s cluster name, you can change the label's name on your own, but you should notice that `cluster` label has been used by tidb already. For more information, please refer to issue #4219.
#kubernetes indicates the k8s cluster name, you can change the label's name on your own, but you should notice that `cluster` label has been used by tidb already. For more information, please refer to issue https://github.com/pingcap/tidb-operator/issues/4219.
kubernetes: ${kubernetes_cluster1_name}
#add other meta labels here
#region: us-east-1
Expand All @@ -206,7 +218,7 @@ spec:
### 配置 Federation Prometheus
关于 Federation 方案,参考[federation文档](https://prometheus.io/docs/prometheus/latest/federation/#hierarchical-federation)。部署完成后修改采集配置,添加需要汇总的 Prometheus(TiDBMonitor) 的 host 信息。
关于 Federation 方案,参考[federation文档](https://prometheus.io/docs/prometheus/latest/federation/#hierarchical-federation)。部署完成后修改 Prometheus 采集配置,添加需要汇总的 Prometheus(TiDBMonitor) 的 host 信息。
```
scrape_configs:
Expand Down

0 comments on commit a5fb63d

Please sign in to comment.