First, create a non-root user (es can not be started by root)
sudo adduser xjf
Description: adds password (required), as well as some of the information (you can directly enter) after executing the command. After we sign in this account at start-es
Second, the use wget to download Elasticsearch archive
- First, create a directory to save the archive, followed by the implementation:
The results are:cd /opt mkdir tools cd tools wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.0.zip
- Extracting archive
At this point on will see FIG elasticsearch-5.4.0 folder.unzip elasticsearch-5.4.0.zip
Third, configure
- Modify es running out of memory.
The default memory to run in the JVM profile es folder is 2g, we manually modify the 512M.
Files shown:
Run the following command:
amend as below:vim jvm.options
- Set external network access
es launch the default is only intranet access, you need to configure the external network can be accessed. You need to turn off the firewall. Then add a line network.host in elasticsearch.yml them: 0.0.0.0.
FIG configuration:vim elasticsearch.yml
- Assigned to non-root user authority to operate es file
For example, I operate as follows:chown -R 用户名:用户名 文件目录
chown -R xjf:xjf /opt/tools/elasticsearch-5.4.0
- Non-root users to start to solve the error
① non-root user to log at this time we just set, go to the bin directory es folder, execute
shell ./elasticsearch -d
Description : -d parameter represents the background, the test can not be added. If you are running in the background, you can use the following command to view, then can kill the process according to the process ID.
shell ps -ef | grep elastic
② above is normal, but when we started, it has the following error:
A log root user, modify the parameters, parameter values from the error of tips:
shell sysctl -w vm.max_map_count=262144
then view the status of amending parameters:
shell sysctl -a | grep "vm.max_map_count"
③ At this time, the restart will be successful, success is as follows:
IV access (the situation is as follows success)
- Can be accessed via the external network IP
- You can use curl tool access
Learn from:
https://www.cnblogs.com/zhengyazhao/p/10918821.html
https://www.jianshu.com/p/f502438073fd