在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

相关推荐
前端世界5 小时前
从零搭建多子网 DHCP 服务:CentOS 双网卡多作用域实战与原理解析
linux·运维·centos
tianyuanwo6 小时前
K8s Dashboard运维技巧全面经验总结
linux·运维·kubernetes
无敌的牛7 小时前
Linux操作系统
linux·运维·服务器
顾小玙8 小时前
Linux : 进程概念
linux
半梦半醒*8 小时前
k8s——services资源+pod详解1
linux·运维·docker·kubernetes·centos·负载均衡
IndulgeCui8 小时前
【金仓数据库产品体验官】KSQL Developer Linux版安装使用体验
linux·运维·数据库
Biomamba生信基地9 小时前
Linux| 二.计算机软件组成与Linux
linux·运维·服务器·生信·医药
code_ing-9 小时前
【Linux】命令行参数与环境变量
linux·c++·windows·笔记
j_xxx404_9 小时前
Linux:权限复盘扩展|粘滞位|软件包管理器|Linux软件生态
linux·1024程序员节
@HNUSTer10 小时前
基于 GEE MODIS 数据的区域干旱监测——从植被状况指数(VCI)计算到干旱分级与空间分布可视化
云计算·数据集·遥感大数据·gee·云平台·modis·干旱监测