Change path.data to elasticsearch

Hi,

I have elasticseach 5.6.10-1 installed on RedHat 7.
I want to change path of data to /data (for example)
So i changed parameter "path.data" to elasticsearch.yml on /etc/elasticsearch put when i restart elasticsearch, i have error

systemctl start elasticsearch.service

â elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since jeu. 2018-07-05 11:29:44 CEST; 11s ago
Docs: http://www.elastic.co
Process: 18844 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet -Edefault.path.logs=${LOG_DIR} -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=${CONF_DIR} (code=exited, status=1/FAILURE)
Process: 18841 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 18844 (code=exited, status=1/FAILURE)

juil. 05 11:29:39 srvinfgraylog.aaa.ccfa systemd[1]: Starting Elasticsearch...
juil. 05 11:29:39 srvinfgraylog.aaa.ccfa systemd[1]: Started Elasticsearch.
juil. 05 11:29:44 srvinfgraylog.aaa.ccfa systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
juil. 05 11:29:44 srvinfgraylog.aaa.ccfa systemd[1]: Unit elasticsearch.service entered failed state.
juil. 05 11:29:44 srvinfgraylog.aaa.ccfa systemd[1]: elasticsearch.service failed.

Log from /var/log/elasticsearch/graylog.log

tail -50 /var/log/elasticsearch/graylog.log

[2018-07-05T11:36:25,688][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [srvinfgraylog] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Unable to access 'path.data' (/var/lib/elasticsearch)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.10.jar:5.6.10]
Caused by: java.lang.IllegalStateException: Unable to access 'path.data' (/var/lib/elasticsearch)
at org.elasticsearch.bootstrap.Security.addPath(Security.java:450) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:291) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:246) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Security.configure(Security.java:119) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:228) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.10.jar:5.6.10]
... 6 more
Caused by: java.nio.file.AccessDeniedException: /var/lib/elasticsearch
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:1.8.0_171]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:1.8.0_171]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:1.8.0_171]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:1.8.0_171]
at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_171]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_171]
at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_171]
at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:492) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Security.addPath(Security.java:448) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:291) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:246) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Security.configure(Security.java:119) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:228) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.10.jar:5.6.10]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.10.jar:5.6.10]
... 6 more

I changed script of elasticsearch in /etc/init.d, delete "-Edefault.path.data=${DATA_DIR}" parameter but error still persist.
Do you know how can i change the path.data ?

Regards

Caused by: java.nio.file.AccessDeniedException: /var/lib/elasticsearch

The user that elasticsearch is running under doesn't have sufficient access rights to this directory.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.