Dm同步查询状态时dump报错

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。

  • 【TiDB 版本】:

  • 【问题描述】: { “result”: true, “msg”: “”, “workers”: [ { “result”: true, “worker”: “10.200.25.172:8262”, “msg”: “”, “subTaskStatus”: [ { “name”: “test_task”, “stage”: “Paused”, “unit”: “Dump”, “result”: { “isCanceled”: false, “errors”: [ { “Type”: “UnknownError”, “msg”: “[code=32001:class=dump-unit:scope=internal:level=high] mydumper runs with error: exit status 1. \n\n”, “error”: null } ], “detail”: null }, “unresolvedDDLLockID”: “”, “dump”: {

                  }
              }
          ],
          "relayStatus": {
              "masterBinlog": "(mysql-bin.000003, 154)",
              "masterBinlogGtid": "",
              "relaySubDir": "1bb29810-0b68-11ea-a937-005056970996.000003",
              "relayBinlog": "(mysql-bin.000003, 154)",
              "relayBinlogGtid": "",
              "relayCatchUpMaster": true,
              "stage": "Running",
              "result": null
          },
          "sourceID": "mysql1"
      }
    

    ]

若提问为性能优化、故障排查类问题,请下载脚本运行。全选终端打印结果,并复制粘贴上传。

可以参考官方链接:

我已经修改了WORKER的账号和密码,日志显示还是用root登陆

Worker Configuration.

server-id = 101

source-id = “mysql1”

flavor = “mysql”

enable-gtid = false

#charset of DSN of source mysql/mariadb instance charset = “” meta-dir = “”

[from] host = “10.200.25.172” user = “h3” password = “UA+gKojxlGo6/3eBc3P4fEB10WHopbXzBaU=” port = 3306

#relay log purge strategy [purge] interval = 3600 expires = 0 remain-space = 15 [root@dm2 conf]# pwd /home/tidb/deploy/conf

[2019/11/21 11:56:33.263 +08:00] [WARN] [mydumper.go:161] [“Failed to connect to ip: 10.200.25.172 error: Access denied for user ‘root’@‘dm2’ (using password: NO)”] [task=test_task] [unit=dump] [2019/11/21 11:56:33.264 +08:00] [ERROR] [mydumper.go:164] [“Error connecting to database: Access denied for user ‘root’@‘dm2’ (using password: NO)”] [task=test_task] [unit=dump] [2019/11/21 11:56:33.264 +08:00] [INFO] [mydumper.go:114] [“dump data finished”] [task=test_task] [unit=dump] [“cost time”=46.74601ms] [2019/11/21 11:56:33.264 +08:00] [INFO] [subtask.go:232] [“unit process returned”] [subtask=test_task] [unit=Dump] [stage=Paused] [status={}]

修改之后有重启 DM-worker 吗?看日志读到的还是旧的信息。

有重启DM-WORKER,比如我现在kill DM-WORKER进程,手工启动,也报相同错

[tidb@dm2 log]$ ps -ef|grep dm-worker tidb 20725 20649 0 14:14 pts/3 00:00:00 bin/dm-worker --worker-addr=:8262 -L=info --relay-dir=/home/tidb/deploy/relay_log --config=conf/dm-worker.toml --log-file=/home/tidb/deploy/log/dm-worker.log tidb 20827 20649 0 14:16 pts/3 00:00:00 grep --color=auto dm-worker [tidb@dm2 log]$ kill -9 20725 [tidb@dm2 log]$ bin/dm-worker --worker-addr=:8262 -L=info --relay-dir=/home/tidb/deploy/relay_log --config=conf/dm-worker.toml --log-file=/home/tidb/deploy/log/dm-worker.log & [2] 20836 -bash: bin/dm-worker: No such file or directory [1] Killed bin/dm-worker --worker-addr=:8262 -L=info --relay-dir=/home/tidb/deploy/relay_log --config=conf/dm-worker.toml --log-file=/home/tidb/deploy/log/dm-worker.log (wd: ~/deploy) (wd now: ~/deploy/log) [tidb@dm2 log]$ [2]+ Exit 127 bin/dm-worker --worker-addr=:8262 -L=info --relay-dir=/home/tidb/deploy/relay_log --config=conf/dm-worker.toml --log-file=/home/tidb/deploy/log/dm-worker.log [tidb@dm2 log]$ [tidb@dm2 log]$ [tidb@dm2 log]$ [tidb@dm2 log]$ cd … [tidb@dm2 deploy]$ bin/dm-worker --worker-addr=:8262 -L=info --relay-dir=/home/tidb/deploy/relay_log --config=conf/dm-worker.toml --log-file=/home/tidb/deploy/log/dm-worker.log

[2019/11/21 14:17:16.478 +08:00] [WARN] [mydumper.go:161] [“Failed to connect to ip: 10.200.25.172 error: Access denied for user ‘root’@‘dm2’ (using password: NO)”] [task=test_task] [unit=dump] [2019/11/21 14:17:16.478 +08:00] [ERROR] [mydumper.go:164] [“Error connecting to database: Access denied for user ‘root’@‘dm2’ (using password: NO)”] [task=test_task] [unit=dump] [2019/11/21 14:17:16.478 +08:00] [INFO] [mydumper.go:114] [“dump data finished”] [task=test_task] [unit=dump] [“cost time”=47.589957ms] [2019/11/21 14:17:16.478 +08:00] [INFO] [subtask.go:232] [“unit process returned”] [subtask=test_task] [unit=Dump] [stage=Paused] [status={}] [2019/11/21 14:17:16.478 +08:00] [ERROR] [subtask.go:251] [“unit process error”] [subtask=test_task] [unit=Dump] [“error information”="{“msg”:"[code=32001:class=dump-unit:scope=internal:level=high] mydumper runs with error: exit status 1. “}”]

是不是读取的是 backup里面的配置文件 [root@dm2 ~]# locate dm-worker /etc/systemd/system/dm-worker-8262.service /home/tidb/deploy/backup/dm-worker.toml.17435.2019-11-21@11:04:51~ /home/tidb/deploy/backup/dm-worker.toml.28249.2019-11-20@14:01:45~

检查下当时配置的环境吧 感觉是哪里有遗漏,没有全部修改掉。

我又重新部署了下 [tidb@dm1 bin]$ cd /home/tidb/dm-ansible/resources/bin && ./dmctl -encrypt hydeesoft L1OBWkYoi2v7i9l3NqouLEBLGMcScLN7fSs=

[tidb@dm2 conf]$ cat dm-worker.toml

Worker Configuration.

server-id = 101

source-id = “mysql1”

flavor = “mysql”

enable-gtid = false

#charset of DSN of source mysql/mariadb instance charset = “” meta-dir = “”

[from] host = “10.200.25.172” user = “h3” password = “L1OBWkYoi2v7i9l3NqouLEBLGMcScLN7fSs=” port = 3306

#relay log purge strategy [purge] interval = 3600 expires = 0 remain-space = 15

我登陆是正常的 [root@tidb1 ~]# mysql -uh3 -P3306 -h 10.200.25.172 -phydeesoft Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 515 Server version: 5.7.28-log MySQL Community Server (GPL)

Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MySQL [(none)]>

但是还是提示密码错误

[2019/11/21 15:17:17.630 +08:00] [WARN] [mydumper.go:161] [“Failed to connect to ip: 10.200.25.172 error: Access denied for user ‘h3’@‘dm2’ (using password: NO)”] [task=test_task] [unit=dump] [2019/11/21 15:17:17.630 +08:00] [ERROR] [mydumper.go:164] [“Error connecting to database: Access denied for user ‘h3’@‘dm2’ (using password: NO)”] [task=test_task] [unit=dump] [2019/11/21 15:17:17.630 +08:00] [INFO] [mydumper.go:114] [“dump data finished”] [task=test_task] [unit=dump] [“cost time”=47.31297ms] [2019/11/21 15:17:17.630 +08:00] [INFO] [subtask.go:232] [“unit process returned”] [subtask=test_task] [unit=Dump] [stage=Paused] [status={}]

稍等,我看下

而且每次加密结果都不一样 [tidb@dm1 bin]$ cd /home/tidb/dm-ansible/resources/bin && \

./dmctl -encrypt 123456 lmIDZoz5CQNwGjh+oNRWJkCiep0Ur+E= [tidb@dm1 bin]$ cd /home/tidb/dm-ansible/resources/bin &&
./dmctl -encrypt 123456 m0Y9UYlxnd+VWbNAVX3sTEA3OBwuCCE= [tidb@dm1 bin]$ cd /home/tidb/dm-ansible/resources/bin &&
./dmctl -encrypt 123456 YRSIs1goVSt1Nw8MNWzPokDxHNHg3eU= [tidb@dm1 bin]$ cd /home/tidb/dm-ansible/resources/bin &&
./dmctl -encrypt 123456 7b2yJJgbQGzdwIbsazFWvEC2Hok9Mmw=

在 dm-worker 的机器上使用账号密码登录上游数据库试试,应该是 [tidb@dm2 conf] 或者 [tidb@dm1 bin] 机器吧。

在DM2上登陆是正常的 [root@dm2 ~]# mysql -uh3 -P3306 -phydeesoft mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 578 Server version: 5.7.28-log MySQL Community Server (GPL)

Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

[root@dm2 ~]# mysql -uh3 -P3306 -phydeesoft -h10.200.25.172 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 579 Server version: 5.7.28-log MySQL Community Server (GPL)

Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

任务配置中的用户名密码检查一下,另外,用户是否按照官网赋予对应权限。

我想问下这个密码可以用明文吗password = “L1OBWkYoi2v7i9l3NqouLEBLGMcScLN7fSs=”

不可以,必须加密。

那个加密后的密码为什么一直变 ./dmctl -encrypt 123456 lmIDZoz5CQNwGjh+oNRWJkCiep0Ur+E= [tidb@dm1 bin]$ cd /home/tidb/dm-ansible/resources/bin && ./dmctl -encrypt 123456 m0Y9UYlxnd+VWbNAVX3sTEA3OBwuCCE= [tidb@dm1 bin]$ cd /home/tidb/dm-ansible/resources/bin && ./dmctl -encrypt 123456 YRSIs1goVSt1Nw8MNWzPokDxHNHg3eU= [tidb@dm1 bin]$ cd /home/tidb/dm-ansible/resources/bin && ./dmctl -encrypt 123456 7b2yJJgbQGzdwIbsazFWvEC2Hok9Mmw=

这个有没有影响

没影响,解密之后都是一样的明文密码。