配置参数
用户可以在/ops/portal/config目录的migrationConfig.properties文件中修改迁移所用参数。
参数优先级:workspace下设置的参数 > 公共空间参数。如果使用的workspace.id和之前存在的workspace.id相同的话将沿用之前的workspace里面的参数,如果不同的话,那么portal将从config文件夹中复制一份配置文件到id对应的workspace下面作为这个任务的配置文件。
参数名称 | 参数说明 |
---|---|
mysql.user.name | mysql数据库用户名 |
mysql.user.password | mysql数据库用户密码 |
mysql.database.host | mysql数据库ip |
mysql.database.port | mysql数据库端口 |
mysql.database.name | mysql数据库名 |
opengauss.user.name | openGauss数据库用户名 |
opengauss.user.password | openGauss数据库用户密码 |
opengauss.database.host | openGauss数据库ip |
opengauss.database.port | openGauss数据库端口 |
opengauss.database.name | openGauss数据库名 |
opengauss.database.schema | openGauss数据库模式名 |
除了配置迁移所用基本参数外,用户还可在指定位置自行配置工具自身的所用参数。但是portal会默认修改工具自身的临时文件和日志位置,并分配部分工具自身所用的端口。用户可自行查看并修改工具的配置文件,默认工具配置文件位置如下表。
注意事项:
- zookeeper默认端口2181、kafka默认端口9092、schema-registry默认端口8081不会自动分配,其余工具均会自动分配端口。用户如果需要修改工具的端口,请不要修改IP。如果需要修改kafka的端口,要注意将kafka的文件中的参数listeners的值修改为PLAINTEXT://localhost:要配置的端口。
- 下表使用${config}代表/ops/portal/config目录,即公共空间配置的参数。
- 下表使用${confluent.path}代表/ops/portal/config目录的toolspath.properties文件里面confluent.path的值。
- 每次创建新的任务时,/ops/portal/config/debezium目录的connect-avro-standalone.properties文件会被自动复制成四份并修改端口。
工具名称 | 配置文件位置 |
chameleon | ${config}/chameleon/config-example.yml |
zookeeper | ${confluent.path}/etc/kafka/zookeeper.properties |
kafka | ${confluent.path}/etc/kafka/server.properties |
schema-registry | ${confluent.path}/etc/schema-registry/schema-registry.properties |
connector-mysql | ${config}/debezium/connect-avro-standalone.properties |
${config}/debezium/mysql-source.properties | |
${config}/debezium/mysql-sink.properties | |
connector-opengauss | ${config}/debezium/connect-avro-standalone.properties |
${config}/debezium/opengauss-source.properties | |
${config}/debezium/opengauss-sink.properties | |
datacheck | ${config}/datacheck/application-source.yml |
${config}/datacheck/application-sink.yml | |
${config}/datacheck/application.yml |
执行迁移计划
portal支持启动多个任务执行不同的迁移计划,但是要求各迁移计划使用的MySQL实例和openGauss数据库互不相同。
启动迁移计划时需要添加参数,这样不同的迁移计划可以根据不同的workspace.id进行区分,如果不添加的话,workspace.id默认值为1。
启动workspace.id为2的全量迁移:
sh gs_rep_portal.sh start_mysql_full_migration 2 &
portal除了支持单项功能的启动与停止,也会提供一些组合的默认计划:
启动workspace.id为2的包括全量迁移和全量校验在内的迁移计划:
sh gs_rep_portal.sh start_plan1 2 &
计划列表
计划名称 | 包括指令 |
---|---|
plan1 | 全量迁移→全量校验 |
plan2 | 全量迁移→全量校验→增量迁移→增量校验 |
plan3 | 全量迁移→全量校验→增量迁移→增量校验→反向迁移 |
增量迁移和反向迁移
增量迁移功能是持续将MySQL端的数据修改同步到openGauss端的功能,而反向迁移功能是持续将openGauss端的数据修改同步到MySQL端的功能,所以二者均不会自动关闭。如果用户想要停止增量迁移功能,需要另开窗口输入指令停止增量迁移功能,反向迁移功能同理。
并且需要注意的是:增量迁移和反向迁移不能同时开启,如果一个计划中包含了增量迁移和反向迁移,那么需要用户手动停止增量迁移,启动反向迁移。用户在停止增量迁移之后到启动反向迁移之前,禁止向openGauss进行作业,否则会导致这之间的数据丢失。
以启动默认计划3为例:
1.在配置好配置文件后输入以下指令启动workspace.id为3的计划plan3:
sh gs_rep_portal.sh start_plan3 3 &
这时portal会自动执行全量迁移→全量校验→增量迁移→增量校验,然后一直处于增量迁移状态(此时增量迁移和增量校验同时运行)。
2.如果用户想要停止增量迁移功能,需要另开窗口输入以下指令停止增量迁移功能:
sh gs_rep_portal.sh stop_incremental_migration 3 &
输入指令后,这个进程会退出,而正在执行计划的workspace.id为3的portal主进程会接收到停止增量迁移的消息,从而停止增量迁移,等待下一步指令。
3.如果用户想要启动反向迁移功能,需要输入以下指令:
sh gs_rep_portal.sh run_reverse_migration 3 &
输入指令后,这个进程会退出,而正在执行计划的workspace.id为3的portal主进程会接收到启动反向迁移的消息,从而启动反向迁移,此时portal一直处于反向迁移状态。
如果想要停止整个迁移计划,请参考下方的“停止计划”小节。
以下为启动迁移计划的指令列表:
启动指令列表
指令名称 | 指令说明 |
---|---|
start_mysql_full_migration | 开始mysql全量迁移 |
start_mysql_incremental_migration | 开始mysql增量迁移 |
start_mysql_reverse_migration | 开始mysql反向迁移 |
start_mysql_full_migration_datacheck | 开始mysql全量校验 |
start_mysql_incremental_migration_datacheck | 开始mysql增量校验 |
start_plan1 | 开始默认计划plan1 |
start_plan2 | 开始默认计划plan2 |
start_plan3 | 开始默认计划plan3 |
start_current_plan | 开始自定义计划 |
show_plans | 显示默认计划 |
show_information | 显示数据库相关信息,包括mysql和openGauss端的数据库名、用户名、密码、ip、端口等 |
stop_plan | 停止计划 |
用户也可以在/ops/portal/config目录的currentPlan文件中自定义迁移计划,但自定义迁移计划需要遵守以下规则:
-
在currentPlan中每行填入一条启动单个迁移任务的指令,如start_mysql_full_migration,start_mysql_incremental_migration等。指令的顺序遵循:
- start_mysql_full_migration
- start_mysql_full_migration_datacheck
- start_mysql_incremental_migration
- start_mysql_incremental_migration_datacheck
- start_mysql_reverse_migration
如果顺序错误则portal报错。
-
增量校验的上一项一定是增量迁移,全量校验的上一项一定是全量迁移。
-
每个单项任务只能添加一次。
停止计划
举例:
在portal正在执行计划的状态下,另开一个窗口输入以下指令可以停止workspace.id为3的任务:
sh gs_rep_portal.sh stop_plan 3 &
输入指令后,这个进程会退出,而正在执行计划的workspace.id为3的portal主进程会接收到停止计划的消息,从而停止计划。
启动多个计划
portal支持同时启动多个计划,但是这些计划的mysql端应该为各不相同的实例,openGauss端应该为各不相同的数据库:
首先修改配置文件,详情见配置参数环节。
使用workspace.id为p1启动第一个迁移计划(这里以启动计划3为例):
sh gs_rep_portal.sh start_plan3 p1 &
然后再次修改配置文件。
使用workspace.id为p2启动第一个迁移计划(这里以启动计划3为例):
sh gs_rep_portal.sh start_plan3 p2 &
这样就启动了多个portal。