Hey there,
if I start a cluster with 3 nodes from scratch without any DATA nodes, is there a way to mark immediately it with YELLOW status?
Interesting !
It seems to me that :
- Yellow: if all primaries are allocated but at least one replicat is not.
- In addition, the health status of the cluster is Yellow, if a replica is missing.
Now, is the status YELLOW if the cluster has no index? It is very likely.
Either way, this shouldn't be a major problem
At the first execution, with no indices created, the status is green.
The health of a cluster depends in part on the current partition allocation. Could the fact that you have no data nodes on your cluster be a problem? I don't know ^^
A cluster need at least one data node as there otherwise are no place to store system indices, e.g. the security index.
If an application tries to insert docs into the cluster before the data nodes have joined it, index could be created without the correct mapping if I have not any correct procedure to load the mapping and settings. yes, technically it could be a problem.
so, if no DATA nodes are inside the cluster why cluster should be GREEN? In that moment it is not able to provide correctly its service.
Green state indicates that all shards are allocated and that a master has been elected. If you do not have security enabled and no other features that require indices to be created there are no shards that can not be allocated and the state may be green.
ok, this is the current approach. But let me say that if I create from scratch a cluster (on cloud environment and/or using containers or whatever we want to talk about), and I have an application that will collect and send data continuously, ignoring if cluster has been recreated, it will create a basic index (that will remain offline for sure), with no specific mapping or something else. Sure, you could say that application should be so smart to individuate this scenario (num.data=0) but not always you could modify the code.
Furthermore, if no data joined the cluster, why should it be able to accept the PUT _index API (that will make the status RED)?
Green state indicates what you wrote before but probably, it is just my opinion, that is a grey zone. Maybe, we could have a parameter that indicates if you want to switch immediately to YELLOW state if you haven't data node at the first boot. While, if you loose a data node with its indices, you will go RED.
Last but least, if status is green my application will start to send data. If no data node is present, cluster will go red. It is fake
The red/yellow/green health simply indicates how many unassigned shards there are in the cluster. Red means there's ≥1 unassigned primary, yellow means there's 0 unassigned primaries but ≥1 unassigned replicas, and green means there's no unassigned shards. If the cluster has no shards then it has no unassigned shards, so green is the correct colour. It's definitely not the only measure of health you could use, and it sounds like it's not right for your application, so it'd be best not to use it.
If you want the cluster to wait for some number of data nodes at startup, set gateway.recover_after_data_nodes
(see docs for more details).
What is the point in recreating a cluster without data nodes?
Data nodes could just arrive seconds later.
As @Christian_Dahlqvist said, your ES cluster must have at least one data node (skock and process the data) otherwise you will not be able to push data
Thank you for your answer but this was clear to me even before to post this thread. I found that in a particular scenario there could be a data loss. Anyway, it is not important, I will try to use @DavidTurner documentation link.
Thanks
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.