elastic / ansible-elasticsearch

Ansible playbook for Elasticsearch
Other
1.58k stars 854 forks source link

After installing, elasticsearch will not start due to no logging configuration? #58

Closed jerrac closed 8 years ago

jerrac commented 8 years ago

I just did an initial test install with this role. I configured three nodes and ran the play. When I tried checking the health of the cluster, it became apparent that elasticsearch was not started.

So I tried starting it manually, and I got this:

root@node1:~# /usr/share/elasticsearch/bin/elasticsearch
Failed to configure logging...
ElasticsearchException[Failed to load logging configuration]; nested: NoSuchFileException[/usr/share/elasticsearch/config];
    at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:158)
    at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:103)
    at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:204)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:258)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
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:142)
    ... 4 more
log4j:WARN No appenders could be found for logger (bootstrap).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
    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.
root@node1:~# ls /etc/elasticsearch/
elasticsearch.yml  node1  logging.yml  scripts

Here are the ansible vars, just replace node1 with node2 or node3 to get the other nodes config:

es_version: 2.1.1
es_log_dir: "/opt/elasticsearch/logs"
es_work_dir: "/opt/elasticsearch/temp"
es_heap_size: "3072m"
es_config: 
  cluster.name: "asdfqwerty"
  discovery.zen.ping.unicast.hosts: "http://node1:9301"
  http.port: 9200
  transport.tcp.port: 9301
  bootstrap.mlockall: True
  discovery.zen.ping.multicast.enabled: False
  path.repo: "/path/to/repo/path"
  discovery.zen.minimum_master_nodes: 2
  action.destructive_requires_name: True

es_instance_name: "node1"

es_config: 
  node.name: "node1"
  node.data: True
  node.master: True

es_data_dir: "/mounts/node1"

Did I miss some required var?

I did try /etc/init.d/node1_elasticsearch start and it did not work, nor did it output any errors. Just Starting ... [OK]. /var/logs/elasticsearch is empty so I can't figure anything out from there.

So, what obvious step am I missing?

Should this kind of question be posted on discuss.elastic.co somewhere instead of here? If so, what forum?

pengyue commented 7 years ago

not solved on Elasticsearch 5.4.1 deb package (Ubuntu 14.04.2 LTS)

Pytlicek commented 7 years ago

After upgrade to 5.5.0 i have this problem. What helped me : Uninstall openjdk9 install openjdk8 Symlink config : ln -s /etc/elasticsearch /usr/share/elasticsearch/config Correcting rights :

chmod g+rwx /usr/share/elasticsearch/config/elasticsearch.yml /usr/share/elasticsearch/config/logging.yml
chmod g+rwx /usr/share/elasticsearch/config/elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml
seunghan-go commented 7 years ago

I had same issue today. When I did upgrade ubuntu 14.04 to 16.04, installed elasticsearch with 'apt-get install elasticsearch' and 'systemctl start elasticsearch' has no problem, but it was old version, so I had to update with 5.1.1. 'dpgk -i elasticsearch-5.5.1.deb' then, failed to start service. (exactly same issue. no configf file even start as a service)

So, remove completely with below commands. 'apt remove --purge elasticsearch' 'apt autoremove' 'apt-get install elasticsearch' -> then faced to 'stateoverride' problem. . to solve it, 'vi /var/lib/dpkg/stateoverride', remove lines which include 'elasticsearch'

'dpgk -i elasticsearch-5.5.1.deb' 'systemctl start elasticsearch' no problem.

kelp404 commented 7 years ago

It is really stupid. Today, this issue is still exists with elasticsearch-5.5.2.

gingerwizard commented 7 years ago

@kelp404 @seunghan-go can you please provide the playbook you are using for which this issue arises.

@seunghan-go your post suggests you aren't even using ansible - this repo is for the ansible role for ES NOT generic issues with installing ES.

mandadimuralidharreddy commented 7 years ago

@olendorf cp /etc/elasticsearch/elasticsearch.yml /user/share/elasticshare/config is giving error it should be cp /etc/elasticsearch/elasticsearch.yml /usr/share/elasticsearch/config

sandstrom commented 6 years ago

I think this may be caused by an old /etc/elasticsearch/elasticsearch.yml where no entry for path.logs exists. On a fresh deb install it should be path.logs: /var/log/elasticsearch. With that set, this error should not occur.

pranvendra commented 6 years ago

I had the similar problem with elasticsearch 5.6.0. No logs were getting generated and while running it using init.d scrips it was showing no file found /usr/share/elasticsearch/config. So, I did two things:-

ln -s /etc/elasticsearch /usr/share/elasticsearch/config

and after this the following commands

sudo chown -R elasticsearch:elasticsearch /var/lib/elasticsearch
sudo chown -R elasticsearch:elasticsearch /var/run/elasticsearch
sudo chown -R elasticsearch:elasticsearch /etc/elasticsearch
janCstoffregen commented 6 years ago

I had the same issue, just because I did not start the binary with sudo.

d1rk commented 6 years ago

@pranvendra Thanks, this works like a charm. Nice solution.