docker Cosmos DB模拟器的运行状况检查失败

hk8txs48  于 2023-06-05  发布在  Docker
关注(0)|答案(1)|浏览(174)

我正在尝试使用Docker运行Cosmos DB模拟器。以下是docker compose文件。

version: '3'
services:
  cosmosdb-emulator:
    image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
    ports:
      - 8081:8081
      - 10251:10251
      - 10252:10252
      - 10253:10253
      - 10254:10254
    mem_limit: 4g
    cpus: 2.0
    environment:
      - AZURE_COSMOS_EMULATOR_PARTITION_COUNT=5
      - AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true
      - AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=${LOCAL_IP}
    env_file:
      - .env
    healthcheck:
      test:
        [
          "CMD",
          "curl",
          "-f",
          "-k",
          "https://${LOCAL_IP}:8081/_explorer/emulator.pem",
        ]
      interval: 30s
      timeout: 10s
      retries: 3
    volumes:
      - cosmos-data:/tmp/cosmos/appdata
volumes:
  cosmos-data:

我可以在终端上看到以下内容,在运行docker compose上面的文件。

[+] Running 1/1
 ⠿ Container cosmosdb-cosmosdb-emulator-1  Recreated                                                                                    0.1s
Attaching to cosmosdb-cosmosdb-emulator-1
cosmosdb-cosmosdb-emulator-1  | This is an evaluation version.  There are [172] days left in the evaluation period.
cosmosdb-cosmosdb-emulator-1  | Starting
cosmosdb-cosmosdb-emulator-1  | Started 1/6 partitions
cosmosdb-cosmosdb-emulator-1  | Started 2/6 partitions
cosmosdb-cosmosdb-emulator-1  | Started 3/6 partitions
cosmosdb-cosmosdb-emulator-1  | Started 4/6 partitions
cosmosdb-cosmosdb-emulator-1  | Started 5/6 partitions
cosmosdb-cosmosdb-emulator-1  | Started 6/6 partitions
cosmosdb-cosmosdb-emulator-1  | Started
cosmosdb-cosmosdb-emulator-1  | Started 7/6 partitions
cosmosdb-cosmosdb-emulator-1  | Started 8/6 partitions
cosmosdb-cosmosdb-emulator-1  | Started 9/6 partitions
cosmosdb-cosmosdb-emulator-1  | Started 10/6 partitions

它会在启动的10/6分区上卡住。为什么我看不到正确的启动消息?
为什么健康检查失败?我也试着用以下方法检查健康状况:
curl -k --fail https://192.168.29.32:8081/_explorer/healthcheck
我可以在终端上运行上面的curl命令时看到这一点:curl: (22) The requested URL returned error: 404
最后,为什么有10/6分区启动,而我配置的分区数量为5
P.S:我可以访问https://localhost:8081/_explorer/index.html上的门户,我也可以创建数据库/容器。
.env文件:

LOCAL_IP=192.168.29.32
yqkkidmi

yqkkidmi1#

运行状况检查失败,因为您使用的URL(https://${LOCAL_IP}:8081/_explorer/emulator.pem)不是运行状况检查的正确端点。模拟器健康检查端点为https://${LOCAL_IP}:8081/_explorer/healthcheck。更新运行状况检查,并让我们知道这是否适合您。

相关问题