page_type | languages | products | description | urlFragment | ||
---|---|---|---|---|---|---|
sample |
|
|
Azure Managed Instance for Apache Cassandra provides automated deployment and scaling operations for managed open-source Apache Cassandra datacenters. |
azure-cassandra-mi-nodejs-getting-started |
Azure Managed Instance for Apache Cassandra provides automated deployment and scaling operations for managed open-source Apache Cassandra datacenters. It accelerates hybrid scenarios and reduces ongoing maintenance.
This quick start demonstrates how to connect to a Cassandra Managed instance cluster with Node.js. You'll then build a user profile console app, output as shown in the following image, with sample data.
- Before you can run this sample, you must have the following pre-requisites:
- An Azure Managed Instance for Apache Cassandra cluster. Check out our Quickstart guide here.
- Networking access from this application to your Azure Managed Instance for Apache Cassandra cluster (the service only deploys private IP addresses injected into a Virtual network).
- Node.js version v0.10.29 or higher.
- Git.
- Node.js driver for apache cassandra // to install the driver - run npm install cassandra-driver.
-
Clone this repository:
git clone git@github.com:Azure-Samples/Azure-Samples/azure-cassandra-mi-node-getting-started.git cassandrami
-
Change directories to the repo:
cd cassandrami
-
Install npm dependencies:
npm install
-
Next, substitute the contactPoint, username, password, and localDataCenter values in
config.js
with your corresponding Azure Managed Instance for Apache Cassandra values.module.exports = { username: "Cassandra cluster username", password: "Cassandra cluster password", contactPoint: "I.P. address of a node in your cluster", keySpace: "uprofile", localDataCenter: "datacenter-1" };
-
Run
uprofile.js
in a terminal to start your start your node application:npm start
The code included in this sample is intended to get you quickly started with a Node.js console application that connects to Azure Managed Instance for Apache Cassandra.