Install ElasticSearch in Centos7 and start running

Download ElasticSearch

Since downloading from the official website is particularly slow, I chose to use the domestic mirror address of Huawei Cloud.
Insert picture description here

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
    Insert picture description here
    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
Insert picture description here

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
    Insert picture description here
  • You need to switch to the esuser user and run it again.
    su esuserInsert picture description here
    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.
    Insert picture description here
    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
    Insert picture description here
    Execute vim /etc/security/limits.confadd and add at the bottom of the file Use sysctl -pto refresh
    Insert picture description here
    once again switch to esuser user execution. ./elasticsearchBackground execution ./elasticsearch -d
    Insert picture description here
    . Successful startup, access through the above address!
    Insert picture description here

Guess you like

Origin blog.csdn.net/pengyiccb/article/details/107239005