简体   繁体   中英

Elasticsearch: Change permissions of old folder index to work with yum-installed elasticsearch

I used a specific library that used an embedded version of elasticsearch. Now as we are growing, I want to start elasticsearch as a service.

I followed this guide to install it using yum on a linux machine. I pointed ES to the new directory using

path:
    logs: /home/ec2-user/.searchindex/logs
    data: /home/ec2-user/.searchindex/data

When I start the service

sudo service elasticsearch start

I get a permission denied error:

java.io.FileNotFoundException: /home/ec2-user/.searchindex/logs/elasticsearch_index_search_slowlog.log (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
....

I guess this has to do with the folder permission, I changed folder permission using:

sudo chown elasticsearch:elasticsearch -R .searchindex

But that didn't help.

Any help?

Your user elasticsearch can't write in the logging folder : /home/ec2-user/.searchindex/logs

Check the permissions with ls -l

Set write permission with the chmod command :
eg : sudo chmod -R u+wx .searchindex

The issue occurred because .searchindex is located in ec2-user directory which obviously is inaccessible by elasticsearch user created to manage the elasticsearch service.

Moving the folder to /var/lib/elasticsearch did the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM