This github covers using DataStax Query Builder to do basic CRUD actions
-
Basic understanding of Docker images and containers.
-
Docker installed on your local system, see Docker Installation Instructions.
-
When using Docker for Mac or Docker for Windows, the default resources allocated to the linux VM running docker are 2GB RAM and 2 CPU's. Make sure to adjust these resources to meet the resource requirements for the containers you will be running. More information can be found here on adjusting the resources allocated to docker.
- Prepare Docker environment-see the Prerequisites section above...
- Pull this github into a directory
git clone https://github.com/jphaugla/datastaxQueryBuilder.git
- Refer to the notes from DataStax Docker github for background on the needed DataStax images. Directions are here: https://github.com/datastax/docker-images/#datastax-platform-overview. Don't get too bogged down here as the included docker-compose.yaml handles most everything.
- Open terminal and change to the github home where you will see the docker-compose.yml file, then:
docker-compose up -d
- Verify DataStax is working (may take a minute for datastax cassandra to startup so be patient)
docker exec dse cqlsh -e "desc keyspaces"
- At this point can use the command shell from cassandra using
docker exec -it dse cqlsh
The java code demonstrates opening a cassandra session using the datastax driver. Next, standard statement execution is used to create a keyspace and a table. Then, inserts and reads are performed using various techniques to document simple statements and QueryBuilder methods. mvn is used to execute all of this
- Complile the code
mvn package
- Execute the code
mvn exec:java
At this point, run throught the cql worksheet and enjoy playing with Cassandra!
- To get the IP address of the DataStax and openldap:
export DSE_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dse)
and:
export LDAP_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' openldap)
- use
echo $DSE_IPE
andecho $LDAP_IP
to view - can add to the docker compose to run additional datastax workloads such as analtyics (-k), search (-s), and graph (-g)
command:
-s
-g
-k