Guides and examples

Elasticsearch Node Types

Below is a breakdown of how you can use groups to allocate different node types to a number of servers. If all you want to do is use ES as a single server dependency in another role then include the role in your role's meta main file. You don't have to add the groups in your inventory in that case.

The Elasticsearch upstream configuration has two settings, node.master and node.data. A combination of those settings being True or False determines what type of node your server will be.

Master servers (node.master: True and node.data: True)

This is the default setting for all nodes in Elasticsearch.

[debops_service_elasticsearch_master]
apple
orange
banana

Workhorse servers (node.master: False and node.data: True)

The server will never become a master but it will hold data.

[debops_service_elasticsearch_workhorse]
red
blue

Coordinator servers (node.master: True and node.data: False)

A coordinator can become master but it doesn't store data. Its goal is to always have a lot of free resources.

[debops_service_elasticsearch_coordinator]
nyancat

Search load balancer servers (node.master: False and node.data: False)

Inventory host groups

It's always useful to have a common group that composes everything. Elasticsearch will be installed on any server that belongs to any of the above groups.

This group would mainly be used for firewall settings which would apply to all of your ES nodes. It does not control whether or not ES gets installed.

[debops_service_elasticsearch:children]
debops_service_elasticsearch_master
debops_service_elasticsearch_workhorse
debops_service_elasticsearch_coordinator
debops_service_elasticsearch_loadbalancer

They are just shortcuts to setting the two node settings for you. You don't have to use the extra groups. By all means create custom groups and set the variables yourself if you want.

You can also edit the defaults to use your own custom group names and still get the benefits of group based node type separation.

Example configuration

elasticsearch_bind_host: ['0.0.0.0']
elasticsearch_node_allow: '{{ groups["debops_elasticsearch"] }}'
elasticsearch_http_allow: '{{ groups["your_web_apps"] }}'

The above example tells ES to accept connections from anywhere and then white lists your ES group so they can all talk to each other

In addition to that is white lists your app servers so they can access the ES HTTP API to actually query ES.