Shard recovery with only one node in the cluster


(f.shantanu) #1

I have an elastic search cluster with 3 data nodes. I have set up the
indices to have 5 shards and 2 replicas/shard. I have noticed that if I
shut down the cluster and start just one node then the shards remain
unallocated. The shards get allocated when I start up all the other nodes
in the cluster. Is there any thing I can do so that atleast all the primary
shards are allocated even if there is just one node in the cluster? Note
the indices are recovered but not allocated, i.e. the cluster health is red.

--


(Clinton Gormley) #2

On Mon, 2012-09-24 at 13:26 -0700, Shantanu wrote:

I have an elastic search cluster with 3 data nodes. I have set up the
indices to have 5 shards and 2 replicas/shard. I have noticed that if
I shut down the cluster and start just one node then the shards remain
unallocated. The shards get allocated when I start up all the other
nodes in the cluster. Is there any thing I can do so that atleast all
the primary shards are allocated even if there is just one node in the
cluster? Note the indices are recovered but not allocated, i.e. the
cluster health is red.

Change the number of replicas to 2. That will ensure that each of your
nodes has a copy of all of the data.

Alternatively, start all 3 nodes, then shut down 1 and wait for the
cluster to return to 'green'. Then you can shut down a second node, and
the remaining node will have all the data (although cluster health will
be yellow, because it is missing a replica)

clint

--

--


(f.shantanu) #3

I already have the number of replicas set to 2. When I start up all the
nodes and shut them one by one then indexing and searching works fine with
just one node in the cluster (I have set the write consistency to 1).
However we have use cases where we need to start up just one node.

As I mentioned in my original post, when I start up one node, the primary
shards are not allocated until there are atleast 2 nodes in the cluster.
This behavior is some how associated with the with the number of replicas.
When I reduce the number of replicas to 1 then the primary shards are
allocated as soon as the first node comes up. I could not find any
documentation explaining why this happens. Is there any way of getting
around this w/o changing the number of replicas?

On Tuesday, September 25, 2012 5:50:27 AM UTC-4, Clinton Gormley wrote:

On Mon, 2012-09-24 at 13:26 -0700, Shantanu wrote:

I have an elastic search cluster with 3 data nodes. I have set up the
indices to have 5 shards and 2 replicas/shard. I have noticed that if
I shut down the cluster and start just one node then the shards remain
unallocated. The shards get allocated when I start up all the other
nodes in the cluster. Is there any thing I can do so that atleast all
the primary shards are allocated even if there is just one node in the
cluster? Note the indices are recovered but not allocated, i.e. the
cluster health is red.

Change the number of replicas to 2. That will ensure that each of your
nodes has a copy of all of the data.

Alternatively, start all 3 nodes, then shut down 1 and wait for the
cluster to return to 'green'. Then you can shut down a second node, and
the remaining node will have all the data (although cluster health will
be yellow, because it is missing a replica)

clint

--

--


(system) #4