ElasticSearch Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

Setting up different node types

ElasticSearch is natively designed for the Cloud, so when you need to release a production environment with a huge number of records, and you need high availability and good performances, you need to aggregate more nodes in a cluster.

ElasticSearch allows you to define different type of node to balance and improve overall performance.

Getting ready

You need a working ElasticSearch installation.

How to do it...

For the advanced setup of a cluster, there are some parameters that must be configured to define different node types.

These parameters are in config/elasticsearch.yml and can be set by performing these steps:

  1. Set up whether or not the node can be a master node:
    node.master: true
  2. Set up whether or not a node must contain data:
    node.data: true

How it works...

The node.master parameter defines whether the node can become a master for the Cloud. The default value for this parameter is true.

A master node is an arbiter for the Cloud: it takes decisions about shard management, it keeps the cluster's status, and it's the main controller of every index action.

The optimal number of master nodes is given by the following equation:

How it works...

node.data allows you to store data in the node. The default value for this parameter is true. This node will be a worker that indexes and searches data.

By mixing these two parameters, it's possible to have different node types:

The most frequently used node type is the first one, but if you have a very big cluster or special needs, then you can differentiate the scope of your nodes to better serve searches and aggregations.