2
votes

How does RavenDB handles shard rebalancing/redistribution of data?

var shards = new Dictionary {
{"Asia", new DocumentStore {Url = "http://localhost:8080"}},
{"Middle East", new DocumentStore {Url = "http://localhost:8081"}},
{"America", new DocumentStore {Url = "http://localhost:8082"}},
};

For example in the above excerpt taken from their tutorial, the server containing Asia is impacted because China alone is over 1B people. So I need that data to be split between Asia1 (China) and Asia2 (The rest). What's the best way to rebalance the existing data?

Do I need to query all the Asia in the original document store and manually move them over to the new shard? Is there a faster way? Will an effort like this involve some down time? Do new indexes need to be rebuild?

1

1 Answers

0
votes

Alwyn, Usually, what will happen is that you'll add a Asia-2 server, and change your sharding function to createa all new Asia items in the Asia-2 server. You do that by overriding GenerateShardIdFor in the ShardResolutionStrategy. It doesn't require downtime or any new indexes.