centos7 installs elasticsearch 7.6.2 and word separator

Posted by flash99 on Thu, 24 Feb 2022 18:30:56 +0100

Hello, little buddies, I'm an old cock, and I'm installing elasticsearch 7.6.2 with you

There are so many tutorials to install elasticsearch that this article has been tested on its own and is therefore shared with small partners who need it. First, it avoids detours and second, it facilitates the integration of later knowledge. This article is based on ES 7.6.2, let's get started.

Catalog

1. Preconditions

2. Installation process

1. Preconditions

1. Install centos 7.x

2. Prepare the elasticsearch 7.6.2 installation package and plug-ins

Links: https://pan.baidu.com/s/1qIVKDqsL6s3_wEqmrxkSbQ (
Extraction Code: 1234

3. Google Plugins: elasticsearch-head

2. Installation process

1. Unzip the elasticsearch package

tar -zxvf elasticsearch-7.6.2-linux-x86_64.tar.gz

2. Move the file to the / usr/local directory and rename it elasticsearch

mv elasticsearch-7.6.2 /usr/local/elasticsearch

3. Create a new account (for security reasons, elasticsearch does not allow running with the root account by default)

useradd New User Name

4. Set password

passwd New password

5. Create data and logs folders

mkdir -p /home/New User Name/elasticsearch/data
mkdir -p /home/New User Name/elasticsearch/logs

6. Grant permissions to new folders

chmod -R 777 /home/New User Name/elasticsearch
chmod -R 777 /usr/local/elasticsearch

7. Enter the elasticsearch/config folder

cd /usr/local/elasticsearch/config

8. Set up elasticsearch.yml

vi elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
network.host: 0.0.0.0
cluster.name: laokou-elasticsearch #Customizable
node.name: node-elasticsearch #Customizable
http.port: 9200
cluster.initial_master_nodes: ["node-elasticsearch"] #This is the node.name
path.data: /home/koushenhai/elasticsearch/data # Data Catalog Location
path.logs: /home/koushenhai/elasticsearch/logs # Log directory location

Save when set up

9.Set up jvm. Option (default 1 g server memory is sufficient to skip)

vi jvm.options
-Xms512m
-Xmx512m

Save when set up

10.Set up vm.max_map_count (do this if less than 262144 is modified or not set)

Error message: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

vi /etc/sysctl.conf
vm.max_map_count = 655360

Save when set up

11. Set limits.conf (do this without setting up)

Error message: max file descriptors [4096] for elastic search process is too low, increase to at least [65535]

vi /etc/security/limits.conf
new user soft nofile 65535
 new user hard nofile 65537

Save when set up

The new user is the account that started es

After appending the content, you need to close the shell connection tool before the login user will take effect

12. Switch accounts

su new user

13. Start elasticsearch

cd /usr/local/elasticsearch/bin
./elasticsearch

14. Launch a successful screenshot (enter in Google Browser-> http://ip:9200 )

15. Enter elasticsearch.yml sets the password (skip without setting the password)

cd /usr/local/elasticsearch/config
vi elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
network.host: 0.0.0.0
cluster.name: laokou-elasticsearch
node.name: node-elasticsearch
http.port: 9200
cluster.initial_master_nodes: ["node-elasticsearch"]
path.data: /home/koushenhai/elasticsearch/data # Data Catalog Location
path.logs: /home/koushenhai/elasticsearch/logs # Log directory location

#Set Password
http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

Save when set

16. Start elasticsearch password settings and customize passwords (skip without password settings)

cd /usr/local/elasticsearch/bin
./elasticsearch-setup-passwords interactive

17. Connect elasticsearch with elasticsearch-head (password is required, account is elastic)

18. Install synonyms (ik, synonyms, phonetic)

su root

mkdir -p /usr/local/elasticsearch/plugins/analysis-synonym

mkdir -p /usr/local/elasticsearch/plugins/analysis-ik

mkdir -p /usr/local/elasticsearch/plugins/analysis-pinyin

yum install -y unzip zip

unzip -d /usr/local/elasticsearch/plugins/analysis-ik /opt/elasticsearch-analysis-ik-7.6.2.zip

unzip -d /usr/local/elasticsearch/plugins/analysis-pinyin /opt/elasticsearch-analysis-pinyin-7.6.2.zip

unzip -d /usr/local/elasticsearch/plugins/analysis-synonym /opt/elasticsearch-analysis-dynamic-synonym-7.6.2.zip

Restart es

With great success, you are welcome to leave a message in the comments about the problems you are encountering...

Topics: ElasticSearch