openGauss增量迁移

功能介绍

增量迁移是指将mysql数据迁移期间(包括全量和增量迁移)产生的增量数据迁移至openGauss端。

原理简介

基于开源三方件mysql-binlog-connector-java解析mysql的binlog,并根据mysql主备并行复制的原理,对可并行的事务在openGauss端采用多线程进行并行回放,以实现MySQL到openGauss端的在线迁移。其中并行事务的判断规则为:如果所有正在回放的事务的最小sequence_number大于该事务的last_committed,那么该事务就可以并行执行。该方案可以严格保证事务的顺序和一致性。

特性优势

利用sysbench对mysql进行压测,在10张表30个线程并发情况下,针对IUD混合场景,在Kunpeng-920 2p openEuler机器上测试,整体在线迁移性能可达3w tps。

操作步骤

  • 源码编译
  1. 执行如下命令在代码仓库下载源码。

    ""git clone https://gitee.com/opengauss/openGauss-tools-onlineMigration-mysql.git
    
  2. 修改配置文件。配置文件的路径为openGauss-tools-onlineMigration-mysql/mysql2openGauss/config.yml。

    配置文件示例如下:

    ""#openGauss config
    openGauss_conn:  
      host: "127.0.0.1"  
      port: "5432"  
      user: "opengauss"  
      password: "password123"  
      database: "postgres" 
    
    #mysql config
    mysql_conn:  
      host: "127.0.0.1"  
      port: "3306"  
      user: "mysql"  
      password: "password123"  
      database: "mysql"
    
  3. 编译命令。

    ""cd openGauss-tools-onlineMigration-mysql/mysql2openGauss/
    mvn clean package
    
  4. 运行命令。

    ""java -jar ./target/online-migration-mysql-3.1.0.jar
    
  5. 高性能运行命令。在Kunpeng-920 2p openEuler机器上执行如下命令。

    ""numactl -C 0-31 -m 0 java -Xms15G -Xmx25G -jar ./target/online-migration-mysql-3.1.0.jar
    
  • 二进制运行
  1. 通过如下链接下载压缩包并解压。

    ""https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/tools/online-migration-mysql2openGauss-3.1.0.tar.gz
    tar -zxvf online-migration-mysql2openGauss-3.1.0.tar.gz
    
  2. 修改配置文件。配置文件的路径为online-migration-mysql2openGauss-3.1.0/config.yml。

    配置文件示例如下:

    ""#openGauss config
    openGauss_conn:  
      host: "127.0.0.1"  
      port: "5432"  
      user: "opengauss"  
      password: "password123"  
      database: "postgres" 
    
    #mysql config
    mysql_conn:  
      host: "127.0.0.1"  
      port: "3306"  
      user: "mysql"  
      password: "password123"  
      database: "mysql"
    
  3. 运行命令。

    ""cd online-migration-mysql2openGauss-3.1.0
    java -jar ./online-migration-mysql-3.1.0.jar
    
  4. 高性能运行命令。在Kunpeng-920 2p openEuler机器上执行如下命令。

    ""cd online-migration-mysql2openGauss-3.1.0
    numactl -C 0-31 -m 0 java -Xms15G -Xmx25G -jar ./online-migration-mysql-3.1.0.jar
    

注意事项

  • 当前支持MySQL IUD操作(insert、update、delete)产生的增量数据迁移至openGauss。
  • 支持迁移openGauss数据库兼容的MySQL DDL语句,对于不兼容的DDL,迁移时会报错处理(openGauss在完善对DDL的兼容性)。
  • 为保证事务的顺序和一致性,不支持skip_event, limit_table, skip_table等设置。
  • MySQL需要5.7及以上版本。
  • MySQL参数设置要求为:log_bin=ON, binlog_format=ROW, binlog_row_image=FULL, gtid_mode = ON。
  • 先进行全量迁移,再进行增量迁移,全量迁移可基于chameleon工具完成。
  • 增量迁移支持的数据类型:数值类型(int,tinyint,smallint,mediumint,bigint,float,double,decimal),字符类型(char,varchar,text),时间类型(date,time,datetime,timestamp,year),二进制类型(binary,varbinary,blob)。
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值