Skip to content

Anant/Cassandra.Api

Repository files navigation

Leaves on DataStax Astra™ with NoSQL, and Apache Cassandra™ in the cloud!

version

Open in Gitpod

Table of Contents

  1. Astra Setup & Configuring Credentials
  2. Getting Started
    1. Running Data Migrator
    2. Node JS
    3. Python
    4. Running Unit Tests
    5. Running Admin UI

Setup

1.1 Create Account

  • Before you start using our tools, you'll need to create an account on DataStax Astra

Astra

1.2 Create New Database

  • You'll then be directed to the home page. Locate the Create Database button on the left side:

NikitaPic

  • On the following screen, press the Get Started button underneath "Pay as you go":

NikitaPic

  • Enter a database name and keyspace name. Select any of the providers at the bottom and select the region closest to you. Then press Create Database

NikitaPic

  • Now wait a few minutes for the database to spin up, and click on the name of the database on the left side of the screen. Expected result:

NikitaPic

Database is ready, notice how the status changed from pending to Active and now you now have the connect button enabled.*

1.3 Finding Secure Connect Bundle

  • Get your secure connect bundle.
  • Press the blue Connect button at the top right corner, and then select "Node.js" under the menu "Connect using a driver":

NikitaPic

1.4 Download Secure Connect Bundle

  • Finally, click the Download Bundle button to download the zip. Once saved, move the zip into the cassandra.api/astra.credentials directory of this project.

NikitaPic

1.5 Generate Tokens For Database

  • In the top left corner, press the arrow next to the "Current Organization" name and go to Organization Settings:

NikitaPic

  • Navigate to Token Management, Select the role "Admin User" and press Generate Token. Expected result:

NikitaPic

  • Before leaving this page, make sure to save these three values into a text document (or press the 'Download CSV' button)

1.6 Configure Cassandra.API Connection

  • Fill in the naming conventions you declared earlier, when you setup your database, in your (cassandra.api/astra.credentials/UserCred.json) file
  • For Username, input your generated Client ID (from Token Management)
  • For Password, input your generated Client Secret
  • The following is an example of that the UserCred.json file would look like using the credentials used for configuring the Astra instance.
{ 
    "username":"your-client-id", 
    "password":"your-client-secret", 
    "cluster":"testdb2", 
    "keyspace":"testkeyspace", 
    "table":"leaves"
}

The last value table wasn't declared before so you can do that here for the first time.


Getting Started

It's best to go through this project in the following order so you do not get confused.

2.1 Run the data migrator to transfer data from our cassandra.api to your Astra Database.

2.2 Setup an API so that you can communicate with your Astra database. We have 2 APIs for you to use:

2.3 Run this set of unit tests against your API to confirm that it is working properly.

2.4 Launch Web Admin UI to visualize your Astra Database in Table Format


Reference Material

Cassandra.API Documentation Walkthrough

Cassandra.API Blog Post: Part 1

Cassandra.API Blog Post: Part 2

Building a REST API with DataStax Astra using Node & Python: Part 1

Building a REST API with DataStax Astra using Node & Python: Part 2

Cassandra.API Live Workshop w/DataStax

Cassandra.API Video Demo: Part 1

Cassandra.API Video demo: Part 2