I've three node elasticsearch cluster, then I remove two node, the last node can only be searchable, but cannot works well, as it cannot success the master election.
I've try to restart it, and remove the config related to cluster before restart, but it not works.
How can I make it as a single cluster node?
When I make the node as the single node. Then I access the node, it will show below info, which means the state of this node is not well.
$ curl localhost:8200/song/_search
{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];"}],"type":"cluster_block_exception","reason":"blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];"},"status":503}
Then I check the data directory of elasticsearch like below
$ ls data/nodes/0/
indices node.lock snapshot_cache _state
Then I remove all other file or directory except the indices directory which hold the data.
One more thing is that, you also need to edit the elasticsearch config file to remove config related to cluster.
Then restart the node and check it.
$ curl localhost:8200/_cat/nodes
127.0.0.1 39 45 1 0.00 0.11 0.18 cdfhilmrstw * node-249-dev
$ curl localhost:8200/song/_search?pretty
{
"took" : 11,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {