|
@@ -152,7 +152,7 @@ async def update_instance(ecs_client, alb_client, instance_ids, max_workers, ver
|
|
"""
|
|
"""
|
|
线上机器更新
|
|
线上机器更新
|
|
:param ecs_client:
|
|
:param ecs_client:
|
|
- :param alb_client: slb客户端连接
|
|
|
|
|
|
+ :param alb_client: alb客户端连接
|
|
:param instance_ids: instanceId type-list
|
|
:param instance_ids: instanceId type-list
|
|
:param max_workers:
|
|
:param max_workers:
|
|
:param version: 版本标记
|
|
:param version: 版本标记
|
|
@@ -167,7 +167,7 @@ async def update_instance(ecs_client, alb_client, instance_ids, max_workers, ver
|
|
utils.set_instance_weight_process_with_alb(alb_client=alb_client,
|
|
utils.set_instance_weight_process_with_alb(alb_client=alb_client,
|
|
server_group_id_list=longvideoapi_config.server_group_id_list,
|
|
server_group_id_list=longvideoapi_config.server_group_id_list,
|
|
instance_id_list=instance_id_list,
|
|
instance_id_list=instance_id_list,
|
|
- weight_list=[(0, 15)])
|
|
|
|
|
|
+ weight_list=[(0, 20)])
|
|
logging.info(f"set weight with 0 finished, instances: {instance_id_list}")
|
|
logging.info(f"set weight with 0 finished, instances: {instance_id_list}")
|
|
# 2. 异步移除旧容器并删除旧镜像
|
|
# 2. 异步移除旧容器并删除旧镜像
|
|
global remove_container_instances
|
|
global remove_container_instances
|
|
@@ -237,7 +237,7 @@ def remove_instances(ecs_client, alb_client, instance_ids):
|
|
:return: None
|
|
:return: None
|
|
"""
|
|
"""
|
|
# 1. 摘流量
|
|
# 1. 摘流量
|
|
- weight_list = [(0, 10)] # 设置权重为0,等待10秒
|
|
|
|
|
|
+ weight_list = [(0, 20)] # 设置权重为0,等待20秒
|
|
# todo
|
|
# todo
|
|
try:
|
|
try:
|
|
utils.set_instance_weight_process_with_alb(alb_client,
|
|
utils.set_instance_weight_process_with_alb(alb_client,
|
|
@@ -300,7 +300,7 @@ def main():
|
|
alb_client = utils.connect_client(access_key_id=longvideoapi_config.alb_client_params['access_key_id'],
|
|
alb_client = utils.connect_client(access_key_id=longvideoapi_config.alb_client_params['access_key_id'],
|
|
access_key_secret=longvideoapi_config.alb_client_params['access_key_secret'],
|
|
access_key_secret=longvideoapi_config.alb_client_params['access_key_secret'],
|
|
region_id=longvideoapi_config.alb_client_params['region_id'])
|
|
region_id=longvideoapi_config.alb_client_params['region_id'])
|
|
- create_client = utils.connect_client(access_key_id=longvideoapi_config.ecs_client_params['access_key_id'],
|
|
|
|
|
|
+ ecs_client = utils.connect_client(access_key_id=longvideoapi_config.ecs_client_params['access_key_id'],
|
|
access_key_secret=longvideoapi_config.ecs_client_params['access_key_secret'],
|
|
access_key_secret=longvideoapi_config.ecs_client_params['access_key_secret'],
|
|
region_id=longvideoapi_config.ecs_client_params['region_id'])
|
|
region_id=longvideoapi_config.ecs_client_params['region_id'])
|
|
|
|
|
|
@@ -326,7 +326,7 @@ def main():
|
|
|
|
|
|
# 4. 停止并释放扩容机器
|
|
# 4. 停止并释放扩容机器
|
|
logging.info(f"stop & release instances start ...")
|
|
logging.info(f"stop & release instances start ...")
|
|
- remove_instances(create_client=create_client, alb_client=alb_client, instance_ids=ess_instances)
|
|
|
|
|
|
+ remove_instances(ecs_client=ecs_client, alb_client=alb_client, instance_ids=ess_instances)
|
|
logging.info(f"stop & release instances end!")
|
|
logging.info(f"stop & release instances end!")
|
|
except Exception as e:
|
|
except Exception as e:
|
|
logging.error(e)
|
|
logging.error(e)
|