Commit be67bf90 authored by 智勇's avatar 智勇

update

parent 84d61369
......@@ -44,8 +44,6 @@ cache_dir=/root/daily_db_backup
echo "prepare to get port"
if [[ $database_name = 'xyqb' ]]; then
# 信用钱包database
# repay v_manifest v_repay 是view类型的
# secure_proxy 表里面的数据需要被同步
sys_table_list='baitiao_merchant baitiao_secure_key channel funding_contract funding_corp loan_product merchant_channel payeco_return_url_info red_packet t_phonenum zmxy_return_url configuration secure_proxy funding_corp_config funding_info_map baitiao_preferential_rule funding_corp_policy'
port='3306'
elif [[ $database_name = 'xyqb_app' ]]; then
......@@ -115,7 +113,7 @@ elif [[ $database_name = 'spider_center' ]]; then
sys_table_list='merchant merchant_config'
port='3312'
elif [[ $database_name = 'silk_road' ]]; then
#
# silk_road
sys_table_list=''
source_db_host='192.168.4.80'
port='9999'
......@@ -137,7 +135,7 @@ elif [[ $database_name = 'user_credit' ]]; then
sys_table_list=''
port='9001'
elif [[ $database_name = 'traffic_distribution' ]]; then
# user_credit
# traffic_distribution
sys_table_list='merchant merchant_carousel merchant_credit merchant_detail merchant_section merchant_sort ppdai_exclude_channel t_module t_module_role t_role t_user t_user_role traffic_channel_banner_ids traffic_channel_ids traffic_channel_sort traffic_infos'
source_db_host='192.168.3.36'
port='3313'
......@@ -146,7 +144,6 @@ elif [[ $database_name = 'traffic_distribution' ]]; then
sys_table_list='merchant merchant_config'
source_db_host='192.168.4.6'
port='7306'
echo "---------------------------"
fi
echo "port is $port"
......
......@@ -25,7 +25,7 @@ echo "CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 CO
echo `pwd`
for entry in ./*
for entry in ./*.sql
do
echo "mysql -h $mysql_host -uqa -pqatest $database_name < $entry"
mysql -h $mysql_host -uqa -pqatest $database_name < $entry
......
......@@ -91,23 +91,25 @@ function db_schema_sync()
sh $work_dir/db_gen_config.sh $source_db_host $source_db_user $source_db_pwd $target_db_host $target_db_user $target_db_pwd $database $config_file_name $db_backup_sub_folders $use_cache
echo "--- Step 2: replace domain name in tables: $database $mysql_host $db_backup_sub_folders ---"
cd $db_backup_sub_folders
file_count=`ls -l *.sql | wc -l`
echo "./*.sql file count is $file_count"
if [ "$file_count" -gt 0 ]; then
echo "--- Step 2: replace domain name in tables: $database $db_backup_sub_folders ---"
echo "--- Step 2: is re_replace_ip: $re_replace_ip ---"
sh $work_dir/db_replace_ip.sh $database $target_db_host $db_backup_sub_folders $re_replace_ip $ip_value
echo "--- Step 3: import basic data from backup file: $database $mysql_host $db_backup_sub_folders ---"
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
#if [ $? != 0 ];then
# echo "db_import.sh error"
# exit -1
#fi
else
echo "--- Skip step 2: replace domain name in tables: $database $db_backup_sub_folders ---"
echo "--- Skip step 3: import basic data from backup file: $database $db_backup_sub_folders ---"
fi
echo "--- Step 4: sync schema: $database $target_db_host ---"
sync_cmd="mss -conf ${config_file_name} -sync"
echo "${sync_cmd}"
$sync_cmd
rm -rf $db_sub_backup_folder
}
function run_sql_file()
......
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