Part 4 Series of Elasticsearch Cluster on Spot Instances with zero downtime in App?




Shard allocation concept can help us to use spot instance on Elasticsearch Data nodes:


By using rack feature in elasticsearch node we can tell that primary
shard to be on one rack and its replica shard to be on another rack.
Like as per our elasticsearch setup we have divided ondemand rack
and spot rack as per below elasticsearch.yml configuration.


elasticsearch.yml for ondemand rack:
cluster.name: my-application-1
node.name: ondemand
path.data: /data/elasticsearch-1-2
path.logs: /var/log/elasticsearch
http.port: 9200
node.master: false
node.data: true
node.attr.rack_id: ondemand
cluster.routing.allocation.awareness.attributes: rack_id
discovery.zen.ping.unicast.hosts: ["nb-master-es1.testing.com", "nb-master-es2.testing.com",”nb-master-es3.testing.com”]


elasticsearch.yml for onspot rack:
cluster.name: my-application-1
node.name: onspot
path.data: /data/elasticsearch-1-5
path.logs: /var/log/elasticsearch
http.port: 9200
node.master: false
node.data: true
node.attr.rack_id: spot
cluster.routing.allocation.awareness.attributes: rack_id

discovery.zen.ping.unicast.hosts: ["nb-master-es1.testing.com", "nb-master-es2.testing.com",”nb-master-es3.testing.com”]


We can see shards well dispersed by keeping replica as 1 so we
can see below that are data is divided into primary and replica
shards evenly distributed between ondemand and onspot
rack configured nodes.


Lets stop all our spot instances and then check the cluster health:

So from above snapshot we can see if our spot instances goes
away our cluster will be in yellow state and our searching and
indexing functionality will not be impacted as our primary
shard is healthy.Hence we can run our Elasticsearch cluster
on spot instances in order to save $ xxxx from our current
ondemand Infrastructure.


Reference:
https://www.objectrocket.com/blog/elasticsearch/top-elasticsearch-use-cases/

Comments

Popular posts from this blog

What is a Devops ??

Part 1 Series of Elasticsearch Cluster on Spot Instances with zero downtime in App?