Getting Started with DevCenter for Cassandra developmentMenu
DevCenter is a visual CQL (Cassandra Query Language) query tool provided by DataStax. This article describes how you can set up DevCenter to interact with clusters in Instaclustr. In this article, we assume that your cluster has been set up and provisioned properly as show in our previous tutorial “Creating a Cluster”.
Ensure java has been installed on the local machine, because DevCenter is an Eclipse RCP-based application. The following command can be used to check whether java has been installed or not.
The output will look something like: java version “1.8.0_40”, if java is installed. If java is not installed on your machine, please refer https://www.java.com/en/download/help/index_installing.xml to install java first.
DevCenter can be downloaded from DataStax. If your machine is Mac, before you download the application, please go to “System Preferences” -> “Security & Privacy” and select “Anywhere” option for “Allow apps downloaded from” first. After downloading, you can change back to your original setting.
Unzip the downloaded zip file and launch DevCenter by double clicking “DevCenter.exe” or “DevCenter.app”. Then you can see the following window.
Connect to a Cluster
Before trying to connect a cluster, the IP address of your local machine must be added to the “Cassandra Allowed Addresses” at “Settings” panel in Instaclustr console.
A connection to a cluster can be set up by the following steps:
In DevCenter, choose “File” -> “New” -> ”Connection” or click “Create a new connection” button in the “Connections” panel to create a new Connection. Then you will see the following window:
Set up the “Connection name” and input the public IP address of the nodes you want to connect to into “Contact hosts”. You can find the public IPs of the nodes in Instaclustr console at the location marked by the red frame in the following picture:
Click the “Add” button to add the IP address to connection settings. If authentication and encryption are not enabled in your cluster, you can click “Finish” button and the connection is ready. Otherwise, click “Next” button and then you will see the following window:
If your cluster has authentication enabled, Select “This cluster requires credentials” option and enter your username and password of the cluster into “Login” and “Password” respectively. The information can be found in Instaclustr console “Connection Info” as shown in the following picture:
If your cluster has encryption enabled, you must install Java Cryptography Extension (JCE) on your local machine first. You need to download the version that matches your installed JVM and copy “local_policy.jar” and “US_export_policy.jar” to the java installation directory (Note: these two jars will be already there so you have to overwrite them):
- Mac OS X: /Library/Java/JavaVirtualMachines/jdk1.major.minor_update/Contents/Home/jre/lib/security
- Linux: /usr/lib/jvm/jdk1.major.minor_update/jre/lib/security
- Windows: Program FilesJavajre7libsecurity
You can use the following command to copy the files:
For Mac and Linux:
cp <source file> <destination directory>
copy <source file> <destination directory>
Select “This cluster requires SSL” option in the above connection configuration panel and download the “ca-certificates” file from Instaclustr console at “Connection Info” shown in the following picture:
You can find the truststore file “truststore.jks” in the downloaded “ca-certificates” folder and truststore password (default KeyStore password is “instaclustr”) in the “Read Me.txt” file. Enter the full path to (or navigate to) the truststore file you downloaded and truststore password. Finally, you can click “Finish” button to complete the connection setup.
Your connection will be listed in the “Connections” panel of DevCenter. To start connecting to your cluster, select your connection in the “Connections” panel and click “Open Selected Connection” button OR right-click on your connection and click “Open Connection”.
Basic interaction with DevCenter
Once your connection has been set up successfully, you can view keyspaces and Cassandra tables of your cluster in the “Schema” panel of DevCenter.
After selecting the connection and keyspace you want to interact with, you can write CQL statements in the CQL editor. You need to click the green button on the top of the CQL editor panel to run your CQL. Here is a simple example: