# [Known Issues] TiUP 配置 Drainer 参数错误导致无法启动

## Key Words

TiUP, Drainer 配置

## Description

使用 TiUP 配置 Drainer 后启动失败

```sql
Error: failed to restart: 172.x.x.136 drainer-19249.service, please check the instance's log(/home/tidbryl/tidb-deploy/drainer-19249/log) for more detail.: timed out waiting for port 19249 to be started after 2m0s
```

## Root Cause

查看 TiUP edit-config 中配置错误，tbl-name 前多配置了 '-' 

```sql
syncer.replicate-do-table:
    - db-name: test
      tbl-name: test
    - db-name: test1
    - tbl-name: test1
```

## Diagnostic Steps

1.在 <deploy_dir>/log 目录查看 drainer.log 和  drainer_stderr.log 日志中无明显报错信息  
2.查看 <deploy_dir>/scripts/run_drainer.sh 脚本, 手工单独执行, 看到具体报错信息，举例

```sql
[FATAL] [main.go:39] ["verifying flags failed, See 'drainer --help'."] [error="empty table name in `replicate-do-table` config"] [errorVerbose="empty table name in `replicate-do-table` config\ngithub.com/pingcap/tidb-binlog/drainer.(*Config).validateFilter\n\t/home/jenkins/agent/workspace/build-linux-amd64-4.0/go/src/github.com/pingcap/tidb-binlog/drainer/config.go:364\ngithub.com/pingcap/tidb-binlog/drainer.(*Config).validate\n\t/home/jenkins/agent/workspace/build-linux-amd64-4.0/go/src/github.com/pingcap/tidb-binlog/drainer/config.go:409\ngithub.com/pingcap/tidb-binlog/drainer.(*Config).Parse\n\t/home/jenkins/agent/workspace/build-linux-amd64-4.0/go/src/github.com/pingcap/tidb-binlog/drainer/config.go:319\nmain.main\n\t/home/jenkins/agent/workspace/build-linux-amd64-4.0/go/src/github.com/pingcap/tidb-binlog/cmd/drainer/main.go:38\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:203\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1357"] [stack="github.com/pingcap/log.Fatal\n\t/go/pkg/mod/github.com/pingcap/log@v0.0.0-20200117041106-d28c14d3b1cd/global.go:59\nmain.main\n\t/home/jenkins/agent/workspace/build-linux-amd64-4.0/go/src/github.com/pingcap/tidb-binlog/cmd/drainer/main.go:39\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:203"]
```

3.根据提示查看 <deploy_dir>/conf/drainer.toml 文件, 发现 replicate-do-table 配置不正确

```sql
[syncer.replicate-do-table]]
db-name = "test"
tbl-name = "test"

[[syncer.replicate-do-table]]
db-name = "test1"

[[syncer.replicate-do-table]]
tbl-name = "test1"
```

4.查看 TiUP edit-config 中配置错误，tbl-name 前多配置了 '-' 

```sql
TiUP cluster edit-config <cluster-name>

syncer.replicate-do-table:
    - db-name: test
      tbl-name: test
    - db-name: test1
    - tbl-name: test1
```

## Resolution

1.删除多余的 '-' 配置后，重新 reload 节点，可以成功启动 drainer 

```sql
TiUP cluster edit-config <cluster-name>

syncer.replicate-do-table:
    - db-name: test
      tbl-name: test
    - db-name: test1
      tbl-name: test1

TiUP cluster reload <cluster-name> -N <nodeid>
```