biolinh
biolinh

Reputation: 2225

elasticsearch - remove a second elasticsearch node and add an other node, get unassigned shards

As a starter in Elasticsearch, I just use it for two weeks ago and I have just did a silly thing.

My Elasticsearch has one cluster with two nodes, one master-data node (version 1.4.2), one non-data node (version 1.1.1).There was conflict version when using, I decided to shutdown and delete the non-data node then, install another data node (version 1.4.2) See my image for easy imagine. node3 is named node2 then enter image description here

Then, I check elastic status

{ 
    "cluster_name":"elasticsearch",
    "status":"yellow",
    "timed_out":false,
    "number_of_nodes":2,
    "number_of_data_nodes":2,
    "active_primary_shards":725,
    "active_shards":1175,
    "relocating_shards":0,
    "initializing_shards":0,
    "unassigned_shards":273
}

Check the cluster state

curl -XGET http://localhost:9200/_cat/shards


    logstash-2015.03.25 2 p STARTED       3031  621.1kb 10.146.134.94 node1        
    logstash-2015.03.25 2 r UNASSIGNED
    logstash-2015.03.25 0 p STARTED       3084  596.4kb 10.146.134.94 node1        
    logstash-2015.03.25 0 r UNASSIGNED                                                     
    logstash-2015.03.25 3 p STARTED       3177  608.4kb 10.146.134.94 node1        
    logstash-2015.03.25 3 r UNASSIGNED                                                     
    logstash-2015.03.25 1 p STARTED       3099  577.3kb 10.146.134.94 node1       
    logstash-2015.03.25 1 r UNASSIGNED                      
    logstash-2014.12.30 4 r STARTED                     10.146.134.94 node2 
    logstash-2014.12.30 4 p STARTED         94  114.3kb 10.146.134.94 node1        
    logstash-2014.12.30 0 r STARTED        111  195.8kb 10.146.134.94 node2 
    logstash-2014.12.30 0 p STARTED        111  195.8kb 10.146.134.94 node1       
    logstash-2014.12.30 3 r STARTED        110    144kb 10.146.134.94 node2 
    logstash-2014.12.30 3 p STARTED        110    144kb 10.146.134.94 node1

I have read related question and tried to follow it but no luck. I also comment in the answer the error i got.

ElasticSearch: Unassigned Shards, how to fix?


https://t37.net/how-to-fix-your-elasticsearch-cluster-stuck-in-initializing-shards-mode.html

elasticsearch - what to do with unassigned shards

http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-reroute.html#cluster-reroute

curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
    "commands" : [ {
          "allocate" : {
              "index" : "logstash-2015.03.25", 
              "shard" : 4, 
              "node" : "node2", 
              "allow_primary" : true
          }
        }
    ]
}'

I get

"routing_nodes":{"unassigned":[{"state":"UNASSIGNED","primary":false,"node":null,
"relocating_node":null,"shard":0,"index":"logstash-2015.03.25"}

And I followed the answer in https://stackoverflow.com/a/23781013/1920536

curl -XPUT 'localhost:9200/_cluster/settings' -d '{
"transient" : {
    "cluster.routing.allocation.enable" : "all"
}
}'

but no affection.

what should i do ? Thank in advances.

Update: when I check pending task, it shows that:

{"tasks":[{"insert_order":88401,"priority":"HIGH","source":"shard-failed 
    ([logstash-2015.01.19][3], node[PVkS47JyQQq6G-lstUW04w], [R], s[INITIALIZING]),
    **reason [Failed to start shard, message** [RecoveryFailedException[[logstash-2015.01.19][3]: **Recovery failed from** [node1][_72bJJX0RuW7AyM86WUgtQ]
    [localhost][inet[/localhost:9300]]{master=true} into [node2][PVkS47JyQQq6G-lstUW04w]
    [localhost][inet[/localhost:9302]]{master=false}]; 
    nested: RemoteTransportException[[node1][inet[/localhost:9300]]
    [internal:index/shard/recovery/start_recovery]]; nested: RecoveryEngineException[[logstash-2015.01.19][3] Phase[2] Execution failed];
    nested: RemoteTransportException[[node2][inet[/localhost:9302]][internal:index/shard/recovery/prepare_translog]];
    nested: EngineCreationFailureException[[logstash-2015.01.19][3] **failed to create engine]; 
    nested: FileSystemException**[data/elasticsearch/nodes/0/indices/logstash-2015.01.19/3/index/_0.si: **Too many open files**]; ]]","executing":true,"time_in_queue_millis":53,"time_in_queue":"53ms"}]}

Upvotes: 0

Views: 2374

Answers (1)

Roopendra
Roopendra

Reputation: 7776

If you have two nodes like
1) Node-1 - ES 1.4.2
2) Node-2 - Es 1.1.1

Now follow these steps to debug.

1) Stop all elasticsearch instance from Node-2.
2) Install elasticsearch 1.4.2 in new elasticsearch node. Change elasticsearch.yml as master node configuration , specially these three config settings

 cluster.name: <Same as master node>
 node.name: < Node name for Node-2>
 discovery.zen.ping.unicast.hosts: <Master Node IP>

3) Restart Node-2 Elasticsearch.
4) Verify Node-1 logs.

Upvotes: 0

Related Questions