在ECS优化的AWS Linux修改ECS配置后ECS Agent服务无法启动

文章目录

小结

在ECS优化的AWS Linux修改ECS配置后ECS Agent服务无法启动,进行了解决。

问题解决

在ECS优化的AWS Linux修改ECS配置ecs.config, 如下:

shell 复制代码
[ec2-user@ip-10-0-3-241 ~]$ cat /etc/ecs/ecs.config
ECS_CLUSTER=John-Cluster
ECS_WARM_POOLS_CHECK=true

对以上设置后,ECS服务重启失败:

shell 复制代码
[ec2-user@ip-10-0-1-55 ~]$ sudo vi /etc/ecs/ecs.config 
[ec2-user@ip-10-0-1-55 ~]$ sudo systemctl restart ecs
[ec2-user@ip-10-0-1-55 ~]$ sudo systemctl status ecs
● ecs.service - Amazon Elastic Container Service - container agent
   Loaded: loaded (/usr/lib/systemd/system/ecs.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2023-12-01 08:57:52 UTC; 1s ago
     Docs: https://aws.amazon.com/documentation/ecs/
  Process: 21273 ExecStopPost=/usr/libexec/amazon-ecs-init post-stop (code=exited, status=0/SUCCESS)
  Process: 21004 ExecStop=/usr/libexec/amazon-ecs-init stop (code=exited, status=0/SUCCESS)
  Process: 21140 ExecStart=/usr/libexec/amazon-ecs-init start (code=exited, status=5)
  Process: 21084 ExecStartPre=/usr/libexec/amazon-ecs-init pre-start (code=exited, status=0/SUCCESS)
 Main PID: 21140 (code=exited, status=5)

Dec 01 08:57:51 ip-10-0-1-55.ap-southeast-1.compute.internal amazon-ecs-init[21140]: 2023-12-01T08:57:51Z [INFO] Starting Amazon Elastic Container Service Agent
Dec 01 08:57:52 ip-10-0-1-55.ap-southeast-1.compute.internal amazon-ecs-init[21140]: 2023-12-01T08:57:52Z [INFO] Agent exited with code 5
Dec 01 08:57:52 ip-10-0-1-55.ap-southeast-1.compute.internal amazon-ecs-init[21140]: 2023-12-01T08:57:52Z [ERROR] agent exited with terminal exit code: 5

解决方法:删除/var/lib/ecs/data/agent.db文件,这个文件保存了现有ECS设置,可能有冲突,删除后再重启ECS Agent服务,问题解决。

shell 复制代码
[ec2-user@ip-10-0-1-55 ~]$ sudo ls /var/lib/ecs/data/
agent.db
[ec2-user@ip-10-0-1-55 ~]$ sudo rm /var/lib/ecs/data/agent.db
[ec2-user@ip-10-0-1-55 ~]$ sudo systemctl restart ecs
[ec2-user@ip-10-0-1-55 ~]$ sudo systemctl status ecs
● ecs.service - Amazon Elastic Container Service - container agent
   Loaded: loaded (/usr/lib/systemd/system/ecs.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2023-12-01 09:00:15 UTC; 3s ago

参考

stackoverflow: AWS ECS agent won't start

相关推荐
Johny_Zhao4 小时前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
NineData10 小时前
数据库迁移总踩坑?用 NineData 迁移评估,提前识别所有兼容性风险
数据库·程序员·云计算
chlk1232 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑2 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件2 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号2 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash2 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI3 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行3 天前
Linux和window共享文件夹
linux
木心月转码ing4 天前
WSL+Cpp开发环境配置
linux