Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-deploy-utils
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qa-deploy-utils
Commits
241e9a60
Commit
241e9a60
authored
Feb 11, 2018
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
ecc7ad3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
135 deletions
+141
-135
db_gen_config.sh
db-utils/db_gen_config.sh
+139
-134
db_schema_sync.sh
db-utils/db_schema_sync.sh
+2
-1
No files found.
db-utils/db_gen_config.sh
View file @
241e9a60
...
@@ -10,8 +10,9 @@ source ~/.bash_profile
...
@@ -10,8 +10,9 @@ source ~/.bash_profile
work_dir
=
/home/qa-deploy-utils/db-utils
work_dir
=
/home/qa-deploy-utils/db-utils
source_db_host
=
$1
source_db_host
=
$1
source_db_user
=
$2
source_db_user
=
`
curl
-s
http://192.168.4.3:10088/config_server/get_db_config/cash_loan_flow/user
`
source_db_pwd
=
`
grep
source_db_pwd
$work_dir
/config/db_config |
cut
-d
"="
-f
2
`
source_db_pwd
=
`
curl
-s
http://192.168.4.3:10088/config_server/get_db_config/cash_loan_flow/pwd
`
# source_db_pwd=`grep source_db_pwd $work_dir/config/db_config | cut -d "=" -f 2`
target_db_host
=
$4
target_db_host
=
$4
target_db_user
=
$5
target_db_user
=
$5
...
@@ -44,138 +45,142 @@ cache_dir=/home/daily_db_backup
...
@@ -44,138 +45,142 @@ cache_dir=/home/daily_db_backup
# fi
# fi
echo
"prepare to get source_port"
echo
"prepare to get source_port"
if
[[
$database_name
=
'xyqb'
]]
;
then
# if [[ $database_name = 'xyqb' ]]; then
# 信用钱包database
# # 信用钱包database
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'
# 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'
# port='3306'
elif
[[
$database_name
=
'xyqb_app'
]]
;
then
# elif [[ $database_name = 'xyqb_app' ]]; then
# app-backend使用的数据库
# # app-backend使用的数据库
sys_table_list
=
'activities app_banners app_config app_versions banners blanknote_entries credit_questions hot_games loan_banners loan_questions migrations sharings widgets js_patch upgrade_version'
# sys_table_list='activities app_banners app_config app_versions banners blanknote_entries credit_questions hot_games loan_banners loan_questions migrations sharings widgets js_patch upgrade_version'
port
=
'3307'
# port='3307'
elif
[[
$database_name
=
'payment_center'
]]
;
then
# elif [[ $database_name = 'payment_center' ]]; then
# 支付中心
# # 支付中心
sys_table_list
=
'card_switcher merchant merchant_config pay_approach_config merchant_pay_approach_relation merchant_bank_config quota'
# sys_table_list='card_switcher merchant merchant_config pay_approach_config merchant_pay_approach_relation merchant_bank_config quota'
port
=
'3308'
# port='3308'
elif
[[
$database_name
=
'risk_control'
]]
;
then
# elif [[ $database_name = 'risk_control' ]]; then
# 谛听database
# # 谛听database
sys_table_list
=
'company product_strategy_dispatcher quantify_product red_packet_info user'
# sys_table_list='company product_strategy_dispatcher quantify_product red_packet_info user'
port
=
'3309'
# port='3309'
elif
[[
$database_name
=
'dujiangyan'
]]
;
then
# elif [[ $database_name = 'dujiangyan' ]]; then
# dujiangyan
# # dujiangyan
sys_table_list
=
'external_coopr'
# sys_table_list='external_coopr'
port
=
'3310'
# port='3310'
elif
[[
$database_name
=
'mall'
]]
;
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'
# 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'
source_db_host
=
'192.168.3.19'
# source_db_host='192.168.3.19'
port
=
'3306'
# port='3306'
elif
[[
$database_name
=
'qinqiong'
]]
;
then
# elif [[ $database_name = 'qinqiong' ]]; then
# qinqiong
# # qinqiong
sys_table_list
=
'secure_key secure_proxy'
# sys_table_list='secure_key secure_proxy'
port
=
'3310'
# port='3310'
elif
[[
$database_name
=
'cash_loan_flow'
]]
;
then
# elif [[ $database_name = 'cash_loan_flow' ]]; then
# cash_loan_flow
# # cash_loan_flow
sys_table_list
=
'order_callback callback_configuration channel_configuration filter_configuration'
# sys_table_list='order_callback callback_configuration channel_configuration filter_configuration'
source_db_host
=
'192.168.4.80'
# source_db_host='192.168.4.80'
port
=
'8001'
# port='8001'
elif
[[
$database_name
=
'quartz'
]]
;
then
# elif [[ $database_name = 'quartz' ]]; then
# 定时任务
# # 定时任务
sys_table_list
=
'certain_time_job'
# sys_table_list='certain_time_job'
port
=
'3310'
# port='3310'
elif
[[
$database_name
=
'contract'
]]
;
then
# elif [[ $database_name = 'contract' ]]; then
# 合同
# # 合同
sys_table_list
=
'contract_template_new'
# sys_table_list='contract_template_new'
port
=
'3311'
# port='3311'
elif
[[
$database_name
=
'fund_manage'
]]
;
then
# elif [[ $database_name = 'fund_manage' ]]; then
# fund_manager
# # fund_manager
sys_table_list
=
'business_info email_info fund_info merchant'
# sys_table_list='business_info email_info fund_info merchant'
port
=
'3310'
# port='3310'
elif
[[
$database_name
=
'financial_system'
]]
;
then
# elif [[ $database_name = 'financial_system' ]]; then
# 财务系统
# # 财务系统
sys_table_list
=
'collection_user sys_dictionary sys_status_edge sys_status_vertice'
# sys_table_list='collection_user sys_dictionary sys_status_edge sys_status_vertice'
port
=
'6603'
# port='6603'
elif
[[
$database_name
=
'financial_system_api'
]]
;
then
# elif [[ $database_name = 'financial_system_api' ]]; then
# 财务系统api
# # 财务系统api
sys_table_list
=
'mailinfo'
# sys_table_list='mailinfo'
port
=
'6603'
# port='6603'
elif
[[
$database_name
=
'gyxd'
]]
;
then
# elif [[ $database_name = 'gyxd' ]]; then
# 广源小贷系统
# # 广源小贷系统
sys_table_list
=
'administrative_districts templet user'
# sys_table_list='administrative_districts templet user'
source_db_host
=
'192.168.4.116'
# source_db_host='192.168.4.116'
port
=
'6602'
# port='6602'
elif
[[
$database_name
=
'offline'
]]
;
then
# elif [[ $database_name = 'offline' ]]; then
# 线下白条
# # 线下白条
sys_table_list
=
'goods_detail merchant operator_user'
# sys_table_list='goods_detail merchant operator_user'
port
=
'3311'
# port='3311'
elif
[[
$database_name
=
'redpacket'
]]
;
then
# elif [[ $database_name = 'redpacket' ]]; then
# 红包系统
# # 红包系统
sys_table_list
=
'tb_activity_channel tb_dict_channel tb_dict_out_channel'
# sys_table_list='tb_activity_channel tb_dict_channel tb_dict_out_channel'
source_db_host
=
'192.168.4.116'
# source_db_host='192.168.4.116'
port
=
'6001'
# port='6001'
elif
[[
$database_name
=
'spider_center'
]]
;
then
# elif [[ $database_name = 'spider_center' ]]; then
# 授信中心
# # 授信中心
sys_table_list
=
'merchant merchant_config'
# sys_table_list='merchant merchant_config'
source_db_host
=
'192.168.4.253'
# source_db_host='192.168.4.253'
port
=
'3317'
# port='3317'
elif
[[
$database_name
=
'silk_road'
]]
;
then
# elif [[ $database_name = 'silk_road' ]]; then
# silk_road
# # silk_road
sys_table_list
=
''
# sys_table_list=''
source_db_host
=
'192.168.4.80'
# source_db_host='192.168.4.80'
port
=
'9999'
# port='9999'
elif
[[
$database_name
=
'xyqb_user'
]]
;
then
# elif [[ $database_name = 'xyqb_user' ]]; then
# 用户中心
# # 用户中心
sys_table_list
=
'merchant_config merchant'
# sys_table_list='merchant_config merchant'
port
=
'3313'
# port='3313'
elif
[[
$database_name
=
'merchant'
]]
;
then
# elif [[ $database_name = 'merchant' ]]; then
# 商户
# # 商户
sys_table_list
=
'authority product_nature role role_authority role_supplier role_user user'
# sys_table_list='authority product_nature role role_authority role_supplier role_user user'
port
=
'3314'
# port='3314'
elif
[[
$database_name
=
'xyqb_btzt'
]]
;
then
# elif [[ $database_name = 'xyqb_btzt' ]]; then
# 白条直投
# # 白条直投
sys_table_list
=
'zt_channel zt_fund zt_fund_channel zt_fund_credit zt_fund_term'
# sys_table_list='zt_channel zt_fund zt_fund_channel zt_fund_credit zt_fund_term'
port
=
'9002'
# port='9002'
elif
[[
$database_name
=
'user_credit'
]]
;
then
# elif [[ $database_name = 'user_credit' ]]; then
# user_credit
# # user_credit
sys_table_list
=
''
# sys_table_list=''
port
=
'9001'
# port='9001'
elif
[[
$database_name
=
'display'
]]
;
then
# elif [[ $database_name = 'display' ]]; then
# display
# # display
sys_table_list
=
'discovery_config'
# sys_table_list='discovery_config'
source_db_host
=
'192.168.3.19'
# source_db_host='192.168.3.19'
port
=
'3307'
# port='3307'
elif
[[
$database_name
=
'clotho'
]]
;
then
# elif [[ $database_name = 'clotho' ]]; then
sys_table_list
=
''
# sys_table_list=''
source_db_host
=
'192.168.3.19'
# source_db_host='192.168.3.19'
port
=
'3308'
# port='3308'
elif
[[
$database_name
=
'traffic_distribution'
]]
;
then
# elif [[ $database_name = 'traffic_distribution' ]]; then
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'
# 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'
# source_db_host='192.168.3.36'
port
=
'3313'
# port='3313'
elif
[[
$database_name
=
'notify'
]]
;
then
# elif [[ $database_name = 'notify' ]]; then
sys_table_list
=
'merchant merchant_config'
# sys_table_list='merchant merchant_config'
source_db_host
=
'192.168.4.6'
# source_db_host='192.168.4.6'
port
=
'7306'
# port='7306'
elif
[[
$database_name
=
'mall_settlement'
]]
;
then
# elif [[ $database_name = 'mall_settlement' ]]; then
sys_table_list
=
'role role_user user'
# sys_table_list='role role_user user'
source_db_host
=
'192.168.4.253'
# source_db_host='192.168.4.253'
port
=
'3315'
# port='3315'
elif
[[
$database_name
=
'score'
]]
;
then
# elif [[ $database_name = 'score' ]]; then
sys_table_list
=
''
# sys_table_list=''
source_db_host
=
'192.168.4.249'
# source_db_host='192.168.4.249'
port
=
'3322'
# port='3322'
elif
[[
$database_name
=
'reconciliation'
]]
;
then
# elif [[ $database_name = 'reconciliation' ]]; then
sys_table_list
=
''
# sys_table_list=''
source_db_host
=
'192.168.3.19'
# source_db_host='192.168.3.19'
port
=
'3308'
# port='3308'
elif
[[
$database_name
=
'account_center'
]]
;
then
# elif [[ $database_name = 'account_center' ]]; then
sys_table_list
=
''
# sys_table_list=''
source_db_host
=
'192.168.4.116'
# source_db_host='192.168.4.116'
port
=
'6001'
# port='6001'
elif
[[
$database_name
=
'urge_dispatcher'
]]
;
then
# elif [[ $database_name = 'urge_dispatcher' ]]; then
sys_table_list
=
''
# sys_table_list=''
source_db_host
=
'192.168.4.116'
# source_db_host='192.168.4.116'
port
=
'9901'
# port='9901'
fi
# fi
sys_table_list
=
`
curl
-s
http://192.168.4.3:10088/config_server/get_db_config/
$database_name
/sys_table_list
`
source_db_host
=
`
curl
-s
http://192.168.4.3:10088/config_server/get_db_config/
$database_name
/host
`
port
=
`
curl
-s
http://192.168.4.3:10088/config_server/get_db_config/
$database_name
/port
`
echo
"source_port is
$port
"
echo
"source_port is
$port
"
echo
"copy
${
base_config_file
}
to
${
config_file_name
}
"
echo
"copy
${
base_config_file
}
to
${
config_file_name
}
"
...
...
db-utils/db_schema_sync.sh
View file @
241e9a60
...
@@ -118,7 +118,8 @@ function run_sql_file()
...
@@ -118,7 +118,8 @@ function run_sql_file()
sh
$work_dir
/db_execute_sql.sh
$target_db_host
$sync_db_name
$target_db_port
sh
$work_dir
/db_execute_sql.sh
$target_db_host
$sync_db_name
$target_db_port
}
}
database_list
=
`
grep
database_list
$work_dir
/config/db_config |
cut
-d
"="
-f
2
`
# database_list=`grep database_list $work_dir/config/db_config | cut -d "=" -f 2`
database_list
=
`
curl http://192.168.4.3:10088/config_server/get_db_config/all/name
`
if
[[
"
$sync_db_name
"
=
"all"
]]
;
then
if
[[
"
$sync_db_name
"
=
"all"
]]
;
then
echo
"sync all database schema"
echo
"sync all database schema"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment