I would like to start/run ES nodes using Supervisor on Ubuntu 14.04.2 LTS. Using ES 1.7.1 and planning upgrade to 2.x when complete. Currently we use the package install and ES installed in /usr/share/elasticsearch/bin/ and config in /etc/elasticsearch/elasticsearch.yml. There is also a logging.yml file in conf directory.
We have a 7-server stack with 2 app, 2 db (mysql + redis), 3 ES nodes. To allow non-dev staff to restart/monitor services we are moving all apps and server systems under supervisord on every box, and then using a central admin app to monitor/manage/tail them all. We have nginx, cassandra, mysql, redis, and other node and python apps all running under supervisor and ES is final piece (before other ELK stack items).
I try to run ES using /usr/share/elasticsearch/bin/elasticsearch and get log4j errors. I try adding the Des.config=/etc/elasticsearch/elasticsearch.yml and same errors. I see older posts about using a -f flag but when I tried that it said invalid flag.
Can you provide the recommended practice to start ES from command line?
ubuntu@search1:/$ sudo /usr/share/elasticsearch/bin/elasticsearch
-Des.config=/etc/elasticsearch/elasticsearch.yml
Failed to configure logging...
org.elasticsearch.ElasticsearchException: Failed to load logging configuration
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:142)
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:92)
at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:131)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:216)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/config
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:97)
at java.nio.file.Files.readAttributes(Files.java:1686)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:109)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:69)
at java.nio.file.Files.walkFileTree(Files.java:2602)
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:126)
... 4 more
log4j:WARN No appenders could be found for logger (node).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
These arguments are partly supplied by /usr/share/elasticsearch/bin/elasticsearch and partly by /etc/init.d/elasticsearch. I think the immediate you problem you have ("Failed to configure logging") can be fixed by passing -Des.default.path.conf=/etc/elasticsearch.
Thanks. I'm working through it and figured if I symlink the config files in /etc/elasticsearch/ that the startup errors don't fail. I'll review what the init script runs and add more as needed.
Taking @magnusbaeck suggestion to simulate the init script, I used trial/error to execute and the following works in command line and with supervisord config:
Supervisor config in /etc/supervisor/conf.d/elasticsearch.conf (note vars replaced by Ansible template)
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.