pump/Drainer/binlogctl安装部署问题

背景:已使用tiup安装部署tidb4.0.6 的tidb/pd/tikv

问题1:现在需要部署pump/Drainer 同步tidb中单个库aa到下游mysql的bb库,已使用tiup增加组件pump,现在我想知道如何配置部署Drainer ,让tidb中的aa库同步到bb库?

问题2:binlogctl在官方文档中给出的地址下载binlogctl,压缩包中并无binlogctl

tiup ctl binlog --help

tidb-binlog 由 pump 和 drainer 组成,
drainer 的扩容建议和 pump 一起进行,如果 tidb 产生的 binglog 较大,pump gc time 默认是 7 天,会产生大量的 log 占用磁盘空间。(数据量较小可以忽略)

drainer 的 scale 和 pump 一样,tiup scale drainer 可以看下

  1. tiup/examples/topology.example.yaml at dfab8de58610eb790c45e42686a4dbeb316a6e2f · pingcap/tiup · GitHub
  2. https://docs.pingcap.com/zh/tidb/stable/tidb-binlog-configuration-file#drainer

–编辑drainer配置文件
vi scale-out-drainer.yaml

drainer_servers:

  • host: tiserver_ip
    port: 8249
    data_dir: “/data1/tidb-data/drainer-8249”
    initial_commit_ts: 等全量数据导入mysql之后的TS
    deploy_dir: “/data1/tidb-deploy/drainer-8249”
    config:
    syncer.db-type: “mysql”
    syncer.to.host: "mysql_ip"
    syncer.to.user: “mysql_user
    syncer.to.password: “mysql_pw
    syncer.to.port: 3306
    syncer.replicate-do-db: [“bb”]

–扩容部署drainer
tiup cluster scale-out tidb-test scale-out-drainer.yaml

以上是配置文件,但是我不知道,怎么配置tidb下的aa库,同步到下游mysql的bb库?

你好,

tidb-binlog 组件不支持此功能

那如果正常使用 我上面的配置没问题吧

可以的,默认过滤系统数据库,进行增量复制

drainer_servers:
  - host: xxx
    port: 8249
    data_dir: "/data1/tidb-data/drainer-8249"
    initial_commit_ts: xxxx
    deploy_dir: "/data1/tidb-deploy/drainer-8249"
    config:
      syncer.db-type: "mysql"
      syncer.to.host: "xxx"
      syncer.to.user: "xxx"
      syncer.to.password: "xxx"
      syncer.to.port: 3306
      syncer.replicate-do-db: ["xxx"]
[syncer.to.checkpoint]
    type: "mysql"
    schema: "xxx"
    host: "xxx"
    user: "xxx"
    password: "xxx"
    port: 3306

[syncer.relay]
log-dir = "/data1/relay_log"

[tidb@tidbpd data1]$ tiup cluster scale-out tidb-test scale-out-drainer.yaml
Starting component cluster: /home/tidb/.tiup/components/cluster/v1.1.2/tiup-cluster scale-out tidb-test scale-out-drainer.yaml

Error: Failed to parse topology file scale-out-drainer.yaml (topology.parse_failed)
caused by: yaml: line 16: could not find expected ':'

Please check the syntax of your topology file scale-out-drainer.yaml and try again.
Error: run /home/tidb/.tiup/components/cluster/v1.1.2/tiup-cluster (wd:/home/tidb/.tiup/data/SBqccxt) failed: exit status 1

其中 checkpoint部分写成以下格式,也报同样的错误
[syncer.to.checkpoint]
type = “mysql”
schema = “xxx”
host = “xxx”
user = “xxx”
password = “xxx”
port = 3306

你好,麻烦将 [syncer.to.checkpoint] 和 [syncer.relay] 都放到 config 下面再试下呢?

drainer_servers:
  - host: xxx
    port: 8249
    data_dir: "/data1/tidb-data/drainer-8249"
    initial_commit_ts: xxxx
    deploy_dir: "/data1/tidb-deploy/drainer-8249"
    config:
      syncer.db-type: "mysql"
      syncer.to.host: "xxx"
      syncer.to.user: "xxx"
      syncer.to.password: "xxx"
      syncer.to.port: 3306
      syncer.replicate-do-db: ["xxx"]
      syncer.to.checkpoint.type: "mysql"
      syncer.to.checkpoint.schema: "xxx"
      syncer.to.checkpoint.host: "xxx"
      syncer.to.checkpoint.user: "xxx"
      syncer.to.checkpoint.password: "xxx"
      syncer.to.checkpoint.port: 3306
      syncer.relay.log-dir: "/data1/relay_log"
1 个赞

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。