Build Elasticsearch 5.4.3 distributed cluster under Mac

Source: Internet
Author: User

First, the cluster role

Nodes in a multi-machine cluster can be divided into master nodes and data nodes, using the Zen Discovery (Zen discovery) mechanism in the configuration file to manage different nodes. Zen Discovery is the default discovery mechanism that comes with ES, using multicast to discover other nodes. As soon as you start a new ES node and set the same name as the cluster, the node is added to the cluster.

There are three roles in the Elasticsearch cluster: master node, data node, and client node.

    1. Master Node:master is mainly used for metadata (metadata) processing, such as index additions, deletions, shard allocations, and so on.
    2. Data shards are saved on the Node:data node. It is responsible for data-related operations, such as the CRUD of shards, and search and consolidation operations. These operations consume more CPU, memory, and I/O resources.
    3. The client node:client node acts as a routing request and can actually be seen as a load balancer. (for businesses that don't have a lot of requests, client node can do without, and master and data will suffice)
Second, based on 2. Cluster configuration for X

Select 10.90.4.9 this machine is configured as a client node,elasticsearch.yml as follows:

cluster.name:ucasnode.name:node-090.0.0.0discovery.zen.ping.unicast.hosts: ["  10.90.4.9"]discovery.zen.ping.multicast.enabled:true

 

Note that the port is not 9200, but 9300. You can also not write ports.
Start the ES server on 10.90.4.9, and now it's just a single cluster.

Configure the same ES on the 10.90.4.8 machine as the configuration in master Node,elasticsearch.yml as follows:

 
cluster.name:ucasnode.name:  node-080.0.0.0discovery.zen.ping.unicast.hosts: [  "10.90.4.9"]discovery.zen.ping.multicast.enabled:true

10.90.4.7 as Data node, configured as follows:

 
cluster.name:ucasnode.name:node-070.0.0.0discovery.zen.ping.unicast.hosts: ["  10.90.4.9"]discovery.zen.ping.multicast.enabled:true

Visit http://10.90.4.9:9200/_plugin/head/

, node-09 is the client node and does not store data.

Three, 5.4-based multi-machine cluster configuration

ELasticsearch 5.4 requires a minimum JDK version of 1.8, because the JDK version on the server is 1.7 and the Java environment variable is written in/etc/profile, changing the JDK will affect other programs, this time based on 5.4 on my Mac and another Ubuntu Do the testing.

The native IP on your Mac is 192.168.1.111, set as the master node, configured as follows:

cluster.name:my-applicationnode.name:node-111192.168.1.1119200http.cors.enabled : Truehttp.cors.allow"*"node.master:truenode.data: Truediscovery.zen.ping.unicast.hosts: ["192.168.1.111"]


The IP bit 192.168.1.102 of the Ubuntu machine is configured as follows:

cluster.name:my-applicationnode.name:node-102192.168.1.1029200http.cors.enabled : Truehttp.cors.allow"*"node.master:falsenode.data: Truediscovery.zen.ping.unicast.hosts: ["192.168.1.111"]

Start the master on your Mac, start the slave node on Ubuntu, and observe the output, and there will be a hint that node-102 detects the master node:

2017-06-07t11:33:39,369][info][o.e.c.s.clusterservice] [node-102] Detected_master {node-111}{ 3DQD1RRVTMIKDTCKM68NPQ}{H6ZU7PAQRWEWUBCLLSQWTQ}{192.168.1.111}{192.168.1.111:9300}, added{{Node-111}{3DQd1RRVTMiKdTckM68npq}{H6Zu7paqrwewubcllsqwtq}{192.168.1.111}{192.168.1.111:9300},}, reason: zen-disco-receive (from Span class= "hljs-variable" >master [master {node-111}{3< Span class= "hljs-variable" >dqd1rrvtmikdtckm68nPQ}{h6zu7paqrwewubcllsqwtq}{192.168.1.111}{192 .168.1.111:9300} committed version [8]]) '        

Access head, a master a slave composed of a cluster, the interface is as follows:

Iv. 5.4-based standalone multi-node cluster configuration

If you want to start multiple nodes on a single machine, the steps are as follows:

    1. Copy a Elasticsearch installation package
    2. Modify the port, for example, one is 9200 and one is 9205.
    3. Delete the data in the database directory (if the newly unpacked installation package is not necessary)
    4. Launch two es at the same time
Master configuration file: Cluster.name:myelasticsearchnode.name:node-1network.host:192.168.253.6http.port: 9201http.cors.enabled:truehttp.cors.allow-origin: "*" Node.master:truenode.data: Truediscovery.zen.ping.unicast.hosts: ["192.168.253.6"]data configuration file: Cluster.name:myelasticsearchnode.name: Node-2network.host:192.168.253.6http.port:9201http.cors.enabled:truehttp.cors.allow-origin: "*" Node.master: Truenode.data:truediscovery.zen.ping.unicast.hosts: ["192.168.253.6"]

Reference documents:

http://blog.csdn.net/napoay/article/details/52202877

Build Elasticsearch 5.4.3 distributed cluster under Mac

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.