以root用户身份运行弹性搜索

[英]Run elastic search as root user


Im getting below error when i tried to start elastic search 5.0 with command ./elasticsearch and getting below error.

当我尝试使用命令./elasticsearch启动弹性搜索5.0并获得以下错误时,我得到以下错误。

[2016-11-23T13:44:09,507][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:116) ~[elasticsearch-5.0.1.jar:5.0.1]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103) ~[elasticsearch-5.0.1.jar:5.0.1]
    at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch-5.0.1.jar:5.0.1]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96) ~[elasticsearch-5.0.1.jar:5.0.1]
    at org.elasticsearch.cli.Command.main(Command.java:62) ~[elasticsearch-5.0.1.jar:5.0.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-5.0.1.jar:5.0.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) ~[elasticsearch-5.0.1.jar:5.0.1]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:96) ~[elasticsearch-5.0.1.jar:5.0.1]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:155) ~[elasticsearch-5.0.1.jar:5.0.1]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286) ~[elasticsearch-5.0.1.jar:5.0.1]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112) ~[elasticsearch-5.0.1.jar:5.0.1]
    ... 6 more

I tried to start by switching to other user and tried sudo ./elasticsearch and got the same error. How to start elastic search as root user ?

我试图通过切换到其他用户并尝试sudo ./elasticsearch并获得相同的错误。如何以root用户身份开始弹性搜索?

6 个解决方案

#1


0  

You can not start elasticsearch as root. It's not allowed and super dangerous.

您无法以root身份启动elasticsearch。这是不允许的,而且非常危险。

Read the installation guide to understand how to properly install it depending on your host.

阅读安装指南,了解如何根据主机正确安装它。

#2


2  

Root cause of this issue is: ElasticSearch is not allowed to run from root owner. There is another possiblity for this issue "Java path is set for root user only not for all other users". Solution of this issue:

此问题的根本原因是:不允许ElasticSearch从root用户运行。此问题还有另一种可能性“仅为root用户设置Java路径,而不是为所有其他用户设置Java路径”。解决这个问题:

Step 1: Change the ownership of elasticSearch directory from root to other user by command. $sudo chown -R current_User:Group_Name elasticsearch-5.5.0

步骤1:通过命令将elasticSearch目录的所有权从root更改为其他用户。 $ sudo chown -R current_User:Group_Name elasticsearch-5.5.0

Setp 2: Check Java set in classpath for current user[not only for root]. If command : $java -version or echo $JAVA_HOME command giving empty result. That means we should set Java in classpath [system env varible] for current user then Follow Step 3. otherwise start elasticsearch service.

第2章:在类路径中检查当前用户的Java集[不仅适用于root]。如果命令:$ java -version或echo $ JAVA_HOME命令给出空结果。这意味着我们应该在当前用户的classpath [system env varible]中设置Java,然后按照步骤3.否则启动elasticsearch服务。

Step 3: Edit /etc/profile and add two lines as per your system dir export JAVA_HOME="Java dir location"

步骤3:编辑/ etc / profile并根据系统dir导出添加两行JAVA_HOME =“Java目录位置”

export PATH=$JAVA_HOME/bin:$PATH Run $source source /etc/profile

export PATH = $ JAVA_HOME / bin:$ PATH运行$ source source / etc / profile

After this run elasticSearch service. It worked for me perfectly.

在此之后运行elasticSearch服务。它非常适合我。

#3


1  

I had the same problem and I had to connect with another user. But first, I had to grant him the rights to execute the bin/elasticsearch.

我有同样的问题,我不得不与另一个用户连接。但首先,我必须授予他执行bin / elasticsearch的权利。

#4


0  

This was asked before for ES2 (How to run Elasticsearch 2.1.1 as root user in Linux machine)

之前曾问过ES2(如何在Linux机器上以root用户身份运行Elasticsearch 2.1.1)

The same solution may work for 5.

相同的解决方案可能适用于5。

As stated previously, you should probably not so this..

如前所述,你可能不应该这样......

#5


0  

Its a common mistake run bin/elasticsearch from the root folder.

从根文件夹运行bin / elasticsearch是一个常见的错误。

#6


0  

There are two ways to solve this problem :

有两种方法可以解决这个问题:

Method1: download zip file n unzip then start by following command

方法1:下载zip文件n解压缩然后按照以下命令启动

bin/elasticsearch -Des.insecure.allow.root=true -d

Method2:

方法2:

vi bin/elasticsearch

Add property for allow root:

添加允许root的属性:

ES_JAVA_OPTS="-Des.insecure.allow.root=true"

Save and close. You can start by root now.

保存并关闭。你现在可以从root开始。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2016/11/23/82780e99841ac0713ecdd34d9d7bed8b.html



 
© 2014-2018 ITdaan.com 粤ICP备14056181号