Commit d5c4c634 authored by qa_quantgroup's avatar qa_quantgroup
parents d8765f9e 1238ff92
File mode changed from 100644 to 100755
......@@ -67,7 +67,8 @@ elif [[ $database_name = 'dujiangyan' ]]; then
elif [[ $database_name = 'mall' ]]; then
# 白条商城
sys_table_list='activity_3c_product ad_detail admin_banner advertisement_type album app_channel app_channel_ad app_name app_name_ad category category_banner category_nature commodity_slogan commodity_slogan_product configuration edx_city faster_entrance faster_entrance_image goods_after_sale_config goods_after_sale_step home_config home_page hot_category jd_address jd_after_sale_config jd_brand jd_category jd_product_sku_image jd_property jd_sku jd_sku_detail_image jd_sku_specs life_faster_entrance life_service mall_category mall_config merchant nature_value new_3c_product product product_category product_nature product_nature_value_bak product_sku product_sku_image product_specification product_spu recommend_brand recommend_product sale_product_detail sale_product_theme spu_image supplier tab_navigate title_banner loan_config virtual_brand virtual_category virtual_product_discount virtual_product_hot virtual_product_sku virtual_product_spu virtual_product_template'
port='3310'
source_db_host='192.168.3.19'
port='3306'
elif [[ $database_name = 'qinqiong' ]]; then
# qinqiong
sys_table_list='secure_key secure_proxy'
......@@ -113,7 +114,8 @@ elif [[ $database_name = 'redpacket' ]]; then
elif [[ $database_name = 'spider_center' ]]; then
# 授信中心
sys_table_list='merchant merchant_config'
port='3312'
source_db_host='192.168.4.253'
port='3317'
elif [[ $database_name = 'silk_road' ]]; then
# silk_road
sys_table_list=''
......@@ -191,14 +193,14 @@ else
do
file_name=$db_backup_sub_folders/$table_name.sql
echo "mysqldump -u${source_db_user} -p${source_db_pwd} -h${source_db_host} -P${port} $database_name --tables $table_name --where \"1=1 order by id desc limit 1000\"> $file_name"
mysqldump -u${source_db_user} -p${source_db_pwd} -h${source_db_host} -P${port} $database_name --skip-lock-tables --tables $table_name --where "1=1 order by id desc limit 10000" --skip-add-locks > $file_name
mysqldump -u${source_db_user} -p${source_db_pwd} -h${source_db_host} -P${port} $database_name --skip-lock-tables --tables $table_name --where "1=1 order by id desc limit 10000" --skip-add-locks --no-create-info --complete-insert > $file_name
done
else
for table_name in $sys_table_list
do
file_name=$db_backup_sub_folders/$table_name.sql
echo "mysqldump -u${source_db_user} -p${source_db_pwd} -h${source_db_host} -P${port} $database_name --tables $table_name > $file_name"
mysqldump -u${source_db_user} -p${source_db_pwd} -h${source_db_host} -P${port} $database_name --skip-lock-tables --tables $table_name --skip-add-locks > $file_name
mysqldump -u${source_db_user} -p${source_db_pwd} -h${source_db_host} -P${port} $database_name --skip-lock-tables --tables $table_name --skip-add-locks --no-create-info --complete-insert > $file_name
done
fi
fi
......@@ -15,25 +15,16 @@ target_db_port=$5
echo "cd $db_sub_backup_folder"
cd $db_sub_backup_folder
echo "delete_business_data:"$delete_business_data
if [ "$delete_business_data" = "true" ];then
# echo "DROP DATABASE ${database_name};"
# echo "DROP DATABASE ${database_name};" | mysql -h $mysql_host -P $target_db_port -uqa -pqatest
echo "mysql -h $mysql_host -P $target_db_port -uqa -pqatest -e \"DROP DATABASE ${database_name};\""
mysql -h $mysql_host -P $target_db_port -uqa -pqatest -e "DROP DATABASE ${database_name};"
fi
# echo "CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"
# echo "CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" | mysql -h $mysql_host -P $target_db_port -uqa -pqatest
echo "mysql -h $mysql_host -P $target_db_port -uqa -pqatest -e \"CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;\""
mysql -h $mysql_host -P $target_db_port -uqa -pqatest -e "CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"
if [ $? != 0 ];then echo "mysql -h $mysql_host -P $target_db_port -uqa -pqatest -e \"CREATE DATABASE ${database_name}\" error";exit -1; fi
for entry in ./*.sql
for entry in `ls`
do
table_name=${entry%.sql}
echo "mysql -h $mysql_host -P $target_db_port -uqa -pqatest $database_name -e \"truncate $table_name\""
mysql -h $mysql_host -P $target_db_port -uqa -pqatest $database_name -e "truncate $table_name"
echo "mysql -h $mysql_host -P $target_db_port -uqa -pqatest $database_name < $entry"
mysql -h $mysql_host -P $target_db_port -uqa -pqatest $database_name < $entry
if [ $? != 0 ];then
echo "--- mysql -h $mysql_host -P $target_db_port -uqa -pqatest $database_name < $entry import error ---"
exit -1
fi
done
......@@ -65,6 +65,16 @@ function db_schema_sync()
config_file_name="$sync_config_folder/${database}_${uuid}_db_schema_sync_config.json"
db_backup_sub_folders=$db_backup_folder/${uuid}
if [ "$delete_business_data" = "true" ];then
# echo "DROP DATABASE ${database_name};" | mysql -h $mysql_host -P $target_db_port -uqa -pqatest
echo "mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e \"DROP DATABASE ${database};\""
mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e "DROP DATABASE ${database};"
fi
# echo "CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" | mysql -h $mysql_host -P $target_db_port -uqa -pqatest
echo "mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e \"CREATE DATABASE IF NOT EXISTS ${database} DEFAULT CHARSET utf8 COLLATE utf8_general_ci;\""
mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e "CREATE DATABASE IF NOT EXISTS ${database} DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"
if [ $? != 0 ];then echo "mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e \"CREATE DATABASE IF NOT EXISTS ${database}\" error";exit -1; fi
echo "mkdir $db_backup_sub_folders"
mkdir -p $db_backup_sub_folders
mkdir -p $sync_config_folder
......@@ -89,15 +99,16 @@ function db_schema_sync()
echo "--- Skip step 2: replace domain name in tables: $database $db_backup_sub_folders ---"
fi
echo "--- Step 3: import basic data from backup file: $database $db_backup_sub_folders ---"
sh $work_dir/db_import.sh $database $target_db_host $db_backup_sub_folders $delete_business_data $target_db_port
if [ $? != 0 ];then echo "db_import.sh $database error";exit -1; fi
echo "--- Step 4: sync schema: $database $target_db_host ---"
echo "--- Step 3: sync schema: $database $target_db_host ---"
#sync_cmd="mss -conf ${config_file_name} -sync"
echo "mss -conf ${config_file_name} -sync > /dev/null"
mss -conf ${config_file_name} -sync > /dev/null
echo "mysql-schema-sync result:$?"
echo "--- Step 4: import basic data from backup file: $database $db_backup_sub_folders ---"
sh $work_dir/db_import.sh $database $target_db_host $db_backup_sub_folders $delete_business_data $target_db_port
# if [ $? != 0 ];then echo "db_import.sh $database error";exit -1; fi
}
function run_sql_file()
......
......@@ -166,7 +166,7 @@ new pClass().init(1,false, "java", "8051", "msg", "fund_pay", "msg.log", "applic
new pClass().init(1,false, "java", "7052", "xyqb-btzt", "qg-op-backend", "xyqb-btzt.log", "application.properties", "--worker 1 --currentWorker 1 -t -ts ", " ", "白条直投外部", "", "mvn clean package -Ptest -Dmaven.test.skip=true", "");
new pClass().init(1,false, "java", "7053", "xyqb-btzt-internal", "qg-op-backend", "xyqb-btzt-internal.log", "application.properties", "--worker 1 --currentWorker 1 -t -ts ", " ", "白条直投内部", "", "mvn clean package -Ptest -Dmaven.test.skip=true", "");
new pClass().init(1,false, "java", "7060", "baitiao-op-backend", "baitiao", "baitiao-op-backend.log", "application.properties", "--worker 1 --currentWorker 1 -t -ts ", " ", "运营系统服务", "", "mvn clean package -Ptest -Dmaven.test.skip=true", "xyqb-backend/target");
new pClass().init(1,true, "java", "7062", "xyqb-user2-query", "head_group", "xyqb_user_query.log", "application.properties", "--worker 1 --currentWorker 1 -t -ts -Dtest=true ", " ", "用户系统查询服务", "", "mvn clean package -Ptest -Dmaven.test.skip=true", "");
new pClass().init(1,true, "java", "7062", "xyqb-user2-query", "head_group", "xyqb-user2-query.log", "application.properties", "--worker 1 --currentWorker 1 -t -ts -Dtest=true ", " ", "用户系统查询服务", "", "mvn clean package -Ptest -Dmaven.test.skip=true", "");
new pClass().init(2,false, "java", "7063", "qg-op-backend", "traffic.log", "application.properties", "--worker 1 --currentWorker 1 -t -ts ", " ", "流量分发系统", "", "mvn clean package -Ptest -Dmaven.test.skip=true", "");
new pClass().init(1,false, "java", "7017", "silk-road-eureka", "baitiao", "silk-road-eureka.log", "application.properties", "-Denv=dev --worker 1 --currentWorker 1 -t -ts ", "-DLOG_HOME=/home/quant_group/logs ", "通用注册发现服务", "魏巍", "mvn clean package -U -Dmaven.test.skip=true", "");
new pClass().init(1,false, "java", "7027", "silk-road-caller", "baitiao", "silk-road-caller.log", "application.properties", "-Denv=dev --worker 1 --currentWorker 1 -t -ts ", " -DLOG_HOME=/home/quant_group/logs ", "通用消息调用服务", "魏巍", "mvn clean package -U -Dmaven.test.skip=true", "");
......
......@@ -14,7 +14,7 @@ function grep_key_word()
grep_key_word "No space left on device" 1
grep_key_word "Got error: [0-9]\{4\}:" 1
#grep_key_word "ERROR [0-9]\{4\} " 1
grep_key_word "ERROR [0-9]\{4\} " 1
grep_key_word "Can't connect to MySQL server" 1
grep_key_word "show tables failed" 3
#grep_key_word "EXEC_SQL_FAIELD Error [0-9]\{4\}" 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment