From 00f64de3c6956710960cca77ff2cc595577cf911 Mon Sep 17 00:00:00 2001 From: jirongq <719547995@qq.com> Date: Wed, 4 Jun 2025 17:30:17 +0800 Subject: [PATCH 1/3] This is an automated cherry-pick of #2777 Signed-off-by: ti-chi-bot --- en/configure-a-tidb-cluster.md | 62 +++++++++++++++++++++++++++++++++- zh/configure-a-tidb-cluster.md | 60 +++++++++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 2 deletions(-) diff --git a/en/configure-a-tidb-cluster.md b/en/configure-a-tidb-cluster.md index 90e7bd97ab..4ed910f1dc 100644 --- a/en/configure-a-tidb-cluster.md +++ b/en/configure-a-tidb-cluster.md @@ -347,13 +347,18 @@ spec: [storage] [storage.block-cache] capacity = "16GB" + [log.file] + max-days = 30 + max-backups = 30 ``` For all the configurable parameters of TiKV, refer to [TiKV Configuration File](https://docs.pingcap.com/tidb/stable/tikv-configuration-file). > **Note:** > -> 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. +> - 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. +> - 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. +> - 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). #### Configure PD parameters @@ -376,6 +381,61 @@ For all the configurable parameters of PD, refer to [PD Configuration File](http > - 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. > - 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. +<<<<<<< HEAD +======= +##### Configure PD microservices + +> **Note:** +> +> Starting from v8.0.0, PD supports the [microservice mode](https://docs.pingcap.com/tidb/dev/pd-microservices) (experimental). + +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: + +```yaml +spec: + pd: + mode: "ms" + pdms: + - name: "tso" + baseImage: pingcap/pd + replicas: 2 + config: | + [log.file] + filename = "/pdms/log/tso.log" + - name: "scheduling" + baseImage: pingcap/pd + replicas: 1 + config: | + [log.file] + filename = "/pdms/log/scheduling.log" +``` + +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). + +> **Note:** +> +> - 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. +> - 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. +> - 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. +> - 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. + +#### Configure TiProxy parameters + +TiProxy parameters can be configured by `spec.tiproxy.config` in TidbCluster Custom Resource. + +For example: + +```yaml +spec: + tiproxy: + config: | + [log] + level = "info" +``` + +For all the configurable parameters of TiProxy, refer to [TiProxy Configuration File](https://docs.pingcap.com/tidb/stable/tiproxy-configuration). + +>>>>>>> c0cb1959 (add-tikv-config: add `max-days` and `max-backups` (#2777)) #### Configure TiFlash parameters TiFlash parameters can be configured by `spec.tiflash.config` in TidbCluster Custom Resource. diff --git a/zh/configure-a-tidb-cluster.md b/zh/configure-a-tidb-cluster.md index 39e11a9828..617db39a0e 100644 --- a/zh/configure-a-tidb-cluster.md +++ b/zh/configure-a-tidb-cluster.md @@ -340,13 +340,18 @@ spec: [storage] [storage.block-cache] capacity = "16GB" + [log.file] + max-days = 30 + max-backups = 30 ``` 获取所有可以配置的 TiKV 配置参数,请参考 [TiKV 配置文档](https://docs.pingcap.com/zh/tidb/stable/tikv-configuration-file) > **注意:** > -> 为了兼容 `helm` 部署,如果你是通过 CR 文件部署 TiDB 集群,即使你不设置 Config 配置,也需要保证 `Config: {}` 的设置,从而避免 TiKV 组件无法正常启动。 +> - 为了兼容 `helm` 部署,如果你是通过 CR 文件部署 TiDB 集群,即使你不设置 Config 配置,也需要保证 `Config: {}` 的设置,从而避免 TiKV 组件无法正常启动。 +> - TiKV 的 RocksDB 日志默认存储在 `/var/lib/tikv` 数据目录,建议配置 `max-days` 和 `max-backups` 来自动清理日志文件。 +> - 你也可通过配置 `separateRocksDBLog` 将 RocksDB 日志通过单独的 sidecar 容器输出到 stdout。完整配置项请参考 [TiDB Cluster 示例](https://github.com/pingcap/tidb-operator/blob/master/examples/advanced/tidb-cluster.yaml)。 #### 配置 PD 配置参数 @@ -367,6 +372,59 @@ spec: > - 为了兼容 `helm` 部署,如果你是通过 CR 文件部署 TiDB 集群,即使你不设置 Config 配置,也需要保证 `Config: {}` 的设置,从而避免 PD 组件无法正常启动。 > - PD 部分配置项在首次启动成功后会持久化到 etcd 中且后续将以 etcd 中的配置为准。因此 PD 在首次启动后,这些配置项将无法再通过配置参数来进行修改,而需要使用 SQL、pd-ctl 或 PD server API 来动态进行修改。目前,[在线修改 PD 配置](https://docs.pingcap.com/zh/tidb/stable/dynamic-config#在线修改-pd-配置)文档中所列的配置项中,除 `log.level` 外,其他配置项在 PD 首次启动之后均不再支持通过配置参数进行修改。 +<<<<<<< HEAD +======= +##### 配置 PD 微服务 + +> **注意:** +> +> PD 从 v8.0.0 版本开始支持[微服务模式](https://docs.pingcap.com/zh/tidb/dev/pd-microservices)(实验特性)。 + +你可以通过 TidbCluster CR 的 `spec.pd.mode` 与 `spec.pdms` 来配置 PD 微服务参数。目前 PD 支持 `tso` 和 `scheduling` 这两个微服务,配置示例如下: + +```yaml +spec: + pd: + mode: "ms" + pdms: + - name: "tso" + baseImage: pingcap/pd + replicas: 2 + config: | + [log.file] + filename = "/pdms/log/tso.log" + - name: "scheduling" + baseImage: pingcap/pd + replicas: 1 + config: | + [log.file] + filename = "/pdms/log/scheduling.log" +``` + +其中,`spec.pdms` 用于配置 PD 微服务,具体的配置参数与 `spec.pd.config` 相同。要获取 PD 微服务可配置的所有参数,请参考 [PD 配置文件描述](https://docs.pingcap.com/zh/tidb/stable/pd-configuration-file)。 + +> **注意:** +> +> - 为了兼容 `helm` 部署,如果你的 TiDB 集群是通过 CR 文件部署的,即使你不设置 `config` 配置,也需要保证 `config: {}` 的设置,避免 PD 微服务组件无法正常启动。 +> - 如果在部署 TiDB 集群时就启用了 PD 微服务模式,PD 微服务的部分配置项会持久化到 etcd 中且后续将以 etcd 中的配置为准。 +> - 如果在现有 TiDB 集群中启用 PD 微服务模式,PD 微服务的部分配置会沿用 PD 的配置并持久化到 etcd 中,后续将以 etcd 中的配置为准。 +> - 因此,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 微服务首次启动之后均不再支持通过配置参数进行修改。 + +#### 配置 TiProxy 配置参数 + +你可以通过 TidbCluster CR 的 `spec.tiproxy.config` 来配置 TiProxy 配置参数。 + +```yaml +spec: + tiproxy: + config: | + [log] + level = "info" +``` + +获取所有可以配置的 TiProxy 配置参数,请参考 [TiProxy 配置文档](https://docs.pingcap.com/zh/tidb/stable/tiproxy-configuration)。 + +>>>>>>> c0cb1959 (add-tikv-config: add `max-days` and `max-backups` (#2777)) #### 配置 TiFlash 配置参数 你可以通过 TidbCluster CR 的 `spec.tiflash.config` 来配置 TiFlash 配置参数。 From e23d9e51225a462bdc6e38fe191e327f48bd2080 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Wed, 4 Jun 2025 17:41:34 +0800 Subject: [PATCH 2/3] Update configure-a-tidb-cluster.md --- en/configure-a-tidb-cluster.md | 55 ---------------------------------- 1 file changed, 55 deletions(-) diff --git a/en/configure-a-tidb-cluster.md b/en/configure-a-tidb-cluster.md index 4ed910f1dc..d90ac4dcbd 100644 --- a/en/configure-a-tidb-cluster.md +++ b/en/configure-a-tidb-cluster.md @@ -381,61 +381,6 @@ For all the configurable parameters of PD, refer to [PD Configuration File](http > - 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. > - 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. -<<<<<<< HEAD -======= -##### Configure PD microservices - -> **Note:** -> -> Starting from v8.0.0, PD supports the [microservice mode](https://docs.pingcap.com/tidb/dev/pd-microservices) (experimental). - -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: - -```yaml -spec: - pd: - mode: "ms" - pdms: - - name: "tso" - baseImage: pingcap/pd - replicas: 2 - config: | - [log.file] - filename = "/pdms/log/tso.log" - - name: "scheduling" - baseImage: pingcap/pd - replicas: 1 - config: | - [log.file] - filename = "/pdms/log/scheduling.log" -``` - -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). - -> **Note:** -> -> - 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. -> - 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. -> - 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. -> - 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. - -#### Configure TiProxy parameters - -TiProxy parameters can be configured by `spec.tiproxy.config` in TidbCluster Custom Resource. - -For example: - -```yaml -spec: - tiproxy: - config: | - [log] - level = "info" -``` - -For all the configurable parameters of TiProxy, refer to [TiProxy Configuration File](https://docs.pingcap.com/tidb/stable/tiproxy-configuration). - ->>>>>>> c0cb1959 (add-tikv-config: add `max-days` and `max-backups` (#2777)) #### Configure TiFlash parameters TiFlash parameters can be configured by `spec.tiflash.config` in TidbCluster Custom Resource. From 8b72fbdddbbb152923ba192f1a305f829a89762c Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Wed, 4 Jun 2025 17:42:06 +0800 Subject: [PATCH 3/3] Update configure-a-tidb-cluster.md --- zh/configure-a-tidb-cluster.md | 53 ---------------------------------- 1 file changed, 53 deletions(-) diff --git a/zh/configure-a-tidb-cluster.md b/zh/configure-a-tidb-cluster.md index 617db39a0e..df8893161c 100644 --- a/zh/configure-a-tidb-cluster.md +++ b/zh/configure-a-tidb-cluster.md @@ -372,59 +372,6 @@ spec: > - 为了兼容 `helm` 部署,如果你是通过 CR 文件部署 TiDB 集群,即使你不设置 Config 配置,也需要保证 `Config: {}` 的设置,从而避免 PD 组件无法正常启动。 > - PD 部分配置项在首次启动成功后会持久化到 etcd 中且后续将以 etcd 中的配置为准。因此 PD 在首次启动后,这些配置项将无法再通过配置参数来进行修改,而需要使用 SQL、pd-ctl 或 PD server API 来动态进行修改。目前,[在线修改 PD 配置](https://docs.pingcap.com/zh/tidb/stable/dynamic-config#在线修改-pd-配置)文档中所列的配置项中,除 `log.level` 外,其他配置项在 PD 首次启动之后均不再支持通过配置参数进行修改。 -<<<<<<< HEAD -======= -##### 配置 PD 微服务 - -> **注意:** -> -> PD 从 v8.0.0 版本开始支持[微服务模式](https://docs.pingcap.com/zh/tidb/dev/pd-microservices)(实验特性)。 - -你可以通过 TidbCluster CR 的 `spec.pd.mode` 与 `spec.pdms` 来配置 PD 微服务参数。目前 PD 支持 `tso` 和 `scheduling` 这两个微服务,配置示例如下: - -```yaml -spec: - pd: - mode: "ms" - pdms: - - name: "tso" - baseImage: pingcap/pd - replicas: 2 - config: | - [log.file] - filename = "/pdms/log/tso.log" - - name: "scheduling" - baseImage: pingcap/pd - replicas: 1 - config: | - [log.file] - filename = "/pdms/log/scheduling.log" -``` - -其中,`spec.pdms` 用于配置 PD 微服务,具体的配置参数与 `spec.pd.config` 相同。要获取 PD 微服务可配置的所有参数,请参考 [PD 配置文件描述](https://docs.pingcap.com/zh/tidb/stable/pd-configuration-file)。 - -> **注意:** -> -> - 为了兼容 `helm` 部署,如果你的 TiDB 集群是通过 CR 文件部署的,即使你不设置 `config` 配置,也需要保证 `config: {}` 的设置,避免 PD 微服务组件无法正常启动。 -> - 如果在部署 TiDB 集群时就启用了 PD 微服务模式,PD 微服务的部分配置项会持久化到 etcd 中且后续将以 etcd 中的配置为准。 -> - 如果在现有 TiDB 集群中启用 PD 微服务模式,PD 微服务的部分配置会沿用 PD 的配置并持久化到 etcd 中,后续将以 etcd 中的配置为准。 -> - 因此,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 微服务首次启动之后均不再支持通过配置参数进行修改。 - -#### 配置 TiProxy 配置参数 - -你可以通过 TidbCluster CR 的 `spec.tiproxy.config` 来配置 TiProxy 配置参数。 - -```yaml -spec: - tiproxy: - config: | - [log] - level = "info" -``` - -获取所有可以配置的 TiProxy 配置参数,请参考 [TiProxy 配置文档](https://docs.pingcap.com/zh/tidb/stable/tiproxy-configuration)。 - ->>>>>>> c0cb1959 (add-tikv-config: add `max-days` and `max-backups` (#2777)) #### 配置 TiFlash 配置参数 你可以通过 TidbCluster CR 的 `spec.tiflash.config` 来配置 TiFlash 配置参数。