Apache Zeppelin, with Spark and Cassandra, the perfect tool

Zeppelin has become one of my favourite tools in my toolbox. I am heavily designing stuff for Cassandra and in Scala, and even though I love Cassandra there are times when things just gets so complicated with the CQL command line, and creating a small project in IntelliJ just seems like too much hazel. Then using Zeppelin to try out is just perfect. So this page is a How-To with some useful Cookbook recipes.

Setting Up Zeppelin

I use Docker where things are so much easier, and I pick v0.8.0 cause I never got 0.8.2 to work for some reason.

Download and Start Cassandra

 

Download and Start Zeppelin

Download Zeppelin image

Start Zeppelin on port 8080

-p hp:cp
hp = Host Port, the port on your local machine
cp = Container Port, the port inside the docker which is what Zeppelin is exposing

Go to localhost:8080 in your web browser and you should see something like this

Setup Zeppelin

Find out the IP address of Cassandra in you Docker network, as you can see of the inspect, the IP address is 172.17.0.3.

 

Set up IP address for Cassandra in the Spark Interpreter

Go to the section on “Spark”

Now add a row that says

Now also edit the Dependencies

You can do this in many ways, either you specify the MAVEN repo with version OR you download the JAR file(s) to disk and copy them into the Docker. I had to do the latter due to some issue with my network.

You need these two libraries :

Simply click on the JAR file and download the file, then copy it into the docker with

Setup IP address for Cassandra in Cassandra Interpreter

Create your first Notebook

Cookbook Recipes

Load Table into RDD and count rows

This is just to show how you load a table into an RDD, once in the RDD you can play around with it and do lots of stuff.

Show key spaces using the built in Cassandra interpreter using CQL

The result :

Create Keyspace and Table using CQL

Insert data by hand using CQL

Fill the table with bogus data using Spark and Scala

 

Select data using CQL

Create VIEW so that we can run SQL

 

Run SQL, ohh sweet SQL 🙂

By creating temporary views like this, we can also do joins if we would like to.

Obviously this is not how Cassandra was intended to be used, but the point here is more of giving the ability to troubleshoot, turist around in the data with ease instead of setting up a project, and do the joins inside of the code. Here we are able to really trail and error until we get what we want.

That was all for now

-Tobias

21 thoughts on “Apache Zeppelin, with Spark and Cassandra, the perfect tool

  1. yes you are right…Apache Cassandra is an open-source distributed NoSQL database management system built to handle large chunks of data over various data centers. Cassandra was developed at Facebook to overcome its “inbox search” issue and make it easier to find the conversations. Facebook later open-sourced Cassandra, and it became an Apache Foundation project. Cassandra is a highly scalable database and is freely available under the Apache License 2.0.

  2. Your ideas absolutely shows this site could easily be one of the bests in its niche. Drop by my website Webemail24 for some fresh takes about Search Engine Optimization. Also, I look forward to your new updates.

  3. Your writing style is cool and I have learned several just right stuff here. I can see how much effort you’ve poured in to come up with such informative posts. If you need more input about Social Media Marketing, feel free to check out my website at Seoranko

  4. Great post! I learned something new and interesting, which I also happen to cover on my blog. It would be great to get some feedback from those who share the same interest about Tantric Massage, here is my website Articlecity Thank you!

  5. Hey there, I appreciate you posting great content covering that topic with full attention to details and providing updated data. I believe it is my turn to give back, check out my website YW9 for additional resources about Airport Transfer.

Leave a Reply

Your email address will not be published. Required fields are marked *