Persisting data with volumes and directories
Persisting data allows the container to be deleted and re-created without losing data. DataStax exposes the following volumes so that underlying data directories can be mounted. If these volumes are not mounted, then sub-directories will be unavailable. If they are mounted, then the data written within the container can be preserved in a local directory.
Mount volumes
These instructions assume you are familiar with using volumes with Docker.
|
If the volumes are not mounted from the local host, all data is lost when the container is removed. |
To persist data in general, create the directories on the local host, and then map the local directory to the corresponding volume using the -v flag:
docker run -v local_directory:container_volume
For DSE specifically, mount the /var/lib/cassandra (DSE data volume) to the /dse/data directory on the Docker host to ensure that the /data, /commit_logs, and /saved_caches directories will be available.
docker run -e DS_LICENSE=accept --name my-dse -v /dse/data:/var/lib/cassandra
Hosting the /var/lib/cassandra directory outside the container with the -v option allows the Docker container to be deleted and re-created without losing data.
Exposed volumes
The following volumes are exposed for DSE:
| Directory | Description |
|---|---|
|
Database data |
|
DSE Analytics with Apache Spark™ data |
|
DSEFS data |
|
Database logs |
|
Spark logs |
|
Custom configuration files |
The following volume is exposed for DataStax Studio:
| Directory | Description |
|---|---|
|
DataStax Studio data |