- Download and install Docker from the Docker website.
- Download the DataStax Docker images from Docker Hub.
- Create a Cassandra database or have a team member provide access to their Cassandra database to obtain database connection details.
- Download the secure connect bundle to obtain connection credentials for your database.
- Create a .cassandra directory in your home directory.
- Copy the secure connect bundle that you downloaded and place it in the ~/.cassandra directory.
cp secure-connect-database_name.zip ~/.cassandra
- Unzip the secure connect bundle in the ~/.cassandra directory.
The cqlshrc file is included in the secure connect bundle. When you unzip the bundle, this file will be placed in your ~/.cassandra directory.Note: Only one cqlshrc file is supported per directory. The default directory for this file is ~/.cassandra.
- Modify the cqlshrc configuration file to include the path to the security certificate for the database, private RSA key, and user certificate.
You should only need to add
~/.cassandrato the file path for each of the following variables.
[ssl] validate = true certfile = ~/.cassandra/ca.crt userkey = ~/.cassandra/key usercert = ~/.cassandra/cert
- From your home directory, run the following command to map the directory from 1 to the Cassandra database created using the DataStax Astra console.
docker run -it --rm -v ~/.cassandra:/etc/dse/.cassandra \ --entrypoint /opt/dse/bin/cqlsh datastax/dse-server --ssl -u username -p password
The command binds the directory from the
Automatically removes the container when the session ends. Omit this option to persist the container across sessions.
Bind mounts a directory on the local host to a DSE volume to manage configurations or preserve data.
In this instance, the command maps the local ~/.cassandra directory to the /opt/dse/.cassandra directory in the remote Cassandra database.
Overwrites the default entrypoint set by the image.
In this instance, the command overrides the default entrypoint set by the DSE server so that only the cqlsh command runs.
Connects to the database using SSL.The container starts and opens a
cqlshprompt that you can use to issue commands to the Cassandra database.
Connected to database_name at host_name:30003. [cqlsh 5.0.1 | DSE 6.8.0 | CQL spec 3.4.5 | DSE protocol v2] Use HELP for help. database_user_name@cqlsh:keyspace_name>