在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

相关推荐
apocelipes2 小时前
Linux c 运行时获取动态库所在路径
linux·c语言·linux编程
努力学习的小廉3 小时前
深入了解linux系统—— 进程池
linux·运维·服务器
秃头菜狗4 小时前
各个主要目录的功能 / Linux 常见指令
linux·运维·服务器
2301_793102494 小时前
Linux——MySql数据库
linux·数据库
jiunian_cn5 小时前
【Linux】centos软件安装
linux·运维·centos
程序员JerrySUN5 小时前
[特殊字符] 深入理解 Linux 内核进程管理:架构、核心函数与调度机制
java·linux·架构
孤寂大仙v5 小时前
【计算机网络】非阻塞IO——select实现多路转接
linux·计算机网络
派阿喵搞电子6 小时前
Ubuntu下有关UDP网络通信的指令
linux·服务器·网络
Evan_ZGYF丶6 小时前
【PCIe总线】 -- PCI、PCIe相关实现
linux·嵌入式·pcie·pci
舰长1156 小时前
Ubuntu挂载本地镜像源(像CentOS 一样挂载本地镜像源)
linux·ubuntu·centos