Prevention and brain-split of cerebral fissure in Elasticsearch cluster __elasticsearch

Source: Internet
Author: User

What is the brain crack.

In the ES cluster internal network communication problem, the node in the cluster and master communication is disconnected, the node will think that the current cluster does not master, the node from the original cluster will again elect master, so that the original cluster will have more than master, Different nodes are subordinate to different master, which is called Brains (split)

The brain crack can cause the cluster to be in the risk of losing data, because Master is considered to be the highest ruler in the cluster, it is responsible for the generation of new fragments, fragmentation, and so on, if there are two master in the cluster, the data integrity and consistency in the cluster will be broken.

On the problem of brain crack, the best way to deal with it is prevention, by setting configuration parameter minimum_master_nodes to prevent the cluster from appearing multiple master

The Minimum_master_nodes setting is important to the stability of the cluster, which tells the cluster to choose not to select the node as master unless the node is adequately qualified: This is the number of nodes that the node is supported to obtain

(number of master-eligible NODES/2) + 1 (value of all alternate master nodes/2) +1

For example: There are 10 regular nodes (both as data nodes and as master nodes), then Minimum_master_nodes is set to 6

If there are 3 master alternate nodes and 100 data nodes, then the Minimum_master_nodes is set to 2

If there are 2 regular nodes, it is awkward, minimum_master_nodes need to be set to 2, if one of the nodes hung, the cluster will not be available, if set to 1, can not prevent the brain crack


How to configure it.

The first method, which you can add in the configuration file elasticsearch.yml

Discovery.zen.minimum_master_nodes:2

But ES clusters are dynamic and often have operations to add nodes and delete nodes, which causes each node to modify the configuration file and restart the cluster is very bad. Using the second method

The second method, the dynamic API invocation configuration,

Put/_cluster/settings
{
    "persistent": {
        "discovery.zen.minimum_master_nodes": 2
    }
}}
You can use the Curl command

Curl-xput http://localhost:9201/_cluster/settings-d '
{
 "persistent": {
        "Discovery.zen.minimum_master _nodes ": 2
    }
}"
This is a permanent configuration, priority is higher than the configuration in the configuration file, you should modify the configuration, whether you are adding a node or deleting a node.

To view the current minimum_master_nodes value of a configuration cluster

Curl-xget localhost:9200/_cluster/settings

Attach Official document address and picture

Https://www.elastic.co/guide/en/elasticsearch/guide/1.x/_important_configuration_changes.html







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.