-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.sh
executable file
·32 lines (24 loc) · 1008 Bytes
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
echo "Setting up user management transaction examples..."
# Check if Cassandra is running
if ! docker ps | grep -q cassandra-accord; then
echo "Starting Cassandra container..."
docker run -d --name cassandra-accord -p 9042:9042 pmcfadin/cassandra-accord
# Wait for Cassandra to be ready
echo "Waiting for Cassandra to start..."
while ! docker exec cassandra-accord ./bin/cqlsh -e "describe keyspaces" > /dev/null 2>&1; do
sleep 2
done
fi
# Create schema
echo "Creating schema..."
docker exec -i cassandra-accord ./bin/cqlsh < schemas.cql
# Load sample data
echo "Loading sample data..."
docker exec -i cassandra-accord ./bin/cqlsh < sample_data.cql
echo "Setup complete! Running verification..."
# Verify setup
docker exec -i cassandra-accord ./bin/cqlsh -e "SELECT email, country, city FROM users.user;"
echo ""
echo "Setup complete! You can now run user management transactions using:"
echo "docker exec -i cassandra-accord ./bin/cqlsh < transaction.cql"