Rebecca Mills works in Developer Relations at DataStax.
Our first article covered Cassandra essentials: the “what” and “why” about the architecture. If you’re ready to try Cassandra, the next few articles will explain the “how.” At the end of these tutorials you should have a database up and running, experienced using Cassandra Query Language (CQL), gained some practical data modeling expertise, and learned best practices for building applications with Cassandra.
In the bootstrapping phase, we’re going to create a database. The next tutorial will explain how to work on that database, then go deep on data modeling, after that have a look at some more advanced concepts, and then finally application development with Cassandra.
Firstly, you’ll need to get your hands on the GitHub repository, where all the materials and resources are. You can either clone the repository with the following command, or download as a ZIP file (best alternative for Windows users).
git clone https://github.com/DataStax-Academy/cassandra-workshop-online
Some exercises in later articles will require an IDE; you can choose your favourite one.
As an application developer, unless you have a penchant for databases, you’ve probably spent a lot of time hooking up to an existing database or downloading one and installing it. DataStax Astra is an easy way to spin up a Cassandra database and use the pre-configured DataStax Studio to talk to your database and immediately get started with running CQL queries.
There’s a free tier on Astra you can use to experiment, and you can connect to it using the same DataStax driver whether you’re using open source Apache Cassandra, Astra or DataStax Enterprise. Once you are done experimenting, you can move to either your own OSS or DataStax Enterprise installation. Shifting your driver from connecting to Astra to your installation only takes a change of about 1-2 lines of code.
Access to the Astra service here: https://astra.datastax.com
Register and Login
The link above will bring you to the Astra Sign-in page. Provide your email and password, and click the Sign In button - or Sign up if you have yet to get yourself an Astra account.
Fill the Create New Database Form
As you don't have any instances yet, the login will route through the instance creation form. You will find below which values to enter for each field.
. While Astra allows you to fill in these fields with values of your own choosing, please use these suggested values to make the rest of the exercises easier to follow. If you don't, you are on your own!
. It's really important that you use the name killrvideo (with no 'e' in "killr") here in order for the exercises to work. You can get creative later, just roll with this for the time being.
. Note the username is case-sensitive. Please use the case suggested here.
. Fill in both the password and the confirmation fields. Note that the password is also case-sensitive. Stick to the case suggested here.
View your Database and connect
Click the View Database button on the pop-up to watch your database initialize. It may take 2-3 minutes for your database to spin up. You will receive an email at that point. But go ahead and continue with the rest of the exercise now.
Once the database is ready you should see the following in the Cloud Console (Click Astra Databases at the top left to get back to an overview of your databases).
Let’s review the database you have configured. If you are not viewing your database already, click into the “killrvideo” database in your console. In the box on the top-left side of the window, you can see the database and keyspace name metadata. The box on the top-right describes the size and location of your database.
The lower-left box shows your estimated cost ($0.00 since you are using the free tier). Once Astra initializes the database completely, the lower-right box will have connection details.
Open DataStax Studio
Click on the
link in the Developer Studio section, in the lower left side of the console. This should start up the Developer Studio tool. You will need to enter the username and password you used for the Astra instance creation.
. Note the username is case-sensitive, so use the case suggested here.
. Fill in the password. The password is also case-sensitive. Supply it in the exact same format that it has been provided to you.
You should get a message welcoming you to DataStax Studio.
Congratulations on setting up your first Cassandra database with Astra! Wasn’t that easy?
DataStax Studio is a great developer tool that we are going to use for our exercises. It is automatically configured to talk to our Astra database. Now from your cloned
repo, you are going to drag-and-drop a Studio Notebook into your Studio instance to begin your next exercise.
file from the “notebooks” folder and drop it in. Alternatively, you can upload it from the hamburger menu in the upper left hand corner of the console. Once you have the notebook up, you can begin following the instructions, including executing a CQL script to initialize the killrvideo database for this notebook.
We use the cells in Studio for the various steps of the exercises. Some cells are Markdown cells, which contain formatted text. Markdown is used for adding text or instructions to an exercise step in the notebook. Other cells are CQL cells, and allow you to execute CQL queries against your database directly from the notebook.
You can work through this notebook at your own pace, and be sure to head over to our Community forum if you have questions!
CQL (Cassandra Query Language) is a structured query language used to access Cassandra databases -- like SQL for relational databases. In this notebook, try out CQL and familiarize yourself with the language. If you already know SQL, CQL will be very intuitive.
To get started on the next exercise, use the hamburger menu to get back to where your notebooks are located in Studio. Upload the notebook
into your running instance of DataStax Studio:
Once again, just follow the instructions in the notebook. It will take you through learning the CQL syntax to enable you to write statements to add and manipulate data in your Astra database.
You did it! That’s it for this tutorial. The next one will cover data modeling in Cassandra.
Create your free account to unlock your custom reading experience.