1、
编辑配置文件
[root@mysql-4 ~]# cat scale-out-binlog.yaml
pump_servers:
- host: 172.16.1.12
drainer_servers:
- host: 172.16.1.12
config:
syncer.db-type: "mysql"
syncer.to.host: "172.16.1.10"
syncer.to.user: "root"
syncer.to.password: "c123456"
syncer.to.port: 3306
1.1
扩容一个pump节点和drainer节点,在tidb集群内部署命令。
tiup cluster scale-out tidb-test scale-out-binlog.yaml -uroot -p
2.在tidb和mysql之间都创建t1表,并写入一条数据
create table t1(id int primary key,name varchar(200));
insert into t1 values(1,'ccc');
3、扩容
tiup cluster scale-out tidb-test scale-out-binlog.yaml -uroot -p
4、pmup和drainer工作正常后,开启tidb的binlog
编辑配置文件:tiup cluster edit-config tidb-test
修改如下:
server_configs:
tidb:
binlog.enable: true
binlog.ignore-error: true
5、重新加越配置文件,会重启数据库集群
tiup cluster reload tidb-test
6、登录TIDB数据库查看状态
mysql> show global variables like '%log_bin%';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin | ON |
| log_bin_trust_function_creators | OFF |
| log_bin_use_v1_row_events | 0 |
| ndb_log_binlog_index | |
| sql_log_bin | ON |
+---------------------------------+-------+
都是 online 状态都是正常的。
mysql> show pump status;
+------------------+------------------+--------+--------------------+---------------------+
| NodeID | Address | State | Max_Commit_Ts | Update_Time |
+------------------+------------------+--------+--------------------+---------------------+
| 172.16.1.12:8250 | 172.16.1.12:8250 | online | 436613099512397829 | 2022-10-12 11:53:17 |
+------------------+------------------+--------+--------------------+---------------------+
1 row in set (0.01 sec)
mysql> show drainer status;
+------------------+------------------+--------+--------------------+---------------------+
| NodeID | Address | State | Max_Commit_Ts | Update_Time |
+------------------+------------------+--------+--------------------+---------------------+
| 172.16.1.12:8249 | 172.16.1.12:8249 | online | 436613103457927169 | 2022-10-12 11:53:34 |
+------------------+------------------+--------+--------------------+---------------------+
1 row in set (0.00 sec)
7、源端TIDB写入数据后,在MYSQL中可以正常查询到。
8、缩容节点 pump 和 drainer
tiup cluster scale-in tidb-test --node 172.16.1.12:8249 tiup cluster scale-in tidb-test --node 172.16.1.12:8250 标签:binlog,scale,1.12,mysql,tidb,测试,172.16 From: https://www.cnblogs.com/nanxiang/p/16785883.html