欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

datax分页批量同步数据

程序员文章站 2022-07-13 08:58:30
...

[[email protected] job]# cat test.sh
#!/bin/bash

v_table=‘aa’
let v_split_num=300000
let v_start_num=0
let v_end_num=0
v_table_list=’/opt/datax/job/table_name.txt’
v_table_name=’’
v_exec_command=’/opt/datax/bin/datax.py’
v_path_json=’/opt/datax/job/mysqltest.json’
for table_name in cat $v_table_list
do
v_table_name=echo $table_name|awk -F ":" '{print $1}'
let v_total_num=echo $table_name|awk -F ":" '{print $2}'
v_pages=((((((vtotalnum/v_total_num/v_split_num))+1))
for ((i=1;i<=vpages;i++))dovstartnum=v_pages;i++)) do v_start_num=((((((i-1))*vsplitnum))vendnum=v_split_num)) v_end_num=((ii*v_split_num))

    $v_exec_command -p "-Dtable_name=${v_table_name} -Dstart_rowid=${v_start_num} -Dend_rowid=${v_end_num}" $v_path_json

   # echo $v_table_name,$v_start_num,$v_end_num

done

done

相关标签: 数据库迁移