2021-11-15 15:11:51 +08:00

104 lines
5.8 KiB
Plaintext

combine setp:
1、maintain server
cd /data/git/dev_ops/wjtx_tools/ops_tools
python wjtx.py changestatus -m maintain -o add -s 616-619
python wjtx.py changestatus -m maintain -o add -s 1-91
python wjtx.py changestatus -m maintain -o add -s 209-642
python wjtx.py changestatus -m maintain -o remove -s 1-91
python wjtx.py changestatus -m maintain -o remove -s 209-642
2、 close auto load in ops:
3、stop service && backup redis && backup mysql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_241 >legend_241.sql
4、run scripts
cd /root/opensource/migrate_server/wjtx/tools/combine_db/script
python combine_db.py
python combine_redis.py
drop database
cd /data/git/dev_ops/wjtx_tools/ops_tools && python wjtx.py initdb -s 616
cd /root/opensource/migrate_server/wjtx/tools/combine_db/script/out
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_616 -e"source all.sql"
cd ..
python import_redis.py 10.10.6.246 6381 out/game_redis.script
python import_redis.py 10.10.6.4 6379 out/global_redis.script
5、start service && change service to open && autoload
python wjtx.py changestatus -m maintain -o remove -s 616-619
cd /data/git/dev_ops/wjtx_tools/ops_tools && python wjtx.py autoload
========================================clear old data============================================
clear_mysql:
select count(1) FROM role WHERE login_time < '2020-11-01 00:00:00' AND total_rmb < 6 AND total_online_millis < 3600000 AND id not in (select role_id from role_marry)
select count(id) from item where role_id not in (select id from role)
select count(id) from role_mail where role_id not in (select id from role)
select count(id) FROM `tribe_member` WHERE role_id NOT IN ( SELECT id FROM role)
========================================check combine data=========================================
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_636 -e"select count(1),server_id from user group by server_id;"
==========================================step 1===============================================
10.10.6.98-101
python wjtx.py changestatus -m maintain -o add -s 636-643
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_636 >legend_636.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_637 >legend_637.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_638 >legend_638.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_639 >legend_639.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_640 >legend_640.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_641 >legend_641.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_642 >legend_642.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_643 >legend_643.sql
python wjtx.py initdb -s 636
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_636 -e"source all.sql"
python import_redis.py 10.10.6.98 6381 out/game_redis.script
python import_redis.py 10.10.6.4 6379 out/global_redis.script
close 10.10.6.99,100,101
python wjtx.py changestatus -m maintain -o remove -s 636-643
==========================================step 2===============================================
10.10.6.102,103
python wjtx.py changestatus -m maintain -o add -s 644-647
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_644 >legend_644.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_645 >legend_645.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_646 >legend_646.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_647 >legend_647.sql
python wjtx.py initdb -s 644
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_644 -e"source all.sql"
python import_redis.py 10.10.6.102 6381 out/game_redis.script
python import_redis.py 10.10.6.4 6379 out/global_redis.script
close 10.10.6.103
python wjtx.py changestatus -m maintain -o remove -s 644-647
=======================================step 3===============================================
10.10.6.246,94,96
python wjtx.py changestatus -m maintain -o add -s 616-635
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_616 >legend_616.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_628 >legend_628.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_632 >legend_632.sql
python wjtx.py initdb -s 616
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_616 -e"source all.sql"
python import_redis.py 10.10.6.246 6381 out/game_redis.script
python import_redis.py 10.10.6.4 6379 out/global_redis.script
redis-cli -h 10.10.6.4 hdel hefu_info 616
redis-cli -h 10.10.6.4 hdel hefu_info 628
redis-cli -h 10.10.6.4 hdel hefu_info 632
close 10.10.6.94,96
change 10.10.6.246 to sa2
python wjtx.py changestatus -m maintain -o remove -s 616-635
=======================================step 4===============================================
10.10.6.11
python wjtx.py changestatus -m maintain -o add -s 1-3
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_1 >legend_1.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_2 >legend_2.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_3 >legend_3.sql
python wjtx.py initdb -s 1
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_1 -e"source all.sql"
python import_redis.py 10.10.6.12 6384 out/game_redis.script
change game,stage config to 10.10.6.12:6384
python import_redis.py 10.10.6.4 6379 out/global_redis.script
close 10.10.6.11
python wjtx.py changestatus -m maintain -o remove -s 1-3