Elasticsearch 5 Cluster

Source: Internet
Author: User

1 Preparatory work

/etc/profile Add vim highlighting

Export ps1= "\[\e]0;\a\]\n\[\e[1;32m\]\[\e[1;33m\]\h\[\e[1;35m\]<\$ (date +\"%y-%m-%d%t\ ") > \[\e[32m\]\w\[\e[ 0m\]\n\u>\\$ "


Server information:

192.168.91.220 (elasticsearch-node1) 192.168.91.221 (elasticsearch-node2) 192.168.91.222 (ELASTICSEARCH-NODE3)
1.1 Installing the Java environment
Yum Install vim openssh-clients lrzsz-y
Yum Install JAVA-1.8.0-OPENJDK java-1.8.0-openjdk-devel-y


It is java-1.8.0-openjdk-devel not necessary to install this, but the Java compiler (JAVAC) may be required to install the plug-in later, so it is recommended to install it in advance.


Verify version:

220.ELK.NODE0.COM<2016-12-13 12:02:42> ~root># java-versionopenjdk Version "1.8.0_111" OpenJDK Runtime Environment (build 1.8.0_111-b15) OpenJDK 64-bit Server VM (build 25.111-b15, Mixed mode)
1.2 Configuring the Yum source for ES

Import Signature:

RPM--import Https://artifacts.elastic.co/GPG-KEY-elasticsearch


Set Yum source

[elasticsearch-5.x]
Name=elasticsearch repository for 5.x packages
Baseurl=https://artifacts.elastic.co/packages/5.x/yum
Gpgcheck=1
Gpgkey=https://artifacts.elastic.co/gpg-key-elasticsearch
Enabled=1
Autorefresh=1
Type=rpm-md


Elastic Stack related products need to use this source.

1.3 Operating System Configuration

The official provides the Elasticsearch operating system in the production environment related recommendations, see here

1.  cross-domain support adds the following configuration to the Elasticsearc.yml Master profile http.cors.enabled: truehttp.cors.allow-origin:  "*" Based on official website recommendations Question two:  max number of threads [1024] for user [elasticsearch] is &NBSP;TOO&NBSP;LOW,&NBSP;INCREASE&NBSP;TO&NBSP;AT&NBSP;LEAST&NBSP;[2048] Workaround: Go to configuration file under LIMITS.D: vim /etc/ security/limits.d/90-nproc.conf , modify the configuration as follows:vim /etc/security/limits.d/90-nproc.conf*           soft    nproc     1024    modified to:  *          soft     nproc     2048   question three: max file descriptors [64000]  for elasticsearch process is too low, increase to at least  [65536] Workaround: 1, virtual memory settings, edit  /etc/sysctl.conf , append: vm.max_map_count=2621442, modify file handle limit, edit  /etc/ security/limits.conf , append: root># vim /etc/security/limits.conf *    soft nofile 65536*     hard nofile 65536 problem Four: elasticsearch5.0 start failure, the following prompt appears: 1, Java hotspot (TM)  64-bit server vm warning: info: os::commit_memory (0x0000000085330000,  2060255232, 0)  failed; error= ' cannot allocate memory '   (errno=12) Modify JVM space allocation because elasticsearch5.0 allocates JVM space size to 2g by default # vim config/jvm.options  -xms2g  - xmx2g   modified to   -xms512m  -xmx512m

2, Elasticsearch installation

NODE0 deployment

220.ELK.INZWC.COM<2016-12-13 12:21:06> ~
root># Useradd Elasticsearch


220.ELK.INZWC.COM<2016-12-13 12:22:40> ~
root># Chown-r elasticsearch:elasticsearch/opt/elasticsearch-node0/

root># TAR-ZXVF elasticsearch-5.0.2.tar.gz-c/opt/

root># cd/opt

root># MV elasticsearch-5.0.2 elasticsearch-node0

Modify Configuration

root># cat/opt/elasticsearch-node0/config/elasticsearch.yml
network.host:0.0.0.0
http.port:9200
Http.cors.enabled:true
Http.cors.allow-origin: "*"
#cluster
Cluster.name: "Es-cluster"
Node.name: "Es-node0"
Node.master:true
Node.data:true
Http.enabled:true


Node1 Deployment


221.ELK.INZWC.COM<2016-12-13 12:21:10> ~
root># Useradd Elasticsearch

221.ELK.INZWC.COM<2016-12-13 12:21:24> ~
root># Chown-r elasticsearch:elasticsearch/opt/elasticsearch-node1/

220.ELK.NODE0.COM<2016-12-13 12:04:43>/opt
root># SCP-RP elasticsearch-node0/[email protected]:/opt/elasticsearch-node1

221.ELK.NODE1.COM<2016-12-13 12:07:32>/opt/elasticsearch-node1/config
root># cat/opt/elasticsearch-node1/config/elasticsearch.yml
network.host:0.0.0.0
http.port:9200
Http.cors.enabled:true
Http.cors.allow-origin: "*"
#cluster
Cluster.name: "Es-cluster"
Node.name: "Es-node1"
Node.master:true
Node.data:true
Http.enabled:true


PS : Node.name

Node2 deployment

222.ELK.INZWC.COM<2016-12-13 12:21:15> ~
root># Useradd Elasticsearch

222.ELK.INZWC.COM<2016-12-13 12:23:20> ~
root># Chown-r elasticsearch:elasticsearch/opt/elasticsearch-node2/

220.ELK.NODE0.COM<2016-12-13 12:04:43>/opt
root># SCP-RP elasticsearch-node0/[email protected]:/opt/Elasticsearch-node2

222.ELK.NODE2.COM<2016-12-13 12:07:32>/opt/elasticsearch-node3/config
root># cat/opt/elasticsearch-node2/config/elasticsearch.yml
network.host:0.0.0.0
http.port:9200
Http.cors.enabled:true
Http.cors.allow-origin: "*"
#cluster
Cluster.name: "Es-cluster"
Node.name: "Es-node2"
Node.master:true
Node.data:true
Http.enabled:true

PS : Node.name



Elasticsearch 5 Cluster

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.