The first chapter --Ubuntu installation Elasticsearch

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

  1. First, create a directory to save the archive, followed by the implementation:
    cd /opt
    mkdir tools
    cd tools
    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.0.zip
    
    The results are:
    Download archive
  2. Extracting archive
    unzip elasticsearch-5.4.0.zip
    
    At this point on will see FIG elasticsearch-5.4.0 folder.

Third, configure

  1. 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:
    Here Insert Picture Description
    Run the following command:
    vim jvm.options
    
    amend as below:
    Here Insert Picture Description
  2. 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.
    vim elasticsearch.yml
    
    FIG configuration:
    Here Insert Picture Description
  3. Assigned to non-root user authority to operate es file
    chown -R 用户名:用户名 文件目录
    
    For example, I operate as follows:
    chown -R xjf:xjf /opt/tools/elasticsearch-5.4.0
    
  4. 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
    Here Insert Picture Description
    ② above is normal, but when we started, it has the following error:
    Here Insert Picture Description
    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"
    Here Insert Picture Description
    ③ At this time, the restart will be successful, success is as follows:
    Here Insert Picture Description

IV access (the situation is as follows success)

  1. Can be accessed via the external network IP
    Here Insert Picture Description
  2. You can use curl tool access
    Here Insert Picture Description

Learn from:

https://www.cnblogs.com/zhengyazhao/p/10918821.html
https://www.jianshu.com/p/f502438073fd

Published 43 original articles · won praise 1 · views 4619

Guess you like

Origin blog.csdn.net/fanrendale/article/details/104293850