Check the status of the container: docker ps -a, you will see a container running with
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 860be3abecf9 cassandra:5.0 "docker-entrypoint.s…" 4 minutes ago Up 4 minutes (healthy) 7000-7001/tcp, 7199/tcp, 9160/tcp, 0.0.0.0:9042->9042/tcp cassandra
Check with the logs docker logs cassandra | grep "9042", you will see the container logs with following, then your container is ready for use:
INFO [main] 2024-06-09 04:22:32,346 PipelineConfigurator.java:131 - Starting listening for CQL clients on /0.0.0.0:9042 (unencrypted)... INFO [main] 2024-06-09 04:22:32,353 CassandraDaemon.java:738 - Startup complete
SSH into container to interact with cqlsh: docker exec -it cassandra bash
Run the command cqlsh
Connected to SolarSystem at 127.0.0.1:9042 [cqlsh 6.2.0 | Cassandra 5.0-beta1 | CQL spec 3.4.7 | Native protocol v5] Use HELP for help. cqlsh>
List Default Keyspaces: describe keyspaces or desc keyspaces;
cqlsh> desc keyspaces; system system_distributed system_traces system_virtual_schema system_auth system_schema system_views
Ref: My day-to-day activities and hands-on experience with Cassandra operations, covering everything from setup to advanced maintenance and optimization techniques are here