I am interested in best practices for changing the default data and log path in the elasticsearch.yml file. I have found various references on the web about how this is done (a simple copy of the data as well as a snapshot restore to a new path) but it is unclear to me which is the recommended way from Elastic. Is there a definitive best practice on how to change the default data and log path?
So my plan of action will be the following based on my current understanding:
create new data storage location i.e. /foo/bar/log and /foo/bar/lib
chown elasticsearch:elasticsearch /foo/bar/log and /foo/bar/lib
shutdown the single node elasticsearch.service that I want to change the path on.
cp /var/lib/elasticsearch/ /foo/bar/
cp /var/logs/elasticsearch/ /foo/bar/
modify the elasticsearch.yml file and comment out the original path.logs and path.data items, create new path.logs and paths.log entries to the new locations listed above.
start the elasticsearch.service on the modified node.
validate cluster is 'green' and searching data is functioning as expected.
delete old data at old location at later time as needed/desired.
Is there anything else that I am missing from these order of operations or that I have missed completely?
Items 1 and 4+5 don't match and you're copying logs and data into /foo/bar/. Try cp /var/lib/elasticsearch /foo/bar/data and cp /var/logs/elasticsearch /foor/bar/logs, that way the names are clear.
I wouldn't be moving logs though to be honest, leave them in the system default location.
Understood. Thank you for the syntax error catch and recommendation.
In my case the data and logs are on an external NFS mounted storage device and that device is going away. So all data from the current nodes in the cluster needs to be 'migrated' to the new NFS storage system.
Beyond the cp example above, I am thinking that an array level migration of the data to the new storage system and then a modification of the underlying mount will be most efficient and clean. That will require a complete cluster shutdown upon cutover, but the paths and overall data structures will remain the same.
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.