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):

  1. 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

  2. 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)

  3. Stop the sdomcbe service by running the following command:

    > systemctl stop sdomcbe
  4. Stop the Elasticsearch service by running the following command:

    > systemctl stop elasticsearch
  5. 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)

  6. 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)

  7. Change ownership on the sdo directory to sudo chmod o+rx /opt/sdo/

  8. 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.)

  9. Start the Elasticsearch service by running the following command:

    > systemctl start elasticsearch.service
  10. Start the sdomcbe service by running the following command:

    > systemctl start sdomcbe
Footer - Secret Double Octopus