Warm tip: This article is reproduced from serverfault.com, please click

Automatically connect to closest Azure Cosmos DB location?

发布于 2020-12-06 15:00:01

Is there a way, preferable in the Python SDK, but also just generally with any SDK/language or even just over plain HTTPS, to automatically connect to the closest region (by latency or some other metric) of a geo-replicated Azure Cosmos DB?

You can set the preferred_locations, but ideally I would like my app to automatically discover which region is the closest and connect to that (and fail over to another one if needed).

Questioner
silent
Viewed
0
silent 2020-12-21 16:53:35

To update on this: The missing feature/switch is called ApplicationRegion which is already present in the .NET SDK. There is now a feature request on GitHub to add this to the Python SDK as well: https://github.com/Azure/azure-sdk-for-python/issues/15685