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

How to solve the problem of elastic search installation on centos7

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to solve the elastic search installation problem on centos7". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "how to solve the elastic search installation problem on centos7"!

Download elastic search 5.3.0

wget 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/

Start es

cd /bin./ elasticsearch

According to the reason, it should be possible, but then various pits appear one by one and are explained separately.

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

error='cannot allocate memory'

solutions:

Since elasticsearch 5.0 allocates jvm space by default to 2g, it needs to be made smaller.

vim config/jvm.options -xms2g → -xms512m-xmx2g → -xmx512m

Error 2: can not run elasticsearch as root

can not run elasticsearch as root

solutions:

Elasticsearch is not allowed to run as root in linux environments! So you need to create a non-root user, starting with the non-root user.

groupadd elk #Create user group elkuseradd elk -g elk -p 11111 #Create new user elk, -g elk Set his user group to elk, -p 111 Set his password 6 1chown -r elk:elk /opt #Change/opt folder and internal files to elk:elksu elk #Switch to non-root elk down

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 modifying network.host to network.host: 0.0.0.0 in config/elasticsearch.yml so that any IP from the external network can be accessed.

solutions:

Switch to root and

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

/etc/security/limits.conf

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

vm.max_map_count is too low

solutions:

First switch to root;

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

sysctl -w vm.max_map_count=262144

Persistence is achieved 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, he successfully accessed the external network:

Access to external network successful!

Install visualization plug-in elasticsearch-head

git clone git://github.com/mobz/elasticsearch-head.gitcd elasticsearch-headnpm install #Here I tried cnpm install has a problem, npm can npm run start

Then visit http://your installation machine ip:9100 on the external network

Access elasticsearch-head visualization interface succeeded

Finally, a simple test

Create an index to send a put request directly to the elastic server. The following example is a new index named weather.

Add index to es with rest interface

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

Index inserted

At this point, I believe that everyone has a deeper understanding of "how to solve the elastic search installation problem on centos7," so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

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

Development

Wechat

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

12
Report