The number of shards cannot be changed once the index is created. However,
the number of shards can be specified as any value you wish when the index
is being created. I've created various indices with 1, 5 (default and
explicit), 16, and 10 shards.
The number of replicas per shard can be set when the index is created and
can be changed any time thereafter, even on a live in-use index. For one of
my cluster-based tests, I create an index with 5 shards a 0 replicas, then
bulk-load the initial set of 97 million records. About an hour later (when
the load is completed), I dynamically set the number of replicas to 2 (so
now each shard has 3 copies, one for each of my active nodes in the
cluster). In a few minutes, the shards are all replicated. (Using version
0.90.0 the initial load is about the same, the replicas take less time to
all come up in the green, and the disk usage is dramatically smaller).
Somebody with internal knowledge can answer your last question. But from
the outside looking in, the assignment of the primary shard is dynamic. For
example, I loaded the 97 million records, and I watched the 5 shards
distributed evenly (as much as possible) across the 3 machines: shards 0,
1, 2, 3, and 4 were assigned to nodes A, B, C, A, and B, respectively.
When I bumped up the number of replicas to 2, those original shards
remained as primary shards and the replicas filled out in about a minute or
Then I applied over 3 million updates (mix of index + delete actions).
But this weekend, our server closet suffered outages due to heat issues.
One of the servers in the cluster never came back on-line, and the two
remaining servers (nodes) now contained all of the primary shards plus one
of the two replicas. When that 3rd server came back up this morning, the
cluster took a minute or so and got all replicas verified and up-to-date on
that node. But that node no longer contained any primary shards: It
contains only replicas now.
Very cool. An unintended test of node failure and cluster recovery, and it
went perfectly smoothly!
On Monday, May 6, 2013 2:00:55 PM UTC-4, vinod eligeti wrote:
I was going through "To Infinity and Beyond" video where it mentions the
number of primary shards ( but default is 5) cannot be changed however, the
number of replica shards can?
I want to confirm whether that is true or not? Also what is the difference
in operations done at the primary shard which is not done at the replica
Thanks in advance
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
For more options, visit https://groups.google.com/groups/opt_out.