The GCE discovery can also filter machines to include in the cluster based on tags using
For example, setting
dev will only filter instances having a tag set to
dev. Several tags
set will require all of those tags to be set for the instance to be included.
One practical use for tag filtering is when an GCE cluster contains many nodes that are not running
Elasticsearch. In this case (particularly with high
discovery.zen.ping_timeout values) there is a risk that a new
node’s discovery phase will end before it has found the cluster (which will result in it declaring itself master of a
new cluster with the same name - highly undesirable). Adding tag on Elasticsearch GCE nodes and then filtering by that
tag will resolve this issue.
Add your tag when building the new instance:
gcloud compute instances create myesnode1 --project=es-cloud \ --scopes=compute-rw \ --tags=elasticsearch,dev
Then, define it in
cloud: gce: project_id: es-cloud zone: europe-west1-a discovery: type: gce gce: tags: elasticsearch, dev