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-java-v4-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. 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 prerequisites:
- 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).
- Java Development Kit (JDK) 1.8+
- On Ubuntu, run
apt-get install default-jdk
to install the JDK.
- On Ubuntu, run
- Be sure to set the JAVA_HOME environment variable to point to the folder where the JDK is installed.
- Download and install a Maven binary archive
- On Ubuntu, you can run
apt-get install maven
to install Maven.
- On Ubuntu, you can run
- Git
- On Ubuntu, you can run
sudo apt-get install git
to install Git.
- On Ubuntu, you can run
-
Clone this repository using
git clone https://github.com/Azure-Samples/azure-cassandra-mi-java-v4-getting-started
. -
Update parameters in
src/main/resources/application.conf
:- Enter the datacenter name in the
DC
field. - Enter
username
andpassword
indatastax-java-driver.advanced.auth-provider
section, and the IP addresses of your cluster seed nodes indatastax-java-driver.basic.contact-points
.
- Enter the datacenter name in the
-
Run
mvn clean package
from the top level folder to build the project. This will generatecassandrami-examples.jar
under target folder. -
Run
java -cp target/cassandrami-examples.jar com.azure.cassandrami.examples.UserProfile
in a terminal to start your java application.
The code included in this sample is intended to get you quickly started with a Java command line application that connects to Azure Managed Instance for Apache Cassandra.