Download ElasticSearch
Since downloading from the official website is particularly slow, I chose to use the domestic mirror address of Huawei Cloud.
installation
-
Upload to the cloud server through the sftp tool, and decompress it by using the command
tar -zxvf elasticsearch-7.4.2
-
Use the command to move the folder to local for easy management
cp -r elasticsearch-7.4.2 /usr/local
-
Modify the configuration file
vim elasticsearch-7.4.2/config/elasticsearch.yml
I have modified the following configuration items:cluster.name: #集群的名字 node.name: #节点名字,在集群中是有多个node组成的 path.data: /usr/local/elasticsearch-7.4.2/data #数据存储的地方,需要创建data文件夹 path.logs: /usr/local/elasticsearch-7.4.2/logs #日志存储的文件夹 network.host: 0.0.0.0 cluster.initial_master_nodes: #该地方取的是node.name的值
Servers with small memory can be modified, the system defaults to 1g
vim elasticsearch-7.4.2/config/jvm.options
start up
- Because I am currently the root user, create a user
useradd esuser
- Change the role of the file
chown -R esuser /usr/local/elasticsearch-7.4.2
- Start, wait for error
./usr/local/elasticsearch-7.4.2/elasticsearch
- You need to switch to the esuser user and run it again.
su esuser
Use the following command to solve the problem.chown -R esuser:esuser /usr/local/elasticsearch-7.4.2
Start again and report the following exception.
These are configuration problems related to the environment. Switch to the root user, execute the following command, and add the content as shown in the figure.
vim /etc/security/limits.conf
Executevim /etc/security/limits.conf
add and add at the bottom of the file Usesysctl -p
to refresh
once again switch to esuser user execution../elasticsearch
Background execution./elasticsearch -d
. Successful startup, access through the above address!