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 install ElasticSearch under Linux

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to install ElasticSearch under Linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

ElasticSearch is a Lucene-based search server. It provides a full-text search engine with distributed multi-user capability, based on RESTful web interface. Elasticsearch is developed in Java and released as open source under the Apache license terms, and is currently a popular enterprise search engine.

Download elasticsearch

Go directly to elasticsearch's website and download the latest installation package: https://www.elastic.co/downloads/elasticsearch. This tutorial uses version 5.1.1.

Second, install elasticsearch

Upload the downloaded installation package to centos, or download it directly from centos using the wget command.

1. Decompression

Unzip elasticsearch-5.1.1.zip

2. Install jdk1.8

To install elasticsearch, it is officially recommended to use the version of jdk1.8, so install and deploy jdk first. Refer to other materials on the jdk deployment website.

3. Run

Cd bin./elasticsearch

Errors may occur, and the following are common errors: (1) elasticsearch cannot be run with root privileges, and this error occurs: Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.

Because the security issue elasticsearch does not allow users to run directly with root, create a new user solution:

Step 1: liunx creates a new user adduser XXX and then enters the password twice for the created user with password passwd XXX. Step 2: switching the user su XXX you just created and then executing elasticsearch will show that Permission denied permissions are insufficient. Step 3: assign permissions to the newly created XXX. Chmod 777 * this is not allowed, because the user does not have the permissions and must not be able to pay for them. So use the root user to log in and pay the permission. Step 4: root assigns permissions to XXX, chown-R XXX / your elasticsearch installation directory.

(2) Tip: Max number of threads for elasticsearch too low solution:

Modify / etc/security/limits.confvim / etc/security/limits.conf to add a line: xxx-nproc 2048, where "xxx" is the user who started elasticsearch

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

Solution:

Modify / etc/sysctl.confvim / etc/sysctl.conf to add a line: vm.max_map_count=262144, and execute: sysctl-p to see if the result is vm.max_map_count=262144

The result of a successful run is that started will appear. It is possible that either localhost:9200 or 127.0.0.1 elasticsearch.yaml 9200 can be accessed, but it cannot be accessed according to IP:9200, so modify: elasticsearch.yaml file.

4. Unable to install plug-in license

Bin/elasticsearch-plugin install licenseERROR: Unknown plugin license

Reason: plug-in commands have changed since ElasticSearch6.0.0. Solution: install all plug-ins with the latest commands.

Bin/elasticsearch-plugin install x-pack

5. Test run

Enter: http://192.168.1.100:9200/ in the browser, if it appears:

Indicates that the deployment is successful, and cluster_name:my-demo is the one I modified the default cluster_name.

Thank you for reading this article carefully. I hope the article "how to install ElasticSearch under Linux" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you 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: 216

*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