Skip to content

Djangss/Aether-DATA

Repository files navigation

Aether Data

This project sets up Apache Cassandra using Docker and provides a way to interact with it via cqlsh. Below are the instructions on how to get started, including the system requirements and steps for running the project.

Requirements

  • Docker: Ensure Docker is installed on your machine. You can download it from here.
  • Docker Compose: Docker Compose is needed to manage multi-container Docker applications. You can find installation instructions here.
  • CQLSH (Cassandra Query Language Shell): This tool is bundled with Cassandra and is used to interact with the database.

Optional Tools

  • Cassandra Driver: Optionally, install the Cassandra driver for Python, Java, or Node.js if you intend to interact with Cassandra programmatically.

Setup

  1. Ensure Docker is running: Make sure Docker is installed and the Docker daemon is up and running. You can verify this by running:
docker --version
  1. Start Cassandra using Docker: This project uses Docker Compose to set up Cassandra. You can start Cassandra by running the following command:
./docker_build.sh

This will pull the necessary Docker images and start the containers. The -d flag ensures the containers run in the background.

  1. Verify Cassandra is running: Once Docker Compose has started Cassandra, you can verify it's running by checking the logs:
docker ps

Using CQLSH

cqlsh is the command-line shell for interacting with Cassandra.

Access cqlsh: To interact with your Cassandra instance, you can either:

  • Enter the Cassandra container and run cqlsh directly:
docker exec -it build-cassandra-1 cqlsh
  • Or run cqlsh directly from your host machine (if cqlsh is installed locally):
cqlsh localhost 9042

Running CQL Scripts:

You can run a CQL script to initialize the database. If you have a CQL file, for example, init-db.cql, you can execute it inside the running Cassandra container:

docker cp /path/to/init-db.cql <cassandra_container_name>:/scripts/init-db.cql
docker exec -it <cassandra_container_name> cqlsh -f /scripts/init-db.cql

This will execute all the CQL commands in the script to set up your keyspaces, tables, etc.

Example Commands: After accessing cqlsh, you can run basic Cassandra commands like:

  1. List keyspaces:
DESCRIBE KEYSPACES;
  1. Create a new keyspace:
CREATE KEYSPACE seo_keyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
  1. Use a keyspace:
USE seo_keyspace;
  1. Query a table:
SELECT * FROM seo_page_data;

Stopping and Cleaning Up:

To stop all services and remove the Docker containers, you can use the following command:

./clean_docker.sh

This will stop and remove all the containers defined in your docker-compose.yml file.

Troubleshooting

Docker Issues: If you encounter issues with Docker not starting or containers failing, try checking the logs using docker-compose logs.

Ports: Ensure that the default Cassandra port (9042) is not blocked or used by another service.

cqlsh Connection Refused: If cqlsh is unable to connect, verify that Cassandra is running, and check the port mappings in your docker-compose.yml file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors