Centos7 elasticstack installation tutorial

Download the compressed package on the official website
https://www.elastic.co/cn/start

Unzip and install

tar -xvf  elasticsearch

First, you need to add the elasticsearch user, because root does not support
useradd elsearch
changing the user group by default .
chown -R elsearch:elsearch /root/es/
Modify the configuration file
vim config/elasticsearch.yml
. After the network.host is changed to 0.0.0.0
, you need to modify two places.
1. At this time, you need to modify the jvm configuration, because if it is not in elasticsearch 127.0.0.1, it will default to a particularly high development environment, so two places need to be modified, and the specific values ​​to be modified are modified according to their actual conditions.

-Xms128m
-Xmx128m

2. Configure a process to create the maximum number of memory maps in VMAs (virtual memory area)

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

Start es service
su-elsearch
cd bin
./elasticsearch or ./elasticsearch -d #Background start

#Test by access. If you see the following message, it means that ES has started successfully.
Note:
This time an error will be reported.
could not find java in bundled JDK at /root/es/elasticsearch-7.12.0/jdk/bin/java
This error is because the decompressed es directory is still under root. So the /es directory is created in the root directory, and the files are re-extracted to the /es directory, and the user group is re-authorized as elsearch.
After restarting again, it prompts to
modify the built-in system, which needs to be executed under root

vim /etc/sysctl.conf 
# 添加
vm.max_map_count = 655360
# 刷新
sysctl -p

Insert picture description here
vim /etc/security/limits.conf
Add the following content

* soft nofile 65536
* hard nofile 65536
* soft nproc 2048
* hard nproc 4096

线程数太低
vim /etc/security/limits.d/20-nproc.conf
Insert picture description here
错误:the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

modify

config/elasticsearch.yml
cluster.initial_master_nodes: ["node-1"]

Finally visit
http://127.0.0.1:9200/ and the
following figure appears, indicating that the installation is successful
Insert picture description here

Guess you like

Origin blog.csdn.net/csd_nuser/article/details/115295433