1. Make sure you have installed Docker Desktop for Windows.
2. Open Windows PowerShell
3. Download Cassandra image from the Docker Hub registry.
Let’s pull Cassandra 4.01 image by type this command: docker pull cassandra:4.0.1
4. Start Cassandra
To start Cassandra, use docker run command that first creates a writeable container layer over the specified image, and then starts it using the specified command in a new container docker run --rm --name fercassandra -dp 9042:9042 cassandra:4.0.1
The --rm flag automatically removes the container (fercassandra) when it exits,
--name flag assign a name to the container
--detach , -d flag run container in background and print container ID
--publish , -p flag publish a container's port(s) to the host
5. Cassandra is running
6. CQL Shell
a. Click CLI button to open window for interacting with Cassandra using CQL,
then type this query:
SELECT cluster_name, listen_address, listen_port, data_center, rpc_address, rpc_port FROM system.local;
b. Use docker exec command to run CQL Shell in a running container, then type the query:
c. Use docker exec command to run CQL shell cqlsh for interacting with Cassandra using CQL (the Cassandra Query Language). It is shipped with every Cassandra package, and can be found in the bin/ directory alongside the cassandra executable.
7. Show more..
a. Use docker ps command to shows running containers:
b. Use docker port command to list port mappings or a specific mapping for the container:
That's enough for now, hope it helps someone.