3 indices never turns to yellow or green?

Hi Experts,

I have 10 total indices on two ES1.7.1 nodes i.e one on each server. Now when I turn off my server 2 or stop ES2 , cluster health turns into red because of 3 indices(every Index holds 33 GB of data) . These 3 indices have 5 shards but 0 replica.Both ES nodes are data nodes and anyone can be a master node.

I am loosing data because of this red status as I can see less documents i these 3 indices. Please help me to resolve and understand this problem . I have read many document and tried following.

PUT /_cluster/settings
{
"persistent": {
"cluster.routing.allocation.disable_allocation": true,
"cluster.routing.allocation.enable": "none"
}
}

Waited for status to turn Yellow but it never happens, so changed back to

PUT /_cluster/settings
{
"persistent": {
"cluster.routing.allocation.disable_allocation": false,
"cluster.routing.allocation.enable": "all"
}

Please help me on this .

All the three indices turns to green only if I again restart ES2, not sure what is happening .Here confusion is if both the nodes are data nodes then why it is turning status to red .

Red status indicates that you have primary shards unassigned. When you shut down one node, the primary shards on that node for which no replica exists that can be promoted to primary will be unassigned. Only when you restart the node again are all primary shards available, which allows the state to move from red status. You can get around this by either manually move the primary shards that have no replicas to the other node prior to shutting it down or enable a replica for those indices.

Thanks Chris,

Still i did not get this , i deliberately assigned 0 replica to those indices , as i do not want to consume more disk space .Now , in this case if one server or ES1 goes down why I can only see ES2 data , what is the purpose of having two data nodes then . As per my understanding ES stores data on both the servers if one goes down other will show your data and status would be based on the replica settings , if we have replica then it will be yellow else green(when one ES node is down) .As you said red means primary shards are unassigned , how it is possible if data is on both the nodes. Please correct me if I am wrong.

If you have indices with no replica configured, you can not expect high availability. Some shards will only be stored on one of the nodes and will therefore not be available when one of the nodes go down, resulting in a red status. It is the fact that you have a replica to fall back on when a node is taken offline that allows Elasticsearch to instead go to yellow state (means that one or more replica shards are unassigned, but all primary shards are available) by promoting this replica shard to primary.

Ah!! I get it now , that means if I want to have 0 replica then I should be very careful that index should be on single elastic node , so better to have one node rather 2 .But i will not have HA with this approch .

Thank you for clearing my doubt Chris , you are awesome :wink: