Trying to configure GCE Discovery.
Have this in elasticsearch.yml
cloud:
gce:
project_id: ..........
zone: us-west1-a
discovery:
type: gce
Look at the log messages:
loaded plugin [discovery-gce]
but also failes with Unknown discovery type [gce]
.
[2018-01-16T09:11:25,247][INFO ][o.e.p.PluginsService ] [elasticsearch-cluster-2-node-2] loaded plugin [discovery-gce]
[2018-01-16T09:11:27,019][ERROR][o.e.b.Bootstrap ] Exception
java.lang.IllegalArgumentException: Unknown discovery type [gce]
at org.elasticsearch.discovery.DiscoveryModule.<init>(DiscoveryModule.java:110) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.node.Node.<init>(Node.java:441) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:130) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:121) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:69) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) [elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) [elasticsearch-6.0.0.jar:6.0.0]
What the heck is going on here? Any recommendation?
Apparently the EL maintaining team did a BWC change
In 5.1 we introduced the discovery.zen.hosts_provider setting to better reflect it. This PR removes BWC code in those plugins (GCE included) as it is not needed anymore.
- .put("discovery.type", "gce")
+ .put("discovery.zen.hosts_provider", "gce")
so the correct elasticsearch.yml configuration should reference
discovery:
zen.hosts_provider: gce
Related
I've tried to start Elasticsearch and failed.I've checked the logs and got the following error:
[...][WARN ][o.e.b.JNANatives ] unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:342) ~[elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:617) ~[elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:258) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:113) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) [elasticsearch-5.6.9.jar:5.6.9]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) [elasticsearch-5.6.9.jar:5.6.9]
Why is this happening?
What can I do to handle it?
The reason why this error occurs is because you did not set the following parameter in the elasticsearch.yml
bootstrap.system_call_filter: false
It means that you know that the seccomp security feature is offline.
This is leading to another question...
If the SecComp feature is offline, can I use the Elasticsearch security features? or not?
I've searched for an answer until I got one from Elasticsearch itself:
Disabling the bootstrap.system_call_filter does not have an effect in the rest of the stack. This check were meant to prevent scenarios when SecComp is silently not initialized yet configured to be initialized - i.e, to prevent that we start Elasticsearch under conditions not wanted by the OS admins.
Which means that all you need to do is set the configuration in elasticsearch.yml:
bootstrap.system_call_filter: false
And let your DevOps know that Elasticsearch works with a disabled SecComp.
for my studies I need to install sonarqube on an ubuntu server.
I installed it following this tutorial : http://www.naturalborncoder.com/methodology/2015/05/27/sonarqube-on-ubuntu-14-04/ (I stopped before the proxying part) but I can't access to 127.0.0.1:9000. From the logs it look like there is a problem with elasticsearch when i launch sonarcube.
/opt/sonar/log/sonar.log :
--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
2017.11.14 18:21:11 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
2017.11.14 18:21:11 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2017.11.14 18:21:11 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar/elasticsearch]: /opt/sonar/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonar/temp/conf/es
2017.11.14 18:21:11 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2017.11.14 18:21:13 INFO app[][o.e.p.PluginsService] no modules loaded
2017.11.14 18:21:13 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
java.security.policy: error adding Entry:
java.net.MalformedURLException: no protocol: ${codebase.elasticsearch-rest-client}
java.security.policy: error adding Entry:
java.net.MalformedURLException: no protocol: ${codebase.httpasyncclient-4.1.2.jar}
java.security.policy: error adding Entry:
java.net.MalformedURLException: no protocol: ${codebase.netty-common-4.1.13.Final.jar}
java.security.policy: error adding Entry:
java.net.MalformedURLException: no protocol: ${codebase.netty-transport-4.1.13.Final.jar}
java.security.policy: error adding Entry:
java.net.MalformedURLException: no protocol: ${codebase.securesm-1.1.jar}
java.security.policy: error adding Entry:
java.net.MalformedURLException: no protocol: ${codebase.lucene-core-6.6.1.jar}
java.security.policy: error adding Entry:
java.net.MalformedURLException: no protocol: ${codebase.lucene-misc-6.6.1.jar}
2017.11.14 18:21:27 WARN app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
2017.11.14 18:21:27 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped
2017.11.14 18:21:27 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
/opt/sonar/logs/es.log :
2017.11.14 18:21:24 INFO es[][o.e.n.Node] initializing ...
2017.11.14 18:21:24 INFO es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (/dev/vda1)]], net usable_space [5.7gb], net total_space [9.6gb], spins? [possibly], types [ext4]
2017.11.14 18:21:24 INFO es[][o.e.e.NodeEnvironment] heap size [503.6mb], compressed ordinary object pointers [true]
2017.11.14 18:21:24 INFO es[][o.e.n.Node] node name [sonarqube], node ID [3PxDbRbDQ4-M_YDsv25FHg]
2017.11.14 18:21:24 INFO es[][o.e.n.Node] version[5.6.3], pid[8661], build[1a2f265/2017-10-06T20:33:39.012Z], OS[Linux/4.4.0-22-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/9-internal/9-internal+0-2016-04-14-195246.b$
2017.11.14 18:21:24 INFO es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, $
2017.11.14 18:21:26 INFO es[][o.e.p.PluginsService] loaded module [aggs-matrix-stats]
2017.11.14 18:21:26 INFO es[][o.e.p.PluginsService] loaded module [ingest-common]
2017.11.14 18:21:26 INFO es[][o.e.p.PluginsService] loaded module [parent-join]
2017.11.14 18:21:26 INFO es[][o.e.p.PluginsService] loaded module [percolator]
2017.11.14 18:21:26 INFO es[][o.e.p.PluginsService] loaded module [reindex]
2017.11.14 18:21:26 INFO es[][o.e.p.PluginsService] loaded module [transport-netty4]
2017.11.14 18:21:26 INFO es[][o.e.p.PluginsService] no plugins loaded
2017.11.14 18:21:27 ERROR es[][o.e.b.ElasticsearchUncaughtExceptionHandler] fatal error in thread [main], exiting
java.lang.ExceptionInInitializerError: null
at org.apache.lucene.analysis.miscellaneous.StemmerOverrideFilter$Builder.build(StemmerOverrideFilter.java:205) ~[lucene-analyzers-common-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:55$
at org.apache.lucene.analysis.nl.DutchAnalyzer.<init>(DutchAnalyzer.java:133) ~[lucene-analyzers-common-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:55:17]
at org.apache.lucene.analysis.nl.DutchAnalyzer.<init>(DutchAnalyzer.java:106) ~[lucene-analyzers-common-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:55:17]
at org.elasticsearch.indices.analysis.PreBuiltAnalyzers$20.create(PreBuiltAnalyzers.java:246) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.indices.analysis.PreBuiltAnalyzers.getAnalyzer(PreBuiltAnalyzers.java:487) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.index.analysis.AnalysisRegistry$PrebuiltAnalysis.<init>(AnalysisRegistry.java:407) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.index.analysis.AnalysisRegistry$PrebuiltAnalysis.<init>(AnalysisRegistry.java:392) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.index.analysis.AnalysisRegistry.<init>(AnalysisRegistry.java:62) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.indices.analysis.AnalysisModule.<init>(AnalysisModule.java:177) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.node.Node.<init>(Node.java:340) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.3.jar:5.6.3]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.3.jar:5.6.3]
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:468) ~[?:?]
at java.security.AccessController.checkPermission(AccessController.java:894) ~[?:?]
at java.lang.SecurityManager.checkPermission(SecurityManager.java:541) ~[?:?]
at java.lang.Class.checkMemberAccess(Class.java:2584) ~[?:?]
at java.lang.Class.getDeclaredFields(Class.java:2092) ~[?:?]
at org.apache.lucene.util.RamUsageEstimator$1.run(RamUsageEstimator.java:339) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.util.RamUsageEstimator$1.run(RamUsageEstimator.java:336) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.apache.lucene.util.RamUsageEstimator.shallowSizeOfInstance(RamUsageEstimator.java:336) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.util.RamUsageEstimator.shallowSizeOf(RamUsageEstimator.java:313) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.util.fst.ByteSequenceOutputs.<clinit>(ByteSequenceOutputs.java:154) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
... 21 more
java -version :
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
sonarqube version : 6.7
I launch sonarqube as root so there should not have problem coming from access right.
All the post that i find about this error where related with openjdk9 but this is not my case.
Do you have an idea of what is happening ?
SonarQube 6.7 includes an upgraded version of Elasticsearch which cannot be run as root. Thus, SonarQube can no longer be run as root.
The blog post you followed seems to recommend / assume that you're running as root. To not start SonarQube as root, simply end your su session, or log back in as yourself to start the process. Note that you'll need to make sure the user you are starting SonarQube as has 7 (read, write, execute) on the SonarQube directory, recursively, and 6 (read, write) on the log files if they already exist.
In my case, the Java version was the problem.
I installed Oracle JDK 8 for for sonarcube 6.7.1, which resolved the problem:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
You can read more about the supported platforms here. For now, only Java 8 is supported.
I got the following error in cmd:
INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up
and running INFO app[][o.e.p.PluginsService] no modules loaded INFO
app[][o.e.p.PluginsService] loaded plugin
[org.elasticsearch.transport.Netty4Plugin] WARN
app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value
[es]: 1 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped INFO
app[][o.s.a.SchedulerImpl] SonarQube is stopped
It had problems setting up Elasticsearch on its default port number 9001. (You can check it in the logs folder: .\sonarqube-7.6\logs)
I just changed the port number from 9001 to 0 in the sonarqube properties file.
Go to- .\sonarqube-7.6\conf\sonar.properties and set sonar.search.port=0
Port 0 takes any port which is unused.
Good luck with the changes
Getting elasticsearch "can not run as root" error after upgrading from SonarQube 6.5 to 6.6. Nothing else changed.
CentOS release 6.8 (Final)
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) [elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) [elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) [elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) [elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) [elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) [elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) [elasticsearch-5.6.2.jar:5.6.2]
2017.10.20 11:59:14 WARN es[][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:136) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.2.jar:5.6.2]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:195) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.2.jar:5.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.2.jar:5.6.2]
... 6 more
I also experienced this problem, running SonarQube, as root, on Centos 7, not inside docker. As mentioned in previous comments, the problem comes from SonarQube upgrading ElasticSearch, and the new version no longer allows itself to be run as root.
In my environment the fix was easy enough: I had already created a user ("sonar") and group ("sonar") to "own" the sonarqube files. Since my SonarQube process had been running as root, it had left the logs and temp files owned by root.
1. I stopped the service.
2. Reassigned all the ownserships ("chown -R sonar:sonar /opt/sonarqube-6.6")
3. Changed #RUN_AS_USER= in /opt/sonarqube-6.6/bin/linux-x86-64/sonar.sh line 48 to RUN_AS_USER=sonar and both the sonarqube service and its elasticsearch service restarted without further problems. I was left having to go to http://<sonarhost:port>/setup to upgrade the database and from there everything worked fine.
Change in systemd:
User=sonar
Group=sonar
and change all source and
#RUN_AS_USER=sonar
It will run. It seem the error in enviroment when run in root then su to sonar
Faced the same issue, do some changes in my sonar service file and it start working. below is my sonar service file
[Unit]
Description=SonarQube service
After=syslog.target network.target
[Service]
Type=forking
#Type=simple
User=sonar
Group=sonar
PermissionsStartOnly=true
ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop
StandardOutput=syslog
LimitNOFILE=65536
LimitNPROC=8192
#TimeoutStartSec=5
Restart=always
[Install]
WantedBy=multi-user.target
Also follow change the home directory of sonar user
$ usermod -d /opt/sonarqube sonar
I downloaded sonarqube-6.5 and tried setting up a new user "sonar" but still es fails for me with the same reason - Ubuntu 16.4.
I'm trying to install Elasticsearch on my local machine. I have download the Elasticsearch and try to setup it as following documentation
But when I'm trying to Run bin/elasticsearch it shows permission error for logs. Then I tried to run it as sudo bin/elasticsearch then it shows following error
[2017-11-20T12:08:40,340][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:134) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:121) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:69) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.0.0.jar:6.0.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:104) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:130) ~[elasticsearch-6.0.0.jar:6.0.0]
... 6 more
Need instructions to fix this thanks
You should give the logs dir the permissions(drwxrwxr-x) of your current user, and start es by bin/elasticsearch(Don't start as root!).
I found following documentation ElasticSearch Hello World Example . As I using Linux OS I followed the 1.4 Ubuntu Linux: Install with commands
I have to load ElasticSearch plugins with the offline instructions but it looks like I am getting a permissions error even when I open up permissions to the files completely and running as root! I've removed and reinstalled as well but this error is consistent.
[root#ip-10-94-146-130 bin]# ./plugin install file:///home/jmblnvr/shield/license-2.1.0.zip
-> Installing from file:/home/jmblnvr/shield/license-2.1.0.zip...
Trying file:/home/jmblnvr/shield/license-2.1.0.zip ...
Downloading .DONE
Verifying file:/home/jmblnvr/shield/license-2.1.0.zip checksums if available ...
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
Installed license into /usr/share/elasticsearch/plugins/license
[root#ip-10-94-146-130 bin]# service elasticsearch restart
Stopping elasticsearch: [FAILED]
Starting elasticsearch: Exception in thread "main" java.lang.IllegalStateException: Unable to initialize plugins
Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/plugins/license/plugin-descriptor.properties
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:86)
at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:302)
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:108)
at org.elasticsearch.node.Node.<init>(Node.java:148)
at org.elasticsearch.node.Node.<init>(Node.java:129)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
[FAILED]
From /var/log:
[root#ip-10-94-146-130 elasticsearch]# cat elasticsearch.log
[2015-12-15 11:44:24,525][INFO ][node ] [Valtorr] stopping ...
[2015-12-15 11:44:24,639][INFO ][node ] [Valtorr] stopped
[2015-12-15 11:44:24,641][INFO ][node ] [Valtorr] closing ...
[2015-12-15 11:44:24,647][INFO ][node ] [Valtorr] closed
[2015-12-15 11:44:26,097][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
[2015-12-15 11:44:26,314][INFO ][node ] [Agon] version[2.1.0], pid[21703], build[72cd1f1/2015-11-18T22:40:03Z]
[2015-12-15 11:44:26,314][INFO ][node ] [Agon] initializing ...
[2015-12-15 11:44:26,318][ERROR][bootstrap ] Exception
java.lang.IllegalStateException: Unable to initialize plugins
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:111)
at org.elasticsearch.node.Node.<init>(Node.java:148)
at org.elasticsearch.node.Node.<init>(Node.java:129)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/plugins/license/plugin-descriptor.properties
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:86)
at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:302)
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:108)
... 6 more
I was having the same sort of exception but after installing and while loading x-pack plugin on Elasticsearch 5.2.1:
Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/plugins/x-pack/plugin-descriptor.properties
In my case, I started by adding elasticsearch user to the root group:
usermod -aG root elasticsearch
Afterwards, it was only necessary to modify the ownership of the plugins folder:
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/plugins/
Thanks to Val, simple solution is after installing plugins you need to quickly change ownership/groups if you are using the RPM install of Elastic:
chown -R root:elasticsearch /usr/share/elasticsearch