Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Filling holes in the installation of ElasticSearch on CentOS7

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report