File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ echo \$(mpstat 1 1 |grep "Average:" | awk '{print "远端-CPU空闲率 "\$NF}');
105105echo '远端-导出文件数量 '\$ (ls -al /tmp/dump-import-ssh-temp/*/*.md5|wc -l);
106106
107107echo '远端-ps有mysqldump的数量 '\$ (ps -ef|grep mysqldump|grep -v grep|wc -l);
108+ date "+%Y-%m-%d %H:%M:%S";
108109sleep 2;
109110
110111done
@@ -326,7 +327,13 @@ BASH
326327 import_table=$( echo $line | awk ' {print $3}' )
327328
328329 echo " 进程数小于最大等待数,异步导入--$db .$import_table " ;
329- time (mysqldump --no-tablespaces --user=" ${DB_USER} " --port=" ${DB_TABLE_PORT} " --password=" ${DB_PASS} " --host=" ${DB_TABLE_HOST} " $DUMP_ARGS $db " $import_table " | pv -L $DUMP_PV | mysql --user=" ${IMPORT_DB_USER} " --password=" ${IMPORT_DB_PASS} " --host=" ${IMPORT_DB_HOST} " $IMPORT_ARGS " $db " ) || echo " 导入失败: $db .$import_table "
330+ for (( retry= 1 ; retry<= 3 ; retry++ )) ; do
331+ error_output=$( time (mysqldump --skip-ssl --no-tablespaces --user=" ${DB_USER} " --port=" ${DB_TABLE_PORT} " --password=" ${DB_PASS} " --host=" ${DB_TABLE_HOST} " $DUMP_ARGS $db " $import_table " | pv -L $DUMP_PV | mysql --skip-ssl --user=" ${IMPORT_DB_USER} " --password=" ${IMPORT_DB_PASS} " --host=" ${IMPORT_DB_HOST} " $IMPORT_ARGS " $db " ) 2>&1 ) && break
332+
333+ echo " 导入失败(第${retry} 次): $db .$import_table "
334+ echo " 执行命令: mysqldump --skip-ssl --no-tablespaces --user=\" ${DB_USER} \" --port=\" ${DB_TABLE_PORT} \" --password=\" ***\" --host=\" ${DB_TABLE_HOST} \" $DUMP_ARGS $db \" $import_table \" | pv -L $DUMP_PV | mysql --skip-ssl --user=\" ${IMPORT_DB_USER} \" --password=\" ***\" --host=\" ${IMPORT_DB_HOST} \" $IMPORT_ARGS \" $db \" "
335+ echo " 错误信息: $error_output "
336+ done
330337 echo $( date " +%Y-%m-%d %H:%M:%S" ) " --导入结束 $db .$import_table " ;
331338 fi
332339 done
335342 done
336343
337344 # 等待当前库的所有表处理完成
338- wait
345+ # wait
339346
340347 echo $db >> /tmp/databases_count.end.log;
341348 sed -i " /$db /d" /tmp/databases_count.log;
You can’t perform that action at this time.
0 commit comments