Hi
Renze Yu •,
Welcome to Microsoft Q&A forum.
As I understand, your Cosmos DB emulator returns ServiceUnavailable (503).
Could you please try below:
1). Try resetting data which will clean containers and database.
2). Try increasing the emulator capacity.
Use:
First through the AZURE_COSMOS_EMULATOR_PARTITION_COUNT environment variable (here an extract on our docker compose):
cosmos_db_service:
container_name: cosmos_db
image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest
environment:
- AZURE_COSMOS_EMULATOR_PARTITION_COUNT=20
- AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true
AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=127.0.0.1
Second by defining a higher offerThroughput for each container (defined during our schema provisioning process):
await client.database(env.vars.MICROSOFT_COSMOSDB_DATABASE).containers.createIfNotExists(
{ id: containerId },
{ offerThroughput: 10000 } // throughput values between 400 and 1000000 inclusive in increments of 100
)
Please try and let us know the result. Thank you.