Reputation: 1059
(I am new to elasticsearch)
I want to start elastic search as a service (sudo service elasticsearch start), but it wont start, and not tell anything about why it wont start either, just says -
Starting Elasticsearch Server [fail]
I tried following changes without success!
Changed es.logger.level: INFO to es.logger.level: DEBUG and es.logger.level: TRACE
respectively without seeing anything in the log files in var/log/elasticsearch!
Added ES_HEAP_SIZE= 1024 and ES_HEAP_SIZE= 512
respectively in usr/share/elasticsearch/bin/elasticsearch
text file, still -
Starting Elasticsearch Server [fail]
I have not tried changing anything in the configuration file at etc/elasticsearch/elasticsearch.yml
- is it required to change the settings of this file to make elasticsearch work as a service in ubuntu?
Upvotes: 1
Views: 10618
Reputation: 1059
It basically comes down to user permissions given to elasticsearch "user" - yes elasticsearch runs as a "user" inside Ubuntu! You need to give it ownership permissions inside folders it will eventually modify.
You need to do the following inside a terminal:
sudo chown -R elasticsearch:elasticsearch /var/lib/elasticsearch
/var/lib/elasticsearch
is where elasticsearch stores data.
sudo chown -R elasticsearch:elasticsearch /var/run/elasticsearch
/var/run/elasticsearch
is where the process id of elasticsearch running as a service is stored.
sudo chown -R elasticsearch:elasticsearch /etc/elasticsearch
/etc/elasticsearch
is the place where configuration file for elasticsearch service and elasticsearch logs is stored. Changing ownership of any of the above folders will bring you back to square one, you will need to follow steps 1, 2 and 3 again!
You may also need to set JAVA_HOME variable, to make elasticsearch run as a service.
(change elasticsearch.yml only as a root user, accessing it from within the terminal)
Upvotes: 7