一千萬個為什麽

搜索

一共有 2 個回答:

集群知道與其關聯的EC2實例的方式是由ECS代理使用的配置文件。您可以修改此文件,位於 /etc/ecs/ecs.config 處,並命名一個不同的群集。然後重新啟動ECS代理。這將有效地將EC2實例“移動”到另一個集群。

More information about ecs.config in the documentation - http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html

After the modification, it is possible to verify by sending an HTTP request to the ECS Agent metadata service and see the new cluster displayed. http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-update.html

ECS集群本身也需要通知。可以使用Register/Deregister API調用此方法,例如使用AWS CLI:

More housekeeping might be required on the ECS agent itself. Like removing cached checkpoint files, etc. https://github.com/aws/amazon-ecs-agent/issues/139#issuecomment-123061463

您需要遵循以下步驟:

為確保它使用正確的群集,請檢查日誌 - docker logs ecs-agent 。它應該有一個消息,如:

[INFO] Registration completed successfully. I am running as 'arn:aws:ecs:eu-west-1:ACCOUNT_ID:container-instance/CLUSTER_ID' in cluster 'devcluster'