Follow

How To: Change Data Directories for Elasticsearch & Cassandra

By default, Elasticsearch and Cassandra are configured to write to their default data locations (/var/lib/elasticsearch and /var/lib/cassandra). In many instances it will be preferable to change this location either immediately after installation, or later on after deployment.

To change the Elasticsearch data directory:

1) Stop Elasticsearch with sudo service elasticsearch stop.
2) Create a new data directory for Elasticsearch in your desired location (e.g. sudo mkdir /data/elasticsearch).
3) Ensure the new directory has appropriate permissions for the Elasticsearch user (e.g. sudo chown elasticsearch:elasticsearch /data/elasticsearch).
4) Update the "path.data" config line in /etc/elasticsearch/elasticsearch.yml to point to the newly created directory.
5) OPTIONAL - if you have existing data in your cluster, move it to the newly defined data directory (e.g. sudo mv /var/lib/elasticsearch/data/* /data/elasticsearch/).
6) Start Elasticsearch with sudo service elasticsearch start.

 

To change the Cassandra data directory:

1) Stop Cassandra with sudo service cassandra stop.
2) Create a new data directory for Cassandra in your desired location (e.g. sudo mkdir /data/cassandra).
3) Ensure the new directory has appropriate permissions for the Cassandra user (e.g. sudo chown cassandra:cassandra /data/cassandra).
4) Update the "data_file_directories" config line in /etc/cassandra/conf/cassandra.yml to point to the newly created directory.
5) Move your existing Cassandra data into the new directory (e.g. sudo mv /var/lib/cassandra/data/* /data/cassandra). Note that unlike Elasticsearch, this step is not optional as the contents of the data/keyspaces must match what Cassandra is tracking in its commit log.
6) Start Cassandra with sudo service cassandra start.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk