在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

相关推荐
☆凡尘清心☆几秒前
CentOS Stream 9 编译安装 Redis 7.2.7 完整版详细步骤
linux·redis·centos
wuminyu6 分钟前
JUC组件逐层剥离与深度剖析
java·linux·c语言·jvm·c++·算法
ocean'22 分钟前
防火墙策略路由
linux·服务器·数据库
三言老师25 分钟前
awk条件筛选日志内容实操
linux·运维·服务器·centos
^yi42 分钟前
【Linux系统编程】库的制作与使用
linux·运维·服务器
LUCKY-LIVING1 小时前
ELF File in linux
android·java·linux
bksczm1 小时前
popen解析
linux·运维·服务器
深念Y1 小时前
技术探索记录 在 Android 手机上运行 One API
android·linux·服务器·智能手机·go·交叉编译·服务
byte轻骑兵1 小时前
如何定制BlueZ编译:开启/关闭BLE/音频模块的编译参数配置
linux·arm开发·蓝牙·bluez·电脑蓝牙
qetfw1 小时前
Debian 配置 AIDE 文件完整性检测:基线初始化、变更检查与数据库更新
linux·网络·数据库·debian