Azure / azure-cosmos-db-emulator-docker

This repo serves as hub for managing issues, gathering feedback, and having discussions regarding the Cosmos DB Emulator Docker.
https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-develop-emulator?tabs=docker-linux%2Ccsharp&pivots=api-nosql
MIT License
145 stars 44 forks source link

AZURE_COSMOS_EMULATOR_PARTITION_COUNT is ignored #83

Closed hades200082 closed 1 week ago

hades200082 commented 6 months ago

Describe the bug When starting the container, it seems to "sort of" ignore the AZURE_COSMOS_EMULATOR_PARTITION_COUNT environment variable and always tries to start 11 partitions.

I set AZURE_COSMOS_EMULATOR_PARTITION_COUNT=4 and this was the log output in docker:

image

My compose file:

version: "3.9"
volumes:
  cosmos-db-volume:

networks:
  customnet:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 192.168.55.0/24
          gateway: 192.168.55.1

services:
  cosmosdb:
    image: "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest"
    restart: unless-stopped
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 3G
    environment:
      - AZURE_COSMOS_EMULATOR_PARTITION_COUNT=4
      - AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true
      - AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=127.0.1.1
    ports:
      - "8081:8081"
      - "8900:8900"
      - "8901:8901"
      - "8979:8979"
      - "10250-10256:10250-10256"
      - "10350:10350"
    networks:
      customnet:
        ipv4_address: 192.168.55.20
    volumes:
      - cosmos-db-volume:/tmp/cosmos/appdata

Expected behavior It should only start the number of partitions specified.

Desktop (please complete the following information):

Docker Images Used:

**Arguments && Environment variables to start Docker:

Docker Environment

amanrao23 commented 6 months ago

Hi @hades200082, Emulator is picking up number of partitions that were created for the initially (first time when partitions were created) in the volume. We are looking into this. For now, you could try creating a new volume if you want to change the partition count or remove the volume if you don't want data persistence.

sajeetharan commented 1 week ago

Please feel free to open if you are facing this issue again!