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

本地正常运行的Photon Docker镜像在Azure容器应用中启动失败

问题:Photon地理编码器镜像Azure容器应用部署异常,本地运行正常

概述

  • 我有一个开源地理编码器Photon的Docker镜像,在本地macOS 14.3.1系统运行完全正常,但部署到Azure容器应用时抛出异常,请求协助解决🙏

背景

  • 该Photon镜像本地运行正常,镜像托管在Docker Hub
  • 本地启动命令:docker run -d -p 2322:2322 -v "$(pwd)/data:/photon/photon_data" --name photon sunraj751/photon-geocoder:latest

问题

  • 部署到Azure容器应用时,持续抛出IllegalIndexShardStateException[CurrentState[RECOVERING]异常
  • 同一镜像本地正常,Azure环境下出现该问题难以排查

Azure配置

  • 使用Azure File share作为持久化存储,数据已成功下载,通过app.yml挂载到/photon/photon_data
  • 容器配置为4核CPU、8GB内存
  • 详细错误日志:
2024-03-30 03:04:23,618 [main] INFO  de.komoot.photon.elasticsearch.Server - Started elastic search node
2024-03-30 03:04:23,618 [main] INFO  de.komoot.photon.App - Make sure that the ES cluster is ready, this might take some time.
2024-03-30 03:04:53,623 [main] INFO  de.komoot.photon.App - ES cluster is now ready.
Exception in thread "main" NoShardAvailableActionException[No shard available for [get [photon][place][DATABASE_PROPERTIES]: routing [null]]]; nested: RemoteTransportException[[Xlitte1][127.0.0.1:9300][indices:data/read/get[s]]]; nested: IllegalIndexShardStateException[CurrentState[RECOVERING] operations only allowed when shard state is one of [POST_RECOVERY, STARTED, RELOCATED]];
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction.perform(TransportSingleShardAction.java:209)
        ...(省略部分栈追踪)

附加信息

Dockerfile

FROM openjdk:11-jre

# Install pbzip2 for parallel extraction
RUN apt-get update \
    && apt-get -y install \
        pbzip2 \
        wget \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /photon
ADD https://github.com/komoot/photon/releases/download/0.5.0/photon-0.5.0.jar /photon/photon.jar
COPY entrypoint.sh ./entrypoint.sh

# Make sure the script is executable
RUN chmod +x ./entrypoint.sh

# Bind external storage to this location 
VOLUME /photon/photon_data
EXPOSE 2322

ENTRYPOINT /photon/entrypoint.sh

Entrypoint.sh

数据从GraphHopper的加拿大地区索引压缩包下载(约4GB)

#!/bin/bash

# Download elasticsearch index
if [ ! -d "/photon/photon_data/elasticsearch" ]; then
    echo "Downloading search index"

    # Let graphhopper know where the traffic is coming from
    USER_AGENT="docker: sunraj751/photon-geocoder"
    # If you want to install a specific region only, enable the line below and disable the current 'wget' row.
    # Take a look at http://download1.graphhopper.com/public/extracts/by-country-code for your country
    wget --user-agent="$USER_AGENT" -O - http://download1.graphhopper.com/public/extracts/by-country-code/ca/photon-db-ca-latest.tar.bz2 | bzip2 -cd | tar x
fi

# Start photon if elastic index exists
if [ -d "/photon/photon_data/elasticsearch" ]; then
    echo "Start photon"
    java -jar photon.jar $@
else
    echo "Could not start photon, the search index could not be found"
fi

App.yaml(容器应用配置)

id: /subscriptions/BLAH-BLAH-BLAH-BLAH/photon-container-app
identity:
  type: None
location: Canada East
name: photon-container-app
properties:
  configuration:
    activeRevisionsMode: Single
    dapr: null
    ingress:
      additionalPortMappings: null
      allowInsecure: false
      clientCertificateMode: null
      corsPolicy: null
      customDomains: null
      exposedPort: 0
      external: true
      fqdn: photon-container-app.BLAH-BLAH-BLAH.azurecontainerapps.io
      ipSecurityRestrictions: null
      stickySessions: null
      targetPort: 80
      targetPortHttpScheme: null
      traffic:
      - latestRevision: true
        weight: 100
      transport: Auto
    maxInactiveRevisions: 100
    registries: null
    secrets: null
    service: null
  customDomainVerificationId: BLAH-BLAH-BLAH-BLAH
  delegatedIdentities: []
  environmentId: /subscriptions/BLAH-BLAH-BLAH-BLAH-group/providers/photon-storage-environment
  eventStreamEndpoint: https://BLAH-BLAH-BLAH-BLAH/containerApps/photon-container-app/eventstream
  latestReadyRevisionName: photon-container-app--BLAH-BLAH
  latestRevisionFqdn: photon-container-app-BLAH-BLAH.canadaeast.azurecontainerapps.io
  latestRevisionName: photon-container-app-BLAH-BLAH
  managedEnvironmentId: /subscriptions/BLAH-BLAH/BLAH-BLAH/photon-storage-environment
  outboundIpAddresses:
  - xy.xyz.abc.cde
  - xy.xyz.abc.cde
  - xy.xyz.abc.cde
  provisioningState: Succeeded
  runningStatus: Running
  template:
    volumes:
    - name: photonazurefilevolume
      storageName: photonstoragemount
      storageType: AzureFile
    containers:
    - image: sunraj751/photon-docker:latest
      name: photon-container-app
      volumeMounts:
      - volumeName: photonazurefilevolume
        mountPath: /photon/photon_data
      resources:
        cpu: 4
        ephemeralStorage: 2Gi
        memory: 8Gi
    initContainers: null
    revisionSuffix: ''
    scale:
      maxReplicas: 2
      minReplicas: 1
      rules: null
    serviceBinds: null
    terminationGracePeriodSeconds: null
  workloadProfileName: Consumption
resourceGroup: photon-container-apps-group
systemData:
  createdAt: '2024-03-29T20:12:29.3143267'
  createdBy: BLAH
  createdByType: BLAH
  lastModifiedAt: '2024-03-29T20:12:29.3143267'
  lastModifiedBy: BLAH
  lastModifiedByType: User
type: Microsoft.App/containerApps

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 16:34:59