Unassigned shards

Hi there,
I've got a problem with unassigned shards. If I use the state command to
get all shards, every of these has one started and one unassigned.

"shards" : {
"0" : [ {
"state" : "STARTED",
"primary" : true,
"node" : "dhzWgQR3QOiuOnB9qICSew",
"relocating_node" : null,
"shard" : 0,
"index" : "logstash-2013.11.27"
}, {
"state" : "UNASSIGNED",
"primary" : false,
"node" : null,
"relocating_node" : null,
"shard" : 0,
"index" : "logstash-2013.11.27"
} ], ...

It means, that the cluster.health command returns:
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 105,
"active_shards" : 105,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 105
}

But now I do not know how to get rid of the unassigned shards to get green
status.
I tried cluster reroutehttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-reroute.html,
but it returns
{"error":"ElasticSearchIllegalArgumentException[[allocate] allocation of
[logstash-2013.11.12][0] on node [Red
Ronin][dhzWgQR3QOiuOnB9qICSew][inet[server.com/192.168.5.183:9300]] is not
allowed, reason:
[NO()][YES()][YES()][YES()][YES()][YES()][YES()]]","status":400}

Don't you have any idea how to solve the problem, please?
Thank you

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b44d2600-7fff-4286-bf5e-3a9b374f07a0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Start a new node.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 nov. 2013 à 16:28, Honza dufeja@gmail.com a écrit :

Hi there,
I've got a problem with unassigned shards. If I use the state command to get all shards, every of these has one started and one unassigned.

"shards" : {
"0" : [ {
"state" : "STARTED",
"primary" : true,
"node" : "dhzWgQR3QOiuOnB9qICSew",
"relocating_node" : null,
"shard" : 0,
"index" : "logstash-2013.11.27"
}, {
"state" : "UNASSIGNED",
"primary" : false,
"node" : null,
"relocating_node" : null,
"shard" : 0,
"index" : "logstash-2013.11.27"
} ], ...

It means, that the cluster.health command returns:
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 105,
"active_shards" : 105,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 105
}

But now I do not know how to get rid of the unassigned shards to get green status.
I tried cluster reroute, but it returns
{"error":"ElasticSearchIllegalArgumentException[[allocate] allocation of [logstash-2013.11.12][0] on node [Red Ronin][dhzWgQR3QOiuOnB9qICSew][inet[server.com/192.168.5.183:9300]] is not allowed, reason: [NO()][YES()][YES()][YES()][YES()][YES()][YES()]]","status":400}

Don't you have any idea how to solve the problem, please?
Thank you

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b44d2600-7fff-4286-bf5e-3a9b374f07a0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/D9496591-8D02-49B5-B1D1-F9162134B1EA%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.

Please reply to the mailing list.

Yes I can. Elasticsearch is distributed. By default an index is split into 5 shards and ask for 1 replica per shard.
When you have a single node, the first 5 primary shards are allocated on that node.
5 replicated shards are not allocated as it does not make sense to make copies of same data on the same node, right?

When you start a new node, it join the cluster. Elasticsearch can now allocate the replicas.

That said, in development, you don't really have to worry about YELLOW status. It does not mean that your cluster does not work. It only indicates that if you loose another node you will probably have problems!

You can create an index without replica. In that case, your cluster will remain green: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html#indices-create-index
You can also decrease the number of replica on a live index: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-update-settings.html#indices-update-settings

Have a look at this small video: http://www.elasticsearch.org/videos/distributed-diagram/
And others as well here: http://www.elasticsearch.org/videos/

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 28 novembre 2013 at 16:51:29, Honza (dufeja@gmail.com) a écrit:

Thanks for your answer, it really works!
But I would like to know why :slight_smile: Can you explain it to me, please?

Thank you

Dne čtvrtek, 28. listopadu 2013 16:35:15 UTC+1 David Pilato napsal(a):
Start a new node.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 nov. 2013 à 16:28, Honza duf...@gmail.com a écrit :

Hi there,
I've got a problem with unassigned shards. If I use the state command to get all shards, every of these has one started and one unassigned.

"shards" : {
"0" : [ {
"state" : "STARTED",
"primary" : true,
"node" : "dhzWgQR3QOiuOnB9qICSew",
"relocating_node" : null,
"shard" : 0,
"index" : "logstash-2013.11.27"
}, {
"state" : "UNASSIGNED",
"primary" : false,
"node" : null,
"relocating_node" : null,
"shard" : 0,
"index" : "logstash-2013.11.27"
} ], ...

It means, that the cluster.health command returns:
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 105,
"active_shards" : 105,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 105
}

But now I do not know how to get rid of the unassigned shards to get green status.
I tried cluster reroute, but it returns
{"error":"ElasticSearchIllegalArgumentException[[allocate] allocation of [logstash-2013.11.12][0] on node [Red Ronin][dhzWgQR3QOiuOnB9qICSew][inet[server.com/192.168.5.183:9300]] is not allowed, reason: [NO()][YES()][YES()][YES()][YES()][YES()][YES()]]","status":400}

Don't you have any idea how to solve the problem, please?
Thank you

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b44d2600-7fff-4286-bf5e-3a9b374f07a0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.52976d3a.4ad084e9.3e14%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.