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”.
1. Install DevCenter
In the first place, you must check 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 to 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” in the unzipped folder. Then you can see the following window.
2. 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:
Choose “File” -> “New” -> ”Connection” or click “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 be connected 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:
Clicking “Add” button, the IP address is added to the connection settings. If authentication and encryption are not enabled in your cluster, you can click “Finish” button directly and the connection is ready. Otherwise, you have to click “Next” button and then you will see the following window.
If your cluster enabled authentication, tick off “This cluster requires credentials” option and enter your user name and password of the cluster into “Login” and “Password” respectively. The information can be found in Instaclustr console “Connection Info” shown in the following picture:
If your cluster enabled encryption, you must install Java Cryptography Extension (JCE) on your local machine first. You need to download the version of 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 Files\Java\jre7\lib\security
You can use the following command to do copy.
For Mac and Linux:
cp <source file> <destination directory>
copy <source file> <destination directory>
Tick off “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 start the connection.
3. Basic interaction with DevCenter
Once your connection has been set up successfully, you can see keyspaces and Cassandra tables of your cluster in the “Schema” panel of DecCenter like the following:
After selecting the connection and keyspace you want to interact with, you can write any CQL 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: