-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Description
Not sure if this is a bug or a "work as designed", but I see a lot of students run into issues with this in training, so I figured more folks may have problems with this. We may want to make this a bit more user friendly.
When configuring cluster.routing.allocation.awareness.attributes via _cluster/settings, the setting does not accept an array of values. If you do provide an array of values, the cluster will end up in a red status when creating a new index.
Elasticsearch version (bin/elasticsearch --version):
Version: 6.2.4, Build: ccec39f/2018-04-12T20:37:28.497551Z, JVM: 1.8.0_77
Plugins installed: []
none
JVM version (java -version):
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
OS version (uname -a if on a Unix-like system):
Darwin MacBook-1265.local 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
Description of the problem including expected versus actual behavior:
Because the setting is named "attributes", folks expect to be able to provide an array of values for this setting (for example ["bar","baz"]). However, if you do so, the cluster ends up in a red status when creating a new index. Even when configuring multiple values, these values have to be provided comma-separated as a single string (for example "bar,baz").
Steps to reproduce:
- Start a one-node cluster and configure the node with:
node.attr.foo: bar - Get the cluster's health and check the status is green or yellow:
GET _cluster/health - Apply the following cluster setting:
PUT _cluster/settings
{
"persistent": {
"cluster.routing.allocation.awareness.attributes": [
"foo"
]
}
}
- Create a new index:
PUT my_index - The cluster status is now red:
GET _cluster/health - Use
GET _cluster/allocation/explainto find out why:
"explanation": "node does not contain the awareness attribute [[foo]]; required attributes cluster setting [cluster.routing.allocation.awareness.attributes=[foo]]"
- Change the cluster setting and provide a string value instead of an array:
PUT _cluster/settings
{
"persistent": {
"cluster.routing.allocation.awareness.attributes": "foo"
}
}
- The cluster is now yellow:
GET _cluster/health
Provide logs (if relevant):
[2018-05-15T15:07:10,668][INFO ][o.e.c.m.MetaDataCreateIndexService] [rGKXCKp] [my_index] creating index, cause [api], templates [], shards [5]/[1], mappings []
[2018-05-15T15:07:10,672][INFO ][o.e.c.r.a.AllocationService] [rGKXCKp] Cluster health status changed from [YELLOW] to [RED] (reason: [index [my_index] created]).
[2018-05-15T15:08:21,596][DEBUG][o.e.a.a.c.a.TransportClusterAllocationExplainAction] [rGKXCKp] explaining the allocation for [ClusterAllocationExplainRequest[useAnyUnassignedShard=true,includeYesDecisions?=false], found shard [[allblogs_us-en][2], node[null], [R], recovery_source[peer recovery], s[UNASSIGNED], unassigned_info[[reason=CLUSTER_RECOVERED], at[2018-05-15T13:05:26.878Z], delayed=false, allocation_status[no_attempt]]]
[2018-05-15T15:09:51,178][INFO ][o.e.c.s.ClusterSettings ] [rGKXCKp] updating [cluster.routing.allocation.awareness.attributes] from [[foo]] to [foo]
[2018-05-15T15:09:51,178][INFO ][o.e.c.s.ClusterSettings ] [rGKXCKp] updating [cluster.routing.allocation.awareness.attributes] from [[foo]] to [foo]
[2018-05-15T15:09:51,246][INFO ][o.e.c.r.a.AllocationService] [rGKXCKp] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[my_index][0]] ...]).