配置流程
pd —> tikv —> tidb-binlog —> tidb —>drainer
注:也是服务启动顺序
pd
导入镜像
docker pull pingcap/pd:latest
启动镜像
docker run -d --name pd \
-p 2379:2379 \
-p 2380:2380 \
-v /etc/localtime:/etc/localtime:ro \
pingcap/pd:latest \
--name="pd" \
--client-urls="http://0.0.0.0:2379" \
--advertise-client-urls="http://172.17.58.145:2379" \
--peer-urls="http://0.0.0.0:2380" \
--advertise-peer-urls="http://172.17.58.145:2380" \
--initial-cluster="pd=http://172.17.58.145:2380"
tikv
导入镜像
docker pull pingcap/tikv:latest
启动镜像
docker run -d --name tikv \
-p 20160:20160 \
--ulimit nofile=1000000:1000000 \
pingcap/tikv:latest \
--addr="0.0.0.0:20160" \
--advertise-addr="172.17.58.145:20160" \
--pd="172.17.58.145:2379"
tidb-binlog
导入镜像
docker pull pingcap/tidb-binlog
启动镜像
docker run --name tidb-binlog -d pingcap/tidb-binlog:latest /pump --pd-urls="http://172.17.58.145:2379"
tidb
导入镜像
docker pull pingcap/tidb
启动镜像
docker run -d --name tidb \
-p 4000:4000 \
-p 10080:10080 \
-v /etc/localtime:/etc/localtime:ro \
pingcap/tidb:latest \
--store=tikv \
--path="172.17.58.145:2379" \
--enable-binlog=true
drainer
进入tidb-binlog镜像
docker exec -it tidb-binlog /bin/sh
添加drainer.toml配置文件
#drainer Configuration.
#the interval time (in seconds) of detect pumps' status
detect-interval = 10
[syncer]
# disable sync these schema
ignore-schemas = "INFORMATION_SCHEMA,PERFORMANCE_SCHEMA,mysql"
# number of binlog events in a transaction batch
txn-batch = 1
# work count to execute binlogs
worker-count = 1
disable-dispatch = false
# safe mode will split update to delete and insert
safe-mode = false
# downstream storage, equal to --dest-db-type
# valid values are "mysql", "pb", "tidb", "flash", "kafka"
#db-type = "mysql"
db-type = "kafka"
# when db-type is kafka, you need to use this to config the down stream kafka, or it will be the same kafka addrs where drainer pull binlog from.
[syncer.to]
kafka-addrs = "172.17.58.146:9092"
kafka-version = "2.11.1"
topic-name = "tidb-zcbus"
配置文件赋权
chmod +x drainer.toml
启动drainer
/drainer -pd-urls=”http://172.17.58.145:2379" -config=drainer.toml &>drainer.log &
文档更新时间: 2021-03-28 03:32 作者:周风磊