Persisting data
To persist data, create directories on the local host and map the directory to the corresponding volume.
-v
option.
For
example:docker run -v local_directory:container_volume
DataStax exposes data volumes to preserve data. See volumes and data directories for a list of exposed volumes.
Procedure
- Create a directory on the Docker host.
-
Bind mount the local directory to the configuration file that will be persisted
by starting the container with the
-v
option.Setting the
DS_LICENSE
environment variable signals your acceptance of the DataStax terms of service and is required for the software to start.
Example
Mounting a DSE data volume
Mount the 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. Hosting the /var/lib/cassandra
directory outside the container with the -v
option allows the
Docker container to be deleted and recreated without losing data.
docker run -e DS_LICENSE=accept --name my-dse -v /dse/data:/var/lib/cassandra
Mounting a DSE configuration volume
docker run -e DS_LICENSE=accept \ --name my-dse \ -v /dse/conf:/config datastax/dse-server \ -d datastax/dse-server
Mounting an OpsCenter configuration volume
Mount the local directory to the exposed volume
/var/lib/opscenter by starting the container with the
-v
option.
docker run -e DS_LICENSE=accept \ -v /dse/data/opscenter:/var/lib/opscenter \ --name my-opscenter \ -d datastax/dse-opscenter