Changing data directory of single-node install (Centos)

I installed CrateDB 4.2.4 using “bash -c "$(curl -L https://try.crate.io/)”" on my centos machine.

It’s installed in my /home directory. However my /home directory has less space and I want to change the data directory to /opt/crate_data. How do I achieve this?

Change the configuration file (crate.yml) and include

# Storage: CrateDB can utilize multiple volumes in parallel, make sure to set
# the owner to 'crate:crate'
path.data: /opt/crate_data

I already have a few tables in /home directory. Would changing path.data affect them?

yes, but copying the folder/files from the data folder in your home directory over to /opt/crate_data should work.

you should make those changes, while the cluster is stopped.

Okay thank you ! I am kind of new to this so just wanted to know what this means “make sure to set
the owner to 'crate:crate’” in crate.yml?

you have to make sure, that crate has the appropriate permissions (read/write) the folder.
depending on which user you start crate with, you have to adapt that.

With the quick-start script I think crate typically should start with your logged in user and therefore that user should have sufficient rights.

1 Like

Hi,

I came across the same situation now. New to crate.
Can you please let me if the following are steps that need to be followed.

  1. Stop crate
  2. add new path in the crate.yml file
  3. copy crate folder from old path to new path
  4. start crate

I just want to make sure that I don’t lose any data

yes, this should work.
Be aware that the user that you start crate with has the appropriate permissions on that folder.


Best practice would definitely also be to create a (backup) snapshot first: Snapshots — CrateDB: Reference

1 Like