question

satvantsingh_190085 avatar image
satvantsingh_190085 asked Erick Ramirez commented

How do I change the location of the data directory on a running cluster?

Hi,

How can I change data directly location in my running cluster.

Example : /data to /dse_data

cassandraconfiguration
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

lounes.amani_148266 avatar image
lounes.amani_148266 answered satvantsingh_190085 commented

Hi satvantsingh_190085,


You can change it in your cassandra.yaml file, as specified in the docs here:


https://docs.datastax.com/en/dse/6.7/dse-admin/datastax_enterprise/config/configCassandra_yaml.html#Defaultdirectories


Bear in mind that you will need to restart the node(s).


Also: https://stackoverflow.com/questions/9631591/apache-cassandra-data-storage-on-disk

1 comment Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

satvantsingh_190085 avatar image satvantsingh_190085 commented ·

Thanks @lounes.amani_148266 for your answer and it seems it is for new cluster configuration,But I am looking answer for running cluster like If my /data directory is full and somehow I am not able to increase size of /data and want to migrate all my data to new directory /data_dse.

0 Likes 0 ·
Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez commented

@satvantsingh_190085 Follow this procedure to relocate the data directory in a rolling fashion, one node at a time.

NOTE - These instructions apply to open-source Apache Cassandra as well.

STEP 1 - Force all data to be flushed to disk so there are no commit logs to replay on startup:

$ nodetool drain

STEP 2 - Shutdown DSE (or Cassandra).

STEP 3 - Relocate the contents in the old data_file_directories to the new location. For example, if the old location is /var/lib/cassandra/data and the new location is /path/to/new/data:

$ mv /var/lib/cassandra/data/* /path/to/new/data/.

STEP 4 - Review all the other directories used by Cassandra. If the filesystem is going to be affected, you will need to relocate these directories too:

hints_directory: /var/lib/cassandra/hints
metadata_directory: /var/lib/cassandra/metadata
commitlog_directory: /var/lib/cassandra/commitlog
cdc_raw_directory: /var/lib/cassandra/cdc_raw
saved_caches_directory: /var/lib/cassandra/saved_caches

STEP 5 - Review the directories you've configured in dse.yaml to see if you need to relocate them too.

STEP 6 - Update the directory paths in cassandra.yaml (and dse.yaml if necessary) to reflect the changes you made in the previous step.

STEP 7 - Start DSE on the node. Monitor the progress of the startup sequence, for example:

$ tail -f /var/log/cassandra/system.log

It might also be necessary to monitor the application logs to make sure there are no issues with the cluster after the node has been restarted.

Repeat the steps above on the next node until all nodes in the cluster has been updated. Cheers!

2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

satvantsingh_190085 avatar image satvantsingh_190085 commented ·

Thank You very much @Erick Ramirez .

1 Like 1 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ satvantsingh_190085 commented ·

Not a problem. Cheers!

0 Likes 0 ·