Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Filling holes in the installation of ElasticSearch on CentOS7

Shulou Source: shulou.com Published: 2022-06-02 19:21:16 10月01日 Update

Download elasticsearch 5.3.0wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.0.tar.gzmv elasticsearch-5.3.0.tar.gz / optcd / opttar-xzvf elasticsearch-5.3.0.tar.gzcd elasticsearch-5.3.0/ to start EScd / bin./elasticsearch

According to the reason, it should be OK, but then all kinds of pits appear one by one and elaborate separately.

Error 1:error='Cannot allocate memory' (errno=12)

Solutions:

Since the default jvm space allocated by elasticsearch6.0 is 2g, it needs to be reduced a bit.

Vim config/jvm.options-Xms2g →-Xms512m-Xmx2g →-Xmx512m

Error 2: can not run elasticsearch as root

Solutions:

In a Linux environment, elasticsearch is not allowed to run with root privileges! So you need to create a non-root user to start es with a non-root user

Groupadd elk # create user group elkuseradd elk-g elk-p 111111 # create new user elk,-g elk set its user group to elk,-p 111set its password 6 1chown-R elk:elk / opt # change / opt folder and internal files belong to elk:elksu elk # switch to non-root user elk

Error 3: (1) max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

(2) max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

This error occurs when you modify the network.host in config/elasticsearch.yml to network.host: 0.0.0.0 so that any IP on the public network can access it.

Solutions:

Switch to the root user, and

Vim / etc/security/limits.conf* soft nofile 300000 * hard nofile 300000 * soft nproc 102400 * soft memlock unlimited* hard memlock unlimited

Error 4:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Solutions:

First you need to switch to the root user

You can then execute the following command to set the vm.max_map_count, but it will return to the original value after reboot.

Sysctl-w vm.max_map_count=262144

Persistence is done by modifying the vm.max_map_count parameter in the / etc/sysctl.conf file:

Echo "vm.max_map_count=262144" > / etc/sysctl.confsysctl-p

Finally, the access to the public network is successful:

Install the visualization plug-in elasticsearch-headgit clone git://github.com/mobz/elasticsearch-head.gitcd elasticsearch-headnpm install # here I am trying to use cnpm install has a problem, using npm can npm run start

Then visit http:// your installation machine IP:9100 on the public network.

Finally, a simple test is actually done.

If you create a new Index, you can send a PUT request directly to the Elastic server. The following example is a new Index called weather.

However, refreshing the elasticsearch-head visual interface shows that the index has been inserted successfully

Postscript

More elastic search practices about the author are here

Tags: User error file switch success user group visualization next author example practice original value parameter postscript command size actual password ownership persistence Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Docker OPPO Reno Apple Shulou Technology