Changing the Default Data Directory Post Installation for a Leaf Node

You can configure a custom location for the data directory on a node. Some of the reasons this may be required are :

  • moving the data directory to a bigger file system directory.

  • restructuring the directories as part of a clean-up process.

In an HA setup, you can perform the procedure by just stopping one leaf node at a time. Repeat this procedure for each node as required.

1. List the leaf nodes and their corresponding MEMSQL_IDs:

sdb-admin list-nodes

2. Check the current default data directory on the leaf node:

sdb-admin describe-node --memsql-id <MEMSQL_ID> --property datadir 

3. Create the new data directory in the new location and update its permissions and owner to the same as the current data directory.

4. Stop the target leaf node by executing:

sdb-admin stop-node --memsql-id <MEMSQL_ID> 

5. Login to the specific leaf node which you stopped and move the data directory to the new path:

sudo mv <source_data_directory> <new_data_directory_path>

6. Update the new data directory path from the Master Aggregator:

sdb-admin update-config --key datadir --value <new_data_directory_path> --memsql-id <MEMSQL_ID>

7. Validate the changes made using this command:

sdb-admin describe-node --memsql-id <MEMSQL_ID>

8: Restart the leaf node by executing:

sdb-admin start-node --memsql-id <MEMSQL_ID>

9: Verify the status of the leaf node:

sdb-admin list-nodes 

In a non-HA setup, stop all the nodes before performing the following procedure.

1. List the leaf nodes and their corresponding MEMSQL_IDs:

sdb-admin list-nodes

2. Check the current default data directory on the leaf node:

sdb-admin describe-node --memsql-id <MEMSQL_ID> --property datadir  

3. Create the new data directory in the new location and update its permissions and owner to the same as the current data directory.

4. Stop the leaf nodes by executing:

sdb-admin stop-node --all

5. Login to the specific leaf node where you want to make the change and move the data directory to the new path:

sudo mv <source_data_directory> <new_data_directory_path> 

6. Update the new data directory path from the Master Aggregator:

sdb-admin update-config --key datadir --value <new_data_directory_path> --memsql-id <MEMSQL_ID> 

7. Validate the changes made using this command:

sdb-admin describe-node --memsql-id <MEMSQL_ID> 

8. Repeat this procedure for each node as required.

9. Restart the leaf nodes:

sdb-admin start-node --all 

10. Verify the status of the leaf nodes:

sdb-admin list-nodes