Hello, If I configure the nodes in my cluster to have a node attribute
'node.zone' with values "zone1", "zone1", etc
and then configure an index as follows:
Will elasticsearch auto expand the replica shards for index 'test' only
within zone1 or will the auto_expand_replicas option ignore the shard
allocation directives and auto replicate across the entire cluster?
With an index configured with auto_expand_replicas="0-all" the cluster will
try to allocate one primary and ({number nodes} - 1) replicas for each
shard, ie a copy of each shard on each node.
However, with "index.routing.allocation.include.zone"="zone1" the cluster
is blocked from allocating a shard (either primary or replica) to any nodes
that are not configured with a zone attribute set to "zone1", ie
"node.zone=zone1" in the elasticsearch.yaml config file. So if a cluster
has 3 nodes in "zone1" and 3 nodes in "zone2" it will allocate 3 shards
(primary + 2 x replicas) to the "zone1" nodes and mark an additional 3
replicas as unassigned. I observed this using the elasticsearch head
utility.
So the allocation behaviour is as desired, ie auto expand replicas to all
nodes with a specific zone attribute.
I do not know if the unassigned replicas will cause problems for the
cluster.
Can anyone add to this?
Below is the HTTP request I used to create the index
We are experiencing this as well. The Unassigned shards in this case (when
auto-expand-replica is set to some value and the index has include/exclude
stuff set) will make your cluster status be in RED state, which is bad.
I opened a ticket for this here:
On Wednesday, September 5, 2012 5:58:11 PM UTC+3, Mauri wrote:
Hello, Decided to do a test to investigate this.
With an index configured with auto_expand_replicas="0-all" the cluster
will try to allocate one primary and ({number nodes} - 1) replicas for each
shard, ie a copy of each shard on each node.
However, with "index.routing.allocation.include.zone"="zone1" the cluster
is blocked from allocating a shard (either primary or replica) to any nodes
that are not configured with a zone attribute set to "zone1", ie
"node.zone=zone1" in the elasticsearch.yaml config file. So if a cluster
has 3 nodes in "zone1" and 3 nodes in "zone2" it will allocate 3 shards
(primary + 2 x replicas) to the "zone1" nodes and mark an additional 3
replicas as unassigned. I observed this using the elasticsearch head
utility.
So the allocation behaviour is as desired, ie auto expand replicas to all
nodes with a specific zone attribute.
I do not know if the unassigned replicas will cause problems for the
cluster.
Can anyone add to this?
Below is the HTTP request I used to create the index
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.