Hi again, finally i learned how to interact with a Cassandra Server using scala. I am learning this language in order to write efficient code in order to interact with Apache Spark and another big data tools, like Cassandra, Kafka, Flume, machine learning algorithms and so many others.

The most impatient can download the project from github and start to modify it with your needs.

There are two projects inside, a common subproject with all the necessary to interact with Cassandra, some tests and finally there is a main project with a query.

In order to run it, download it and run the next commands:

MacBook-Pro-Retina-de-Alonso:~ aironman$ cd Downloads/
MacBook-Pro-Retina-de-Alonso:Downloads aironman$ cd cassandra-scala-app-master/
MacBook-Pro-Retina-de-Alonso:cassandra-scala-app-master aironman$ sbt
[info] Set current project to My Project (in build file:/Users/aironman/Downloads/cassandra-scala-app-master/)
> compile
[info] Updating {file:/Users/aironman/Downloads/cassandra-scala-app-master/}cassandra-scala-app-master...
[info] Updating {file:/Users/aironman/Downloads/cassandra-scala-app-master/}common...
[info] Resolving jline#jline;2.12 ...
[info] Done updating.
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Updating {file:/Users/aironman/Downloads/cassandra-scala-app-master/}main...
[info] Done updating.
[info] Resolving org.clapper#argot_2.11;1.0.3 ...
[info] Compiling 3 Scala sources and 1 Java source to /Users/aironman/Downloads/cassandra-scala-app-master/common/target/scala-2.11/classes...
[info] Resolving jline#jline;2.12 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/aironman/Downloads/cassandra-scala-app-master/main/target/scala-2.11/classes...
[success] Total time: 6 s, completed 14-mar-2016 11:10:26
> project main
[info] Set current project to main (in build file:/Users/aironman/Downloads/cassandra-scala-app-master/)
> run
[info] Running common.utils.cassandra.CassandraMain 
Trying to connect to Cassandra server...
host is: localhost
port is: 9042
keyspace is: test
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Connected to Cassandra server...
row is foo
Finishing connection to Cassandra


An existing cassandra server must be running before you run this tiny proof of concept, there are so many ways to install and run a Cassandra server. I am using OS X,so, for me, the recommended way is to use homebrew.

Follow this entry in order to install Cassandra using homebrew.

Next step?

Write some scala code to interact with twitter and save those tweets into a Cassandra instance...



Thank you Manuel Kiessling with your help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s