Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions command-line-flags-for-tidb-configuration.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
title: TiDB 配置参数
title: TiDB 命令行参数
aliases: ['/docs-cn/dev/command-line-flags-for-tidb-configuration/','/docs-cn/dev/reference/configuration/tidb-server/configuration/']
summary: TiDB 配置参数包括启动参数和环境变量。启动参数包括 advertise-address、config、config-check、config-strict、cors 等。其中默认端口为 4000 和 10080。其他参数包括 log-file、metrics-addr、metrics-interval 等。注意配置文件的有效性和安全模式下的启动。
---

# TiDB 配置参数
# TiDB 命令行参数

本文将详细介绍 TiDB 的命令行启动参数。TiDB 的默认端口为 4000(客户端请求)与 10080(状态报告)。

在启动 TiDB 时,你可以使用命令行参数或环境变量来配置 TiDB。

要快速了解 TiDB 的参数体系与参数作用域,建议先观看下面的培训视频(时长 17 分钟)。

<video src="https://docs-download.pingcap.com/media/videos/docs-cn%2FLesson10_config.mp4" width="600px" height="450px" controls="controls" poster="https://docs-download.pingcap.com/media/videos/docs-cn/poster_lesson10.png"></video>

本文将详细介绍 TiDB 的命令行启动参数。TiDB 的默认端口为 4000(客户端请求)与 10080(状态报告)。

## `--advertise-address`

+ 登录 TiDB 的 IP 地址
Expand All @@ -24,29 +24,34 @@ summary: TiDB 配置参数包括启动参数和环境变量。启动参数包括

+ 配置文件
+ 默认:""
+ 如果你指定了配置文件,TiDB 会首先读取配置文件的配置。如果对应的配置在命令行参数里面也存在,TiDB 就会使用命令行参数的配置来覆盖配置文件中的配置。详细的配置项请参阅 [TiDB 配置文件描述](/tidb-configuration-file.md)
+ 如果你指定了配置文件,TiDB 会先读取配置文件的配置。如果对应的配置在命令行参数里面也存在,TiDB 就会使用命令行参数的配置来覆盖配置文件中的配置。

## `--config-check`

- 检查配置文件的有效性并退出
- 检查配置文件有效性并退出。详细的配置项请参阅 [TiDB 配置文件描述](/tidb-configuration-file.md)。
- 默认:false

## `--config-strict`

- 增强配置文件的有效性
- 增强配置文件有效性。详细的配置项请参阅 [TiDB 配置文件描述](/tidb-configuration-file.md)。
- 默认:false

## `--cors`

+ 用于设置 TiDB HTTP 状态服务的 Access-Control-Allow-Origin
+ 默认:""

## `--host`
## `--hosts`

+ TiDB 服务监听的 host
+ TiDB 服务监听的 hosts
+ 默认:"0.0.0.0"
+ 0.0.0.0 默认会监听所有的网卡地址。如果有多块网卡,可以指定对外提供服务的网卡,如 192.168.100.113

## `--file`

+ 用于指定 TiDB 服务监听的文件
+ 默认:""

## `--initialize-insecure`

- 在不安全模式下启动 tidb-server
Expand All @@ -62,6 +67,11 @@ summary: TiDB 配置参数包括启动参数和环境变量。启动参数包括
- 用于指定 TiDB 集群初次启动时执行的 SQL 脚本。参考[配置项 `initialize-sql-file`](/tidb-configuration-file.md#initialize-sql-file-从-v660-版本开始引入)
- 默认:""

## `--initialize-sql`

+ 用于指定 TiDB 集群初次启动时执行的 SQL 语句
+ 默认:""

## `-L`

+ Log 级别
Expand Down Expand Up @@ -163,12 +173,6 @@ summary: TiDB 配置参数包括启动参数和环境变量。启动参数包括
+ 默认:true
+ 值可以为 `true` 或者 `false`。设置为 `true` 表明自身会运行 DDL;设置为 `false` 表明自身不会运行 DDL

## `--socket string`

+ TiDB 服务使用 unix socket file 方式接受外部连接
+ 默认:""
+ 例如可以使用 "/tmp/tidb.sock" 来打开 unix socket file

## `--status`

+ TiDB 服务状态监听端口
Expand Down
28 changes: 26 additions & 2 deletions pd-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,21 @@ pd-server 相关配置项。
+ 控制单个 store 最多同时接收或发送的 snapshot 数量,调度受制于这个配置来防止抢占正常业务的资源。
+ 默认:64

### `min-snapshot-rate`

+ 控制单个 store 最少同时接收或发送的 snapshot 数量,调度受制于这个配置来防止抢占正常业务的资源。
+ 默认:10

### `min-pending-peer-count`

+ 控制单个 store 最少同时接收或发送的 pending peer 数量。
+ 默认:10

### `min-pending-learner-count`

+ 控制单个 store 最少同时接收或发送的 pending learner 数量。
+ 默认:10

### `max-pending-peer-count`

+ 控制单个 store 的 pending peer 上限,调度受制于这个配置来防止在部分节点产生大量日志落后的 Region。
Expand Down Expand Up @@ -570,8 +585,17 @@ PD 中内置的 [Resource Control](/tidb-resource-control-ru-groups.md) 相关
+ 默认值: 1/1024
+ 1 RU = 1 KiB 写入字节

#### `read-cpu-ms-cost`
#### `read-cpu-ms-cost-pu`

+ CPU 转换成 RU 的基准系数
+ 默认值: 1/3
+ 1 RU = 3 毫秒 CPU 时间
+ 1 RU = 3 毫秒 CPU 时间

#### `read-per-batch-base-cost`

+ 每次读请求转换成 RU 的基准系数
+ 默认值: 0.5

### `write-cpu-ms-cost`

+ 对于写操作,CPU 转换成 RU 的基准系数
10 changes: 5 additions & 5 deletions tso-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ TSO 节点用于提供 PD 的 `tso` 微服务。本文档仅在 PD 开启微服

安全相关配置项。

### `cacert-path`
### `cert-path`

- CA 文件路径
- 包含 X.509 证书的 PEM 文件路径
- 默认值:""

### `cert-path`
### `cacert-path`

- 包含 X.509 证书的 PEM 文件路径
- CA 文件路径
- 默认值:""

### `key-path`
Expand Down Expand Up @@ -127,7 +127,7 @@ TSO 节点用于提供 PD 的 `tso` 微服务。本文档仅在 PD 开启微服

## metric

监控相关的配置项
`metric` 相关的配置项

### `interval`

Expand Down
Loading