# 练习 2: 修改集群配置

## 练习目的
+ 在这个练习中，我们会使用 `tiup config` 和 `tiup reload` 修改所有 TiKV 节点的配置，我们修改的配置参数名为 `log-level`，其默认值为 `info`，我们将其修改为 `warning`。 


## 先决条件
+ 注意，您的练习环境（包括 IP，端口号，用户名，密码和目录）可能和本练习不同。
+ 可以连接到实验用虚拟机。
+ TiDB 数据库已经部署完毕。


1. 进入 TiKV server，打开配置文件，一般位置为 `/tidb-deploy/tikv-20160/conf` (注意: `tikv-20160` 可能不同)，打开 `tikv.toml` 文件.
```
$ vi tikv.toml
```


2. 进入到安装 TiUP 的中控机或者节点，在配置文件编辑以下内容.
```
$ tiup cluster edit-config tidb-test
```
```
server_configs:
 tidb: {}
 tikv:
 log-level: warning
```


3. 使用 `tiup cluster reload` 命令来载入修改的参数 (这一步会重启所有 TiKV 节点)
```
$ tiup cluster reload tidb-test
```


4. 再次进入 TiKV server，打开配置文件，一般位置为 `/tidb-deploy/tikv-20160/conf` (注意: `tikv-20160` 可能不同)，打开文件 `tikv.toml`，发现 `log-level = "warning"` 配置已经被持久化到配置文件中.
```
$ vi tikv.toml
```

## 步骤 1 输出样例
```
# WARNING: This file is auto-generated. Do not edit! All your modification will be overwritten!
# You can use 'tiup cluster edit-config' and 'tiup cluster reload' to update the configuration
# All configuration items you want to change can be added to:
# server_configs:
#   tikv:
#     aa.b1.c3: value
#     aa.b2.c4: value
```


## 步骤 4 输出样例
```
# WARNING: This file is auto-generated. Do not edit! All your modification will be overwritten!
# You can use 'tiup cluster edit-config' and 'tiup cluster reload' to update the configuration
# All configuration items you want to change can be added to:
# server_configs:
#   tikv:
#     aa.b1.c3: value
#     aa.b2.c4: value
log-level = "warning"
```