==============================================
This project demonstrates a simple DevOps setup using Docker containers. It consists of two main components:
- A Cassandra database container
- A Python application container that interacts with the Cassandra database
- Docker installed on your system
- Docker Compose installed on your system
git clone https://github.com/your-username/your-repo-name.git
Build the Docker images:
docker-compose build
Start the containers:
docker-compose up
Check the status of the containers:
docker-compose ps -a
This should display both the Cassandra and Python containers running.
Accessing the Cassandra Database Enter the Cassandra container:
sudo docker-compose exec cassandra bash
Start the CQLSH tool:
cqlsh
Switch to the mykeyspace keyspace:
USE mykeyspace;
Run a SELECT query to retrieve the data:
SELECT * FROM mytable;
This should display the data you inserted earlier:
id | name
----+----------
1 | John Doe
2 | Jane Doe
You can exit the cqlsh tool by typing EXIT or QUIT.
Alternatively, you can also use the cqlsh command with the -e option to execute a query directly:
cqlsh -e "SELECT * FROM mykeyspace.mytable;"
This should display the data.
Overview
The Python application container interacts with the Cassandra database. It uses the cassandra-driver library to connect to the Cassandra database. Code The Python code is located in the python directory. It consists of a simple script that connects to the Cassandra database and inserts some sample data.