|
@@ -66,6 +66,7 @@ async def ess_instance(ecs_client, alb_client, ess_count, max_workers, version,
|
|
server_start_sh = os.path.join(longvideoapi_config.start_sh['target_dir'], longvideoapi_config.start_sh['name'])
|
|
server_start_sh = os.path.join(longvideoapi_config.start_sh['target_dir'], longvideoapi_config.start_sh['name'])
|
|
server_start_commend = f"sh {server_start_sh} {version}"
|
|
server_start_commend = f"sh {server_start_sh} {version}"
|
|
utils.run_command(ecs_client=ecs_client, instance_ids=ess_instance_ids, command=server_start_commend)
|
|
utils.run_command(ecs_client=ecs_client, instance_ids=ess_instance_ids, command=server_start_commend)
|
|
|
|
+ logging.info(f"start server finish, instances: {ess_instance_ids}")
|
|
# 4. 异步探活
|
|
# 4. 异步探活
|
|
global health_instances
|
|
global health_instances
|
|
health_instances = []
|
|
health_instances = []
|
|
@@ -76,7 +77,7 @@ async def ess_instance(ecs_client, alb_client, ess_count, max_workers, version,
|
|
[(ecs_client, instance_id) for instance_id in ess_instance_ids]
|
|
[(ecs_client, instance_id) for instance_id in ess_instance_ids]
|
|
]
|
|
]
|
|
await asyncio.wait(tasks)
|
|
await asyncio.wait(tasks)
|
|
- logging.info(f"health instances count: {len(health_instances)}, {health_instances}")
|
|
|
|
|
|
+ logging.info(f"health instances count: {len(health_instances)}, instances: {health_instances}")
|
|
# 5. 挂载流量
|
|
# 5. 挂载流量
|
|
if len(health_instances) == len(ess_instance_ids):
|
|
if len(health_instances) == len(ess_instance_ids):
|
|
# 所有机器探活成功
|
|
# 所有机器探活成功
|
|
@@ -88,6 +89,7 @@ async def ess_instance(ecs_client, alb_client, ess_count, max_workers, version,
|
|
logging.info(f"Successfully added health_instance_ids {health_instance_ids} to server groups {longvideoapi_config.server_group_id_list}.")
|
|
logging.info(f"Successfully added health_instance_ids {health_instance_ids} to server groups {longvideoapi_config.server_group_id_list}.")
|
|
|
|
|
|
time.sleep(20)
|
|
time.sleep(20)
|
|
|
|
+ logging.info(f"start update weight instances: {health_instance_ids} server groups: {longvideoapi_config.server_group_id_list}.")
|
|
# add_weight_list = [(10, 5), (20, 5), (40, 5), (60, 5), (80, 5), (100, 5)]
|
|
# add_weight_list = [(10, 5), (20, 5), (40, 5), (60, 5), (80, 5), (100, 5)]
|
|
add_weight_list = [(10, 10), (20, 10), (40, 10), (60, 10), (80, 10), (100, 10)]
|
|
add_weight_list = [(10, 10), (20, 10), (40, 10), (60, 10), (80, 10), (100, 10)]
|
|
utils.update_server_group_servers_attribute(alb_client,
|
|
utils.update_server_group_servers_attribute(alb_client,
|