This commit is contained in:
pengtao 2022-06-14 14:58:17 +08:00
parent d4b35ec5ce
commit 381be643c7
6 changed files with 95 additions and 68 deletions

View File

@ -1,46 +1,60 @@
========================================check combine data=========================================
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_844 -e"select count(1),server_id from user group by server_id;"
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_852 -e"select count(1),server_id from user group by server_id;"
==========================================step 1===============================================
10.10.6.203-204
python wjtx.py changestatus -m maintain -o add -s 844-847
10.10.6.207-208
python wjtx.py changestatus -m maintain -o add -s 852-855
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_852 >legend_852.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_853 >legend_853.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_854 >legend_854.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_855 >legend_855.sql
python wjtx.py initdb -s 852
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_852 -e"source all.sql"
python import_redis.py 10.10.6.207 6381 out/game_redis.script
python import_redis.py 10.10.6.4 6379 out/global_redis.script
close 10.10.6.208
python wjtx.py changestatus -m maintain -o remove -s 852-855
==========================================step 2===============================================
10.10.6.209-210
python wjtx.py changestatus -m maintain -o add -s 856-859
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_856 >legend_856.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_857 >legend_857.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_858 >legend_858.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_859 >legend_859.sql
python wjtx.py initdb -s 856
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_856 -e"source all.sql"
python import_redis.py 10.10.6.209 6381 out/game_redis.script
python import_redis.py 10.10.6.4 6379 out/global_redis.script
close 10.10.6.210
python wjtx.py changestatus -m maintain -o remove -s 856-859
==========================================step 3===============================================
10.10.6.185,199
python wjtx.py changestatus -m maintain -o add -s 808-843
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_808 >legend_808.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_836 >legend_836.sql
python wjtx.py initdb -s 808
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_808 -e"source all.sql"
python import_redis.py 10.10.6.185 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 808
redis-cli -h 10.10.6.4 hdel hefu_info 836
close 10.10.6.199
python wjtx.py changestatus -m maintain -o remove -s 808-843
==========================================step 4===============================================
10.10.6.203,205
python wjtx.py changestatus -m maintain -o add -s 844-851
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_844 >legend_844.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_845 >legend_845.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_846 >legend_846.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_847 >legend_847.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_848 >legend_848.sql
python wjtx.py initdb -s 844
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_844 -e"source all.sql"
python import_redis.py 10.10.6.203 6381 out/game_redis.script
python import_redis.py 10.10.6.4 6379 out/global_redis.script
close 10.10.6.204
python wjtx.py changestatus -m maintain -o remove -s 844-847
==========================================step 2===============================================
10.10.6.205-206
python wjtx.py changestatus -m maintain -o add -s 848-851
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_848 >legend_848.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_849 >legend_849.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_850 >legend_850.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_851 >legend_851.sql
python wjtx.py initdb -s 848
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_848 -e"source all.sql"
python import_redis.py 10.10.6.205 6381 out/game_redis.script
python import_redis.py 10.10.6.4 6379 out/global_redis.script
close 10.10.6.206
python wjtx.py changestatus -m maintain -o remove -s 848-851
==========================================step 3===============================================
10.10.6.199,201
python wjtx.py changestatus -m maintain -o add -s 836-843
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_836 >legend_836.sql
mysqldump --default-character-set=utf8 -uwjtx -pmMWA4DKCfeOL -h10.10.6.2 legend_840 >legend_840.sql
python wjtx.py initdb -s 836
mysql -uroot -p0usmUwROtWjf -h10.10.6.2 legend_836 -e"source all.sql"
python import_redis.py 10.10.6.199 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 836
redis-cli -h 10.10.6.4 hdel hefu_info 840
close 10.10.6.201
python wjtx.py changestatus -m maintain -o remove -s 836-843
redis-cli -h 10.10.6.4 hdel hefu_info 844
redis-cli -h 10.10.6.4 hdel hefu_info 848
close 10.10.6.205
python wjtx.py changestatus -m maintain -o remove -s 844-851

View File

@ -11,38 +11,39 @@ from create_conf import create_conf_work
def get_csv():
with open('1009.csv', 'r') as f:
with open("1009.csv", "r") as f:
data = f.read()
csv_data = list()
for line in data.split('\n'):
for line in data.split("\n"):
tt = dict()
if line:
tt['serverid'], tt['redis_host'], tt['redis_port'] = line.split()
tt["serverid"], tt["redis_host"], tt["redis_port"] = line.split()
csv_data.append(tt)
return csv_data
def read_json(filename):
json_data = json.loads(open(filename, 'r').read())
json_data = json.loads(open(filename, "r").read())
return json_data
def main():
create_conf_work()
csv_data = get_csv()
for i in range(1, 4):
for i in range(1, 5):
check_file = f"server_list_{i}.json"
json_data = read_json(check_file)
print(f"check {check_file}")
for line in json_data:
for csv_line in csv_data:
if int(line['serverid']) == int(csv_line['serverid']):
if line['redis_host'] == csv_line['redis_host'] and int(
line['redis_port']) == int(csv_line['redis_port']):
if int(line["serverid"]) == int(csv_line["serverid"]):
if line["redis_host"] == csv_line["redis_host"] and int(
line["redis_port"]
) == int(csv_line["redis_port"]):
pass
else:
print(line, csv_line, check_file)
if __name__ == '__main__':
if __name__ == "__main__":
main()

View File

@ -1,22 +1,22 @@
[
{
"serverid": 844,
"redis_host": "10.10.6.203",
"serverid": 852,
"redis_host": "10.10.6.207",
"redis_port": 6381
},
{
"serverid": 845,
"redis_host": "10.10.6.203",
"serverid": 853,
"redis_host": "10.10.6.207",
"redis_port": 6382
},
{
"serverid": 846,
"redis_host": "10.10.6.204",
"serverid": 854,
"redis_host": "10.10.6.208",
"redis_port": 6381
},
{
"serverid": 847,
"redis_host": "10.10.6.204",
"serverid": 855,
"redis_host": "10.10.6.208",
"redis_port": 6382
}
]

View File

@ -1,22 +1,22 @@
[
{
"serverid": 848,
"redis_host": "10.10.6.205",
"serverid": 856,
"redis_host": "10.10.6.209",
"redis_port": 6381
},
{
"serverid": 849,
"redis_host": "10.10.6.205",
"serverid": 857,
"redis_host": "10.10.6.209",
"redis_port": 6382
},
{
"serverid": 850,
"redis_host": "10.10.6.206",
"serverid": 858,
"redis_host": "10.10.6.210",
"redis_port": 6381
},
{
"serverid": 851,
"redis_host": "10.10.6.206",
"serverid": 859,
"redis_host": "10.10.6.210",
"redis_port": 6382
}
]

View File

@ -1,12 +1,12 @@
[
{
"serverid": 808,
"redis_host": "10.10.6.185",
"redis_port": 6381
},
{
"serverid": 836,
"redis_host": "10.10.6.199",
"redis_port": 6381
},
{
"serverid": 840,
"redis_host": "10.10.6.201",
"redis_port": 6381
}
]

View File

@ -0,0 +1,12 @@
[
{
"serverid": 844,
"redis_host": "10.10.6.203",
"redis_port": 6381
},
{
"serverid": 848,
"redis_host": "10.10.6.205",
"redis_port": 6381
}
]