This section explains how to move installed Elasticsearch directories, using default locations.
Before you begin, make sure that you have:
SUDO access
A backup of the /etc/elasticsearch/elasticsearch.yml file
Follow the steps below to move Elasticsearch data. Migrating logs is optional and relevant instructions appear in parentheses.
To move Elasticsearch data (and logs):
Determine the current location of your data files by running the following command:
> curl "localhost:9200/_nodes/settings?pretty=true"
With Octopus Server installation, the default folders are /var/lib/elasticsearch and /var/logs/elasticsearch
Create a new directory structure. For example:
> cd /opt/<new location>/ > mkdir elsdata
(If you want to migrate the logs, create an additional folder mkdir elslogs)
Stop the sdomcbe service by running the following command:
> systemctl stop sdomcbe
Stop the Elasticsearch service by running the following command:
> systemctl stop elasticsearch
Navigate to the current data directory (as determined in Step 1), and copy files to the new location. For example:
cp -RP * /opt/<new location>/elsdata/
(If you are migrating the logs, copy those files to elslogs)
Change ownership on the new directory to Elasticsearch:
> chown -R elasticsearch:elasticsearch /opt/<new location>/elsdata/
(If you are migrating logs, run the same command for elslogs)
Change ownership on the sdo directory to sudo chmod o+rx /opt/sdo/
Edit the data path of the elasticsearch.yml file:
> vi /etc/elasticsearch/elasticsearch.yml
Change the path.data data parameter to path.data:/opt/<new location>/elsdata/
(If you are migrating logs, change the path.logs data parameter as well.)
Start the Elasticsearch service by running the following command:
> systemctl start elasticsearch.service
Start the sdomcbe service by running the following command:
> systemctl start sdomcbe