I'm having an issue with setting up multiple instances of Elasticsearch 7.5 on one node. I've created 3 seperate directories, each with elasticsearch.yml, jvm.options, and log44j2.properties.
I run the command "/bin/elasticsearch -Epath.conf=/etc/elasticsearch2/elasticsearch.yml" on 3 terminals on my machine and I only get a warning saying can not run elasticsearch as root. I assume this is fine since its just a warning?
This is the message that I get when running elasticsearch. Is this causing a problem with my Elasticsearch? I can still curl 192.168.30.11:9200 and get information about the cluster though.
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2020-02-08T15:16:38,796]
[WARN][o.e.b.ElasticsearchUncaughtExceptionHandler] [myNode_1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
As for the notes in the doc, I've configured my first elasticsearch as the masternode through 192.168.30.11:9200. The other nodes in discovery.seed_providers are identified by 192.168.30.11:9200, 192.168.30.11:9201, 192.168.30.11:9202. The second and third config have the exact same settings except I've added node.master: false and node.data: true in the other 2 files.
Yes that looks fatal to me. On my machine Elasticsearch exits after logging that:
$ tar xf ~/Downloads/elasticsearch-7.5.0.tar.gz
$ sudo elasticsearch-7.5.0/bin/elasticsearch
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2020-02-08T21:00:30,746][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [Davids-MBP-3.lan] 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:163) ~[elasticsearch-7.5.0.jar:7.5.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.5.0.jar:7.5.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.5.0.jar:7.5.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.5.0.jar:7.5.0]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.5.0.jar:7.5.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.5.0.jar:7.5.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.5.0.jar:7.5.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105) ~[elasticsearch-7.5.0.jar:7.5.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) ~[elasticsearch-7.5.0.jar:7.5.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.5.0.jar:7.5.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.5.0.jar:7.5.0]
... 6 more
$
Maybe you have another Elasticsearch process running?
I created a local user with sudo priveleges, but when I run sudo /bin/elasticsearch it gives me the exact same error. I even tried chown -R 777 /etc/elasticsearch and the config directories but it gives an error saying permission denied.
It seems like elasticsearch will work on one instance if I do systemctl start elasticsearch. But I don't think I can run multiple elasticsearch instances using systemctl.
I'm not following. The message says you cannot run Elasticsearch as root. I am not really understanding what else you expect to happen if you run Elasticsearch as root, which is what sudo bin/elasticsearch does. You should run it as a normal non-root user.
I'm sure it's possible to run multiple nodes all managed by systemd but by default I think it is only configured to run one indeed. You can launch multiple processes in lots of ways; perhaps the simplest is to open multiple terminals and run one process in each terminal. If you really need to configure systemd to run multiple nodes then you will need help from someone who knows more about configuring systemd than I do.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.