For more information check Cassandra on Docker Hub
First download the image:
$ docker pull cassandra:4.0
$ docker pull cassandra:3.11.8
Then create a running server container named cassandra-server
:
$ docker run --name cassandra-server -p 9042:9042 -e CASSANDRA_CLUSTER_NAME=cassandra-cluster -e CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch -e CASSANDRA_DC=cassandra-datacenter -d cassandra:3.11.8
To ensure the container is running:
$ docker ps
If the container is not running:
$ docker start cassandra-server
$ docker exec -it cassandra-server cqlsh
To close, press Ctrl+D
First install Cassandra Workbench in Visual Studio Code. Open workspace [Ctrl+Shift+P
] (workspace path is needed for configuration to generate), activate extension by running command from palette Cassandra Workbench: Generate configuration
. This will generate .cassandraWorkbench.jsonc configuration file. Edit the configuration file as follow:
[
// AllowAllAuthenticator
{
"name": "Cluster AllowAllAuthenticator",
"contactPoints": ["127.0.0.1:9042"]
},
//PasswordAuthenticator
{
"name": "Cluster PasswordAuthenticator",
"contactPoints": ["127.0.0.1:9042"],
"authProvider": {
"class": "PasswordAuthenticator",
"username": "Your Username",
"password": "Your Password"
}
}
]
First stop the running container
$ docker stop cassandra-server
Then, save the container
$ docker commit cassandra-server cassandra-sample-image
To ensure the image is saved, check docker images:
$ docker images
To remove a container, first you have to stop it. then in order to remove stopped container:
$ docker rm cassandra-server
And to remove commited image:
$ docker rmi cassandra-sample-image
For more information, read Apache Cassandra Documentation (version 4 at the time of writing this documentation).
To see the version 3 documentation, open Cassandra version 3.11.8 Documentation.
What is the Cassandra database used for?
Is Apache Cassandra really the Database you need?
The Not-So-fictional tale of Cassandra and MongoDB for IoT Data Storage