使用 Azure 容器应用程序时 Grobid 容器崩溃

问题描述 投票:0回答:2

我正在尝试在 Azure 容器应用程序上部署 grobid:0.7.3 自定义映像,但仍然返回“Failed:grobidContainerCreation”失败。 容器进入该状态,然后进入降级状态。 Azure 容器应用工作负载配置文件大小消耗 4 个 CPU 和 8 Gb 内存。

自定义镜像仅复制 .pem 证书。 但这不是问题[enter image description here]

我尝试在 4cpu x 8 内存 x 30GB 存储虚拟机上部署相同的映像,它可以正常工作。 尝试在开发环境中部署相同的azure容器应用程序,但仍然无法工作。

azure containers azure-container-apps grobid
2个回答
0
投票

要在 Azure 容器应用程序上部署自定义 Grobid 映像,您可以按照以下步骤操作 -

假设您已经在 ACR 中构建并可用了自定义 Grobid 图像(例如

grobid:0.7.3

创建容器应用环境

   az containerapp env create --name grobid-env \
  --resource-group <RGname> \
  --location westus

enter image description here 接下来,使用自定义 Grobid Docker 映像创建容器应用程序。为您的自定义图像添加相应的启动命令,如下-

az containerapp create --name grobid-app \
  --resource-group <RGname> \
  --environment grobid-env \
  --image arkoacr.azurecr.io/grobid:0.7.3 \
  --cpu 4 --memory 8Gi \
  --target-port 8080 \
  --ingress 'external' \
  --registry-server arkoacr.azurecr.io \
  --registry-username <your-acr-username> \
  --registry-password <your-acr-password> \
  --startup-command "java -jar grobid-service-0.7.3.jar"

对于此示例,由于映像托管在 Docker Hub 上,因此不需要特殊配置来进行身份验证。我没有使用任何启动脚本,所以 -

az containerapp create --name grobid-app \
  --resource-group <RGname> \
  --environment grobid-env \
  --image lfoppiano/grobid:0.7.3 \
  --cpu 4 --memory 8Gi \
  --target-port 8070 \
  --ingress 'external'
  

enter image description here

部署容器应用程序后,您可以使用以下步骤监控和调试部署:

检查应用程序状态:

az containerapp show --name grobid-app --resource-group <RGname>

enter image description here enter image description here 查看日志:

az containerapp logs show --name grobid-app --resource-group <RGname>

enter image description here

其他故障排除步骤 -

  1. 检查 Grobid 是否需要比当前分配更多的内存或存储空间。
  2. 确保 Azure 容器应用程序为 Grobid 的需求提供足够的磁盘空间。
  3. 确保 Azure 容器应用中的启动命令与 Grobid 的预期命令匹配。
  4. 确保 Grobid 具有对外部服务或 API 的必要网络访问权限。
  5. 使用 Azure 容器应用程序的日志记录功能来识别容器创建和启动期间的特定问题。

参考: Grobid 设置


0
投票

应用程序崩溃可能是由于Azure容器应用程序环境中内存分配不足造成的。 完整的 Grobid 映像需要 30GB 空间,但 Azure 容器应用程序的消耗模型为每个副本提供最大 8GB 空间。

https://learn.microsoft.com/en-us/azure/container-apps/hardware#:~:text=消耗,8*

要解决此问题,请考虑请求增加配额或优化应用程序以适应可用内存限制。

© www.soinside.com 2019 - 2024. All rights reserved.