gpt4 book ai didi

centos - 将 New Relic 与 Celery 集成

转载 作者:行者123 更新时间:2023-12-04 19:43:48 28 4
gpt4 key购买 nike

我正在尝试将 New Relic 配置为与 Celery 一起使用。我正在开发一个托管在带有 CentOS 7 的 Amazon EC2 上的 Django 应用程序。
我认为为 celery 配置 New Relic 所需要做的就是在/etc/systemd/system/celery.service 中编辑以下行:ExecStart=/home/myuser/project/venv/bin/celery -A project worker -l info -c 4

并将其更改为:ExecStart=/home/myuser/project/newrelic.ini newrelic-admin run-program celery -A project worker -l info -c 4但我看到以下错误:

[root@ip-172-31-60-222 system]# systemctl daemon-reload
[root@ip-172-31-60-222 system]# systemctl restart celery
[root@ip-172-31-60-222 system]# systemctl status celery.service -l
● celery.service - datasidekick celery service
Loaded: loaded (/etc/systemd/system/celery.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Wed 2017-03-01 04:16:33 UTC; 900ms ago
Process: 22969 ExecStart=/home/datasidekick/datasidekick/newrelic.ini newrelic-admin run-program /home/datasidekick/datasidekick/venv/bin/celery -A datasidekick worker -l info -c 4 (code=exited, status=203/EXEC)
Main PID: 22969 (code=exited, status=203/EXEC)

Mar 01 04:16:33 ip-172-31-60-222.ec2.internal systemd[1]: Unit celery.service entered failed state.
Mar 01 04:16:33 ip-172-31-60-222.ec2.internal systemd[1]: celery.service failed.
Mar 01 04:16:33 ip-172-31-60-222.ec2.internal systemd[1]: celery.service holdoff time over, scheduling restart.
Mar 01 04:16:33 ip-172-31-60-222.ec2.internal systemd[1]: start request repeated too quickly for celery.service
Mar 01 04:16:33 ip-172-31-60-222.ec2.internal systemd[1]: Failed to start datasidekick celery service.
Mar 01 04:16:33 ip-172-31-60-222.ec2.internal systemd[1]: Unit celery.service entered failed state.
Mar 01 04:16:33 ip-172-31-60-222.ec2.internal systemd[1]: celery.service failed.
我不确定我做错了什么。任何帮助是极大的赞赏!

最佳答案

你问这个问题已经有一段时间了,但失败的原因可能是错误的ExecStart命令。
您使用 /home/myuser/project/newrelic.ini newrelic-admin run-program celery -A project worker -l info -c 4作为启动服务的命令。命令的第一部分将尝试执行/home/myuser/project/newrelic.ini ,这是一个文本文件,失败并显示 Permission denied错误,因为文本文件默认没有 exec 权限。或者它会在某处导致 bash 语法错误并且也会失败。
Insead, 使用

Environment="NEW_RELIC_CONFIG_FILE=/home/myuser/project/newrelic.ini"
ExecStart=newrelic-admin run-program celery -A project worker -l info -c 4

关于centos - 将 New Relic 与 Celery 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42523239/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com