You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AWS Elastic Beanstalk安装New Relic失败,求故障排查

排查与解决Elastic Beanstalk安装New Relic Infra失败的问题

1. 确认New Relic仓库是否已正确配置

Amazon Linux 2默认无New Relic的yum仓库,直接执行yum install newrelic-infra会因找不到包失败。需先添加官方仓库,且该步骤要在安装命令之前执行:

sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/7/x86_64/newrelic-infra.repo

2. 检查EC2实例网络连通性

  • 确认Elastic Beanstalk实例所在安全组允许HTTPS(443端口)出站访问download.newrelic.com;若实例在私有子网,需确保NAT网关配置正常,可访问公网。
  • 可登录实例执行curl -v https://download.newrelic.com/infrastructure_agent/linux/yum/el/7/x86_64/newrelic-infra.repo,测试是否能正常获取仓库文件。

3. 查看yum详细日志定位具体错误

默认日志未提供足够细节,可通过两种方式获取更多信息:

  • 登录EC2实例查看yum日志:
    cat /var/log/yum.log
    
  • 修改部署脚本中的安装命令,输出详细过程:
    sudo yum install newrelic-infra -y -v
    

4. 验证权限配置

  • 若用IAM角色授权,确保实例的IAM角色拥有NewRelicInfrastructureAgentPolicy或包含发送数据权限的自定义策略。
  • 若用License Key,需提前通过环境变量NEW_RELIC_LICENSE_KEY设置,或在安装后修改/etc/newrelic-infra.yml文件填入正确密钥。

5. 检查部署脚本执行顺序

确保.ebextensions配置文件中命令顺序正确,示例配置如下:

commands:
  01-add-repo:
    command: sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/7/x86_64/newrelic-infra.repo
  02-install-agent:
    command: sudo yum install newrelic-infra -y -v
  03-set-license-key:
    command: sudo sed -i 's/license_key:.*/license_key: YOUR_LICENSE_KEY/' /etc/newrelic-infra.yml

6. 确认系统兼容性

New Relic Infra Agent支持Amazon Linux 2,需确保使用的是对应EL7版本的仓库(Amazon Linux 2基于EL7),避免选错仓库版本。

内容的提问来源于stack exchange,提问作者Rodrigo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 03:07:13