Skip to content

Commit 00f64de

Browse files
yiduoyunQti-chi-bot
authored andcommitted
This is an automated cherry-pick of pingcap#2777
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
1 parent b9355b9 commit 00f64de

File tree

2 files changed

+120
-2
lines changed

2 files changed

+120
-2
lines changed

en/configure-a-tidb-cluster.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,18 @@ spec:
347347
[storage]
348348
[storage.block-cache]
349349
capacity = "16GB"
350+
[log.file]
351+
max-days = 30
352+
max-backups = 30
350353
```
351354

352355
For all the configurable parameters of TiKV, refer to [TiKV Configuration File](https://docs.pingcap.com/tidb/stable/tikv-configuration-file).
353356

354357
> **Note:**
355358
>
356-
> If you deploy your TiDB cluster using CR, make sure that `Config: {}` is set, no matter you want to modify `config` or not. Otherwise, TiKV components might not be started successfully. This step is meant to be compatible with `Helm` deployment.
359+
> - If you deploy your TiDB cluster using CR, make sure that `Config: {}` is set, no matter you want to modify `config` or not. Otherwise, TiKV components might not be started successfully. This step is meant to be compatible with `Helm` deployment.
360+
> - TiKV RocksDB logs are stored in the `/var/lib/tikv` data directory by default. It is recommended that you configure `max-days` and `max-backups` to automatically clean log files.
361+
> - You can also use the `separateRocksDBLog` configuration item to configure TiKV to output RocksDB logs to stdout through a sidecar container. For more information, see the [TiDB Cluster example](https://github.com/pingcap/tidb-operator/blob/master/examples/advanced/tidb-cluster.yaml).
357362

358363
#### Configure PD parameters
359364

@@ -376,6 +381,61 @@ For all the configurable parameters of PD, refer to [PD Configuration File](http
376381
> - If you deploy your TiDB cluster using CR, make sure that `Config: {}` is set, no matter you want to modify `config` or not. Otherwise, PD components might not be started successfully. This step is meant to be compatible with `Helm` deployment.
377382
> - After the cluster is started for the first time, some PD configuration items are persisted in etcd. The persisted configuration in etcd takes precedence over that in PD. Therefore, after the first start, you cannot modify some PD configuration using parameters. You need to dynamically modify the configuration using SQL statements, pd-ctl, or PD server API. Currently, among all the configuration items listed in [Modify PD configuration online](https://docs.pingcap.com/tidb/stable/dynamic-config#modify-pd-configuration-online), except `log.level`, all the other configuration items cannot be modified using parameters after the first start.
378383

384+
<<<<<<< HEAD
385+
=======
386+
##### Configure PD microservices
387+
388+
> **Note:**
389+
>
390+
> Starting from v8.0.0, PD supports the [microservice mode](https://docs.pingcap.com/tidb/dev/pd-microservices) (experimental).
391+
392+
You can configure PD microservice using the `spec.pd.mode` and `spec.pdms` parameters of the TidbCluster CR. Currently, PD supports two microservices: the `tso` microservice and the `scheduling` microservice. The configuration example is as follows:
393+
394+
```yaml
395+
spec:
396+
pd:
397+
mode: "ms"
398+
pdms:
399+
- name: "tso"
400+
baseImage: pingcap/pd
401+
replicas: 2
402+
config: |
403+
[log.file]
404+
filename = "/pdms/log/tso.log"
405+
- name: "scheduling"
406+
baseImage: pingcap/pd
407+
replicas: 1
408+
config: |
409+
[log.file]
410+
filename = "/pdms/log/scheduling.log"
411+
```
412+
413+
In the preceding configuration, `spec.pdms` is used to configure PD microservices, and the specific configuration parameters are the same as `spec.pd.config`. To get all the parameters that can be configured for PD microservices, see the [PD configuration file](https://docs.pingcap.com/tidb/stable/pd-configuration-file).
414+
415+
> **Note:**
416+
>
417+
> - If you deploy your TiDB cluster using CR, make sure that `config: {}` is set, no matter you want to modify `config` or not. Otherwise, PD microservice components might fail to start. This step is meant to be compatible with `Helm` deployment.
418+
> - If you enable the PD microservice mode when you deploy a TiDB cluster, some configuration items of PD microservices are persisted in etcd. The persisted configuration in etcd takes precedence over that in PD.
419+
> - If you enable the PD microservice mode for an existing TiDB cluster, some configuration items of PD microservices adopt the same values in PD configuration and are persisted in etcd. The persisted configuration in etcd takes precedence over that in PD.
420+
> - Hence, after the first startup of PD microservices, you cannot modify these configuration items using parameters. Instead, you can modify them dynamically using [SQL statements](https://docs.pingcap.com/tidb/stable/dynamic-config#modify-pd-configuration-dynamically), [pd-ctl](https://docs.pingcap.com/tidb/stable/pd-control#config-show--set-option-value--placement-rules), or PD server API. Currently, among all the configuration items listed in [Modify PD configuration dynamically](https://docs.pingcap.com/tidb/stable/dynamic-config#modify-pd-configuration-dynamically), except `log.level`, all the other configuration items cannot be modified using parameters after the first startup of PD microservices.
421+
422+
#### Configure TiProxy parameters
423+
424+
TiProxy parameters can be configured by `spec.tiproxy.config` in TidbCluster Custom Resource.
425+
426+
For example:
427+
428+
```yaml
429+
spec:
430+
tiproxy:
431+
config: |
432+
[log]
433+
level = "info"
434+
```
435+
436+
For all the configurable parameters of TiProxy, refer to [TiProxy Configuration File](https://docs.pingcap.com/tidb/stable/tiproxy-configuration).
437+
438+
>>>>>>> c0cb1959 (add-tikv-config: add `max-days` and `max-backups` (#2777))
379439
#### Configure TiFlash parameters
380440

381441
TiFlash parameters can be configured by `spec.tiflash.config` in TidbCluster Custom Resource.

zh/configure-a-tidb-cluster.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,18 @@ spec:
340340
[storage]
341341
[storage.block-cache]
342342
capacity = "16GB"
343+
[log.file]
344+
max-days = 30
345+
max-backups = 30
343346
```
344347

345348
获取所有可以配置的 TiKV 配置参数,请参考 [TiKV 配置文档](https://docs.pingcap.com/zh/tidb/stable/tikv-configuration-file)
346349

347350
> **注意:**
348351
>
349-
> 为了兼容 `helm` 部署,如果你是通过 CR 文件部署 TiDB 集群,即使你不设置 Config 配置,也需要保证 `Config: {}` 的设置,从而避免 TiKV 组件无法正常启动。
352+
> - 为了兼容 `helm` 部署,如果你是通过 CR 文件部署 TiDB 集群,即使你不设置 Config 配置,也需要保证 `Config: {}` 的设置,从而避免 TiKV 组件无法正常启动。
353+
> - TiKV 的 RocksDB 日志默认存储在 `/var/lib/tikv` 数据目录,建议配置 `max-days` 和 `max-backups` 来自动清理日志文件。
354+
> - 你也可通过配置 `separateRocksDBLog` 将 RocksDB 日志通过单独的 sidecar 容器输出到 stdout。完整配置项请参考 [TiDB Cluster 示例](https://github.com/pingcap/tidb-operator/blob/master/examples/advanced/tidb-cluster.yaml)。
350355

351356
#### 配置 PD 配置参数
352357

@@ -367,6 +372,59 @@ spec:
367372
> - 为了兼容 `helm` 部署,如果你是通过 CR 文件部署 TiDB 集群,即使你不设置 Config 配置,也需要保证 `Config: {}` 的设置,从而避免 PD 组件无法正常启动。
368373
> - PD 部分配置项在首次启动成功后会持久化到 etcd 中且后续将以 etcd 中的配置为准。因此 PD 在首次启动后,这些配置项将无法再通过配置参数来进行修改,而需要使用 SQL、pd-ctl 或 PD server API 来动态进行修改。目前,[在线修改 PD 配置](https://docs.pingcap.com/zh/tidb/stable/dynamic-config#在线修改-pd-配置)文档中所列的配置项中,除 `log.level` 外,其他配置项在 PD 首次启动之后均不再支持通过配置参数进行修改。
369374

375+
<<<<<<< HEAD
376+
=======
377+
##### 配置 PD 微服务
378+
379+
> **注意:**
380+
>
381+
> PD 从 v8.0.0 版本开始支持[微服务模式](https://docs.pingcap.com/zh/tidb/dev/pd-microservices)(实验特性)。
382+
383+
你可以通过 TidbCluster CR 的 `spec.pd.mode` 与 `spec.pdms` 来配置 PD 微服务参数。目前 PD 支持 `tso` 和 `scheduling` 这两个微服务,配置示例如下:
384+
385+
```yaml
386+
spec:
387+
pd:
388+
mode: "ms"
389+
pdms:
390+
- name: "tso"
391+
baseImage: pingcap/pd
392+
replicas: 2
393+
config: |
394+
[log.file]
395+
filename = "/pdms/log/tso.log"
396+
- name: "scheduling"
397+
baseImage: pingcap/pd
398+
replicas: 1
399+
config: |
400+
[log.file]
401+
filename = "/pdms/log/scheduling.log"
402+
```
403+
404+
其中,`spec.pdms` 用于配置 PD 微服务,具体的配置参数与 `spec.pd.config` 相同。要获取 PD 微服务可配置的所有参数,请参考 [PD 配置文件描述](https://docs.pingcap.com/zh/tidb/stable/pd-configuration-file)。
405+
406+
> **注意:**
407+
>
408+
> - 为了兼容 `helm` 部署,如果你的 TiDB 集群是通过 CR 文件部署的,即使你不设置 `config` 配置,也需要保证 `config: {}` 的设置,避免 PD 微服务组件无法正常启动。
409+
> - 如果在部署 TiDB 集群时就启用了 PD 微服务模式,PD 微服务的部分配置项会持久化到 etcd 中且后续将以 etcd 中的配置为准。
410+
> - 如果在现有 TiDB 集群中启用 PD 微服务模式,PD 微服务的部分配置会沿用 PD 的配置并持久化到 etcd 中,后续将以 etcd 中的配置为准。
411+
> - 因此,PD 微服务在首次启动后,这些配置项将无法再通过配置参数来进行修改,而需要使用 [SQL](https://docs.pingcap.com/zh/tidb/stable/dynamic-config#在线修改-pd-配置)、[pd-ctl](https://docs.pingcap.com/tidb/stable/pd-control#config-show--set-option-value--placement-rules) 或 PD server API 来动态进行修改。目前,[在线修改 PD 配置](https://docs.pingcap.com/zh/tidb/stable/dynamic-config#在线修改-pd-配置)文档中所列的配置项中,除 `log.level` 外,其他配置项在 PD 微服务首次启动之后均不再支持通过配置参数进行修改。
412+
413+
#### 配置 TiProxy 配置参数
414+
415+
你可以通过 TidbCluster CR 的 `spec.tiproxy.config` 来配置 TiProxy 配置参数。
416+
417+
```yaml
418+
spec:
419+
tiproxy:
420+
config: |
421+
[log]
422+
level = "info"
423+
```
424+
425+
获取所有可以配置的 TiProxy 配置参数,请参考 [TiProxy 配置文档](https://docs.pingcap.com/zh/tidb/stable/tiproxy-configuration)。
426+
427+
>>>>>>> c0cb1959 (add-tikv-config: add `max-days` and `max-backups` (#2777))
370428
#### 配置 TiFlash 配置参数
371429

372430
你可以通过 TidbCluster CR 的 `spec.tiflash.config` 来配置 TiFlash 配置参数。

0 commit comments

Comments
 (0)