Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Elasticsearch cluster deployment

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Elasticsearch is a distributed search service, which provides Restful API, the underlying layer is based on Lucene, uses multi-shard to ensure data security, and provides the function of automatic resharding. Github and other large sites also use Elasticsearch as their search service. I will not repeat the nonsense here. Here is a record of the deployment process of Elasticsearch cluster under CentOS7:

1) basic information

Elk-es01.kevin.cn 192.168.10.44

Elk-es02.kevin.cn 192.168.10.45

Elk-es03.kevin.cn 192.168.10.46

The following operations are performed on all three node machines.

[root@elk-es01 ~] # systemctl stop firewalld.service

[root@elk-es01 ~] # systemctl disable firewalld.service

[root@elk-es01] # firewall-cmd-- state

Not running

[root@elk-es01 ~] # setenforce 0

Setenforce: SELinux is disabled

[root@elk-es01 ~] # getenforce

Disabled

[root@elk-es01 ~] # vim / etc/sysconfig/selinux

.

SELINUX=disabled

[root@elk-es01 ~] # cat / etc/hosts

.

192.168.10.44 elk-es01.kevin.cn

192.168.10.45 elk-es02.kevin.cn

192.168.10.46 elk-es03.kevin.cn

[root@elk-es01 ~] # / usr/sbin/ntpdate ntp1.aliyun.com

2) install java8 environment. It is officially recommended that version 5.4 should be at least Java 8 or above (all three node machines should be operated)

Extract the file to / opt/

Jdk-8u121-linux-x64.tar.gz

Configure environment variables

# vim / etc/profile

# * DMP JAVA ENV*

Export JAVA_HOME=/opt/jdk1.8.0_121

Export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

Export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

3) install elasticsearch (all three node machines should be operated)

Create users, user groups

# groupadd es

# useradd es-g es-p 123456

# chown-R es:es / opt/els-node1

# chown-R es:es / opt/els-node2

# chown-R es:es / opt/els-node3

Create a data directory and log directory

# mkdir-p / opt/els-data/ {data1,log1}

# mkdir-p / opt/els-data/ {data2,log2}

# mkdir-p / opt/els-data/ {data3,log3}

# chown-R es:es / opt/els-node*

Optimization system

one,

# cd / etc [root@localhost etc]

# cp sysctl.conf sysctl.conf.bak

# vim sysctl.conf

# elasticsearch config start

Vm.max_map_count=262144

# elasticsearch config end

# sysctl-p

two,

# cd / etc/security/

Cp limits.conf limits.conf.bak

Then edit limits.conf to add the following configuration:

# elasticsearch config start

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096

# elasticsearch config end

Download the installation package

# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.0.zip

Configure els

Node-1

Node.name: node-1

Path.data: / opt/els-data/data1

Path.logs: / opt/els-data/logs1

Network.host: 192.168.15.143

Transport.tcp.port: 9301

Http.port: 9201

Discovery.zen.ping.unicast.hosts: ["192.168.15.143", "192.168.15.143", "192.168.15.143"]

Http.cors.enabled: true

Http.cors.allow-origin: "*"

Node-2

Node.name: node-2

Path.data: / opt/els-data/data2

Path.logs: / opt/els-data/logs2

Network.host: 192.168.15.143

Transport.tcp.port: 9302

Http.port: 9202

Discovery.zen.ping.unicast.hosts: ["192.168.15.143", "192.168.15.143", "192.168.15.143"]

Http.cors.enabled: true

Http.cors.allow-origin: "*"

Node-3

Node.name: node-3

Path.data: / opt/els-data/data3

Path.logs: / opt/els-data/logs3

Network.host: 192.168.15.143

Transport.tcp.port: 9303

Http.port: 9203

Discovery.zen.ping.unicast.hosts: ["192.168.15.143", "192.168.15.143", "192.168.15.143"]

Http.cors.enabled: true

Http.cors.allow-origin: "*"

Start the service

. / bin/elasticsearch-d

Test:

Curl "192.168.15.143purl 9203"

{

"name": "node-3"

"cluster_name": "elasticsearch"

"cluster_uuid": "5HJLIt_5Ra26HHs4vNRQuA"

"version": {

"number": "6.3.0"

"build_flavor": "default"

"build_type": "zip"

"build_hash": "424e937"

"build_date": "2018-06-11T23:38:03.357887Z"

"build_snapshot": false

"lucene_version": "7.3.1"

"minimum_wire_compatibility_version": "5.6.0"

"minimum_index_compatibility_version": "5.0.0"

}

"tagline": "You Know, for Search"

}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report