Difficulty: Beginner
Estimated Time: 2 hours

📚 Datastax: Cassandra, Astra DB and Stargate

If you are already familiar with our Cassandra stack and just want to move on to the first exercise go to the next section => ⚒️ Create Astra DB Instance. Otherwise, read on.

We will cover:

  1. Top Level Overview of the Astra DB Stack
  2. Cassandra Details
  3. Astra DB Information
  4. Stargate APIs

1. Top Level Overview of the Astra DB Stack

Sources Cassandra Documentation, Astra DB Documentation and Stargate Documentation

🔵 Cassandra: is the NoSQL Open Source Database which is the foundation of the stack. Cassandra powers many extremely large and demanding databases for enterprises around the world, and is the best option for companies needing scalability and performance.

🔵 Astra DB: provides a serverless instance of Cassandra. This comes with a free $25 credit, providing a significant amount of data and transactions. You're charged only for what you use, and there's no credit card needed.

🔵 Stargate: is an open source engine to provide APIs for Cassandra databases. It's available free for your use, and comes with every Astra DB instance.

2. Cassandra Details


🔵 NoSQL: Cassandra is a NoSQL database. Unlike many other systems, by default it requires a schema (the Stargate Document API does not require a schema). There is a CQL query language for working with Cassandra. CQL does not handle joins, and transactions are unbelievably fast.

🔵 Nodes: Cassandra is designed to be distributed. You decide how many nodes you need, and you can introduce them into your instance without any downtime. Each node can handle thousands of transactions per second per core, and every node can handle any query. Nodes keep each other up to date by something called "gossiping", making sure your data stays current.

🔵 Datacenters: Cassandra can have many nodes per datacenter, and as many data centers as you like.

🔵 Use cases: Here's a high level overview of the use cases where Cassandra really shines. ok

3. Astra DB Information



🔵 Free tier: We replaced our free tier with a $25/month credit which gets you a great deal of bandwidth and storage for experimenting and running small applications.

🔵 Stargate: All Cassandra instances come with Stargate included.

Ok, let's move on and get into our first lab, where we get our Astra DB instance.

C* Made Easy: Harnessing Stargate APIs with Node.js

Step 1 of 6

Step 1

⚒️ Create your Astra DB instance

Exercise time: ~10 minutes


In this step, we will:

  • Create an Astra DB database to store data

We will cover:

  1. Register and Sign In to Astra DB
  2. Configure and create your database
  3. Let Astra DB Start Up

One of the first things we need to do is hook up the "plumbing" of our application to talk to our back-end services, namely, our Cassandra database with Astra DB. Once this is in place, we are connected and ready to go with the services we need to power our app.

We will be making use of the Document API and REST API to connect to our Astra DB database. The Stargate API framework allows developers the freedom to access Astra DB with a variety of APIs. The REST and GraphQL APIs make it easy to interact with standard Cassandra databases. With the Document API, you can save and search schemaless JSON documents in Cassandra. No need to use SQL, CQL, or any database drivers to talk to the data layer. Just code and move on.

ahem...for those of you familiar with Apache Cassandra, yes, I just said you could skip data modeling.

Document API Flow

1. Register and Sign In to Astra DB

The ASTRA service is available at url https://astra.datastax.com. ASTRA is the simplest way to run Cassandra with zero operations at all - just push the button and get your cluster. Astra DB offers $25 credit/month and requires no credit card to setup. That $25 gives you a lot of storage space and transactions, and you have no worries of being accidentally charged.

✅ Step 1a. Use the dialogs to create an account and/or sign in

You can use your Github, Google accounts or register with an email.

Make sure to chose a password with minimum 8 characters, containing upper and lowercase letters, at least one number and special character

Registration Image

2. Configure and create your database

✅ 1. All of our databases are now serverless, so just click "Create Database" in the left pane and you're good to go.

✅ 2. Choose your plan: The "Pay as You Go" plan gives you $25/month of traffic and storage, and does not require a credit card - if you get close to the limit we'll let you know. Click "Get Started."

✅ 3. Name your Database: With our new serverless plan you can have as many databases as you need. For this workshop, use "node-stargate" as the database name and "workshop" as the Keyspace name. image

✅ 4. Select a cloud provider: You can use either GCP or AWS. Chose a region that's geographically close to you.

✅ 5. Click Create Database

3. Let Astra DB Start Up

Honestly, there's not much to do here, but wait a couple minutes for your Astra DB database to start up. Once completed, you will have a fully managed Apache Cassandra database ready to rock and power your app.

You will see your new database Pending or Initializing in the Dashboard. image

The status will change to Active when the database is ready, this will only take 2-3 minutes and you will also receive an email when it is ready.

Awesome! While you are waiting for your database to startup feel free to move to the next section.