ElasticSearch deployed to Centos7

Posted by nerya on Sun, 02 Jan 2022 21:13:25 +0100

1, What is ElasticSearch

Elasticsearch is an open source distributed and RESTful search and data analysis engine. Its bottom layer is the open source library Apache Lucene.
  Lucene can be said to be the most advanced, high-performance and full-featured search engine library at present - whether open source or private, but it is only a library. In order to make full use of its functions, you need to use Java and integrate Lucene directly into the application. To make matters worse, you may need a degree in information retrieval to understand how it works, because Lucene is very complex.
  in order to solve the complexity of using Lucene, Elasticsearch came into being. It is written in Java and internally uses Lucene for indexing and searching, but its goal is to make full-text retrieval easier. In short, it encapsulates Lucene. It provides a set of simple and consistent restful APIs to help us realize storage and retrieval.
  of course, Elasticsearch is not only Lucene, but also not just a full-text search engine. It can be accurately described as follows:

  • A distributed real-time document storage, each field can be indexed and searched;
  • A distributed real-time analysis search engine;
  • It is competent for the expansion of hundreds of service nodes and supports PB level structured or unstructured data.

Because Elasticsearch is powerful and easy to use, Wikipedia, the guardian, Stack Overflow, GitHub and so on all use it for search. At present, Elasticsearch has become one of the mainstream software in the field of full-text search.

2, Installation (Centos7)

1. Install java1 8 (self installation)

2. Create a non root user

#Create normal user
useradd es
#Modify user password (password is es)
passwd es
#Enter normal user mode
su - es
#Create a normal group
groupadd -r es
#Create a normal user and join the group
useradd -r -g es es
#Create login password of ordinary user
echo es:password | chpasswd
#Switch to root
#Give ordinary users access to folders
chown -R es:es /opt/elasticsearch-7.13.4
#View user information
more /etc/passwd

3. Download and unzip the installation file

It can be downloaded from elastic's official website elastic.co/downloads/elasticsearch Get the latest version of Elasticsearch

4. Switch to normal account

su - es

5. Modify profile

Modify elasticsearch. In the extracted folder config The following information in the YML configuration file:

#Cluster name. Each node needs to be configured with the same cluster name to join the same cluster. A node can only join one centralized cluster
cluster.name: es-cathl
#Node name. The host name is used by default,
node.name: node-101-68
#network address
#Storage path of index data
path.data: /home/es/es7-data
#Storage path of log file
path.logs: /home/es/es7-logs
#HTTP port of external service
http.port: 9200
#TCP port for interaction between nodes
transport.port: 9300
#Seed host list
discovery.seed_hosts: [""]
#Initial master node
cluster.initial_master_nodes: ["node-101-68"]
#The hot node is configured with large memory and SSD to carry ordinary user requests; warm node, mechanical hard disk and small memory are used to store data not commonly used in history and occasional background task query
node.attr.box_type: warm
#When Elasticsearch loads a new script for the first time, the new script will be compiled and stored in the cache, and 5000 scripts will be compiled in 5 minutes
script.max_compilations_rate: 5000/5m
#Start collecting Elasticsearch monitoring data
xpack.monitoring.collection.enabled: true

Modify the configuration file JVM Options information is as follows: (for detailed configuration information of Heap Size, please refer to the official document: https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html)

#Set the minimum and maximum Heap Size to 1G by default and 3G by modification. It is recommended that XMS not exceed 50% of the physical memory and submit the configuration as much as possible to improve the ES processing performance

6. Start

cd elasticsearch-7.13.4
./bin/elasticsearch -d

7. Check whether the installation is successful

[es@localhost elasticsearch-7.13.4]$ jps
11115 Elasticsearch
13310 Jps

8. Stop service

[es@localhost elasticsearch-7.13.4]$ kill -9 11115

Topics: ElasticSearch