In Cassandra Lunch #77, we show you how you can connect to your DataStax Astra database using standalone CQLSH. The live recording of Cassandra Lunch, which includes a more in-depth discussion and a demo, is embedded below in case you were not able to attend live. If you would like to attend Apache Cassandra Lunch live, it is hosted every Wednesday at 12 PM EST. Register here now!
In Cassandra Lunch #77, we show you how you can connect to your DataStax Astra database using standalone CQLSH using Gitpod! If you are not familiar with the DataStax CQLSH shell, it is a command-line shell for remotely interacting with your database through CQL. It can be downloaded here! The CQLSH shell requires Python 2.7 and it connects to 127.0.0.1 9042 by default. However, you can optionally specify the IP address and port to interface with a remote DataStax database, like in our case. Since we are using DataStax Astra, we will need to create a database, and create a token, which generated a client id, client secret, and download the secure connect bundle.
In the walkthrough below, we will spin up this GitHub repo on Gitpod. You can also spin up the repo on Gitpod, but hitting the button the README.md!
If you want to watch the live recording of the demo, you can watch the video embedded below. Otherwise, you can try your own hand at this using the instructions below! We’ve also added some next actions to further extend the tutorial aspect of this Data Engineer’s Lunch, so if you have any other suggestions, feel free to create a GitHub issue!
In method 1, we will use a bash script
startup.sh script either uses stored credentials from the
creds.config file or prompts you to insert them in via the command line. If prompted to input credentials, then they will get saved to creds.config, so you do not have to do it repeatedly.
In method 2, we will use cqlshrc. This is currently a manual method since Gitpod does not currently persist the
~/ directory upon workspace restart. A bash script for this is in the works.
sudo mkdir -p ~/.cassandra
mv cqlshrc ~/.cassandra
- Add ability to read from ENV vars
- Improve process for cqlshrc method
- Pivot to connect to Scylla Cloud, AWS Keyspaces, Azure Cosmos DB, etc
If you missed Apache Cassandra Lunch #77: Connect to DataStax Astra via Standalone CQLSH, it is embedded below! Additionally, all of our live events can be rewatched on our YouTube channel, so be sure to subscribe and turn on your notifications!
Don’t forget to check our other Cassandra Lunch topics here!
Cassandra.Link is a knowledge base that we created for all things Apache Cassandra. Our goal with Cassandra.Link was to not only fill the gap of Planet Cassandra but to bring the Cassandra community together. Feel free to reach out if you wish to collaborate with us on this project in any capacity.
We are a technology company that specializes in building business platforms. If you have any questions about the tools discussed in this post or about any of our services, feel free to send us an email!