From a previous post we talked about the basics of Cassandra. From this post I’m going to talk about the installation and the basic setup of a project in JAVA. When talking about the Cassandra installation it’s a very simple thing, not hard as MySQL installation. Let’s see installation in step wise.
- Step 01 : For the latest release it requires jdk 8 and python 2.7 to be installed. You can verify it by following commands.
- Step 02 : Download tar.gz file from the following location. According to the Cassandra official document Even-numbered releases (e.g. 3.2) contain new features and odd-numbered releases (e.g. 3.3) contain bug fixes only.
- Step 03 : Next we can untar the files.
tar -zxvf file-name.tar.gz
- Step 04 : Next go to the ./bin directory and execute following command to start the Cassandra server.
- Step 05 : We can verify whether Cassandra started or not using following command.
- Or else we can use the ps command as well.
If we check we can see the /data directory and the /logs directory which have being created at the installation automatically at the default location.
Now the installation is successful and we can use the cqlsh command line tool for execute Cassandra queries.
Also we can log in using a specific user as well. Here the user ‘cassandra‘ is the default user which created at the installation. Default password will be ‘cassandra‘ as well.
I’ll talk more about cqlsh and CQL query in the next post. Here I will list only few commands. Using the HELP command on the cqlsh we can get the list of help documentations in Cassandra.
CQL queries are most like SQL queries. For an example,
Now let’s see how to setup a MVN project to work with Cassandra. For that we need following dependencies to be added to the pom.xml.
After syncing the project we can see the dependencies will be added under the External Libraries.
Hope now you have a clear idea in how to install Cassandra and how to setup the initial maven project. Let’s talk more about CQL, cqlsh in next posts. Keep in touch for the next post. Thank You!