1

Is it possible to make a given Region as both Read/Write in CosmosDB Geo Redundant setup.

I am using Azure DocumentDB with Java SDK and tried to overwrite the location preference using the Connection policy as below

ConnectionPolicy policy = new ConnectionPolicy();
policy.setEnableEndpointDiscovery(true);
List<String> locations = new ArrayList<>();
locations.add("West US");
policy.setPreferredLocations(locations);

But i could still see some requests going to East in the Metrics Explorer. Any help here would be greatly appreciated.

TIA

Tom Sun - MSFT
  • 24,161
  • 3
  • 30
  • 47
SaiVikas
  • 162
  • 1
  • 12

1 Answers1

0

You also need to set enableEndpointDiscovery to be true.

When the value of this property is true, the SDK will automatically discover the current write and read regions to ensure requests are sent to the correct region based on the regions specified in the PreferredLocations property. Default value is true indicating endpoint discovery is enabled.

SAMPLE CODE

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
  • Yea i have already set that to true, but still i could see some requests going to other location as well – SaiVikas Mar 27 '18 at 03:40
  • Was the preferred location being throttled or not available? according to docs "If the read regions specified in the PreferredLocations are not available, reads will be served out of write region." – Sajeetharan Mar 27 '18 at 17:03