Kenneth Woods
Kenneth Woods

Reputation: 65

How to move an application to Cassandra?

This is probably a stupid question, but I've just started interning at a company and I'm supposed to figure out how to migrate a large C-based algorithmic application from MySQL to Cassandra (I'm completely new to all this). I've been looking up how I would approach this for a day now, but I'm still a bit unclear. I see that to operate in Cassandra, the data should be denormalized. Also, there are several tools for migrating data from MySQL to Cassandra like Sqoop or the Bulk Loader.

So my question is: to move this application to Cassandra, am I supposed to change every SQL statement and table to Cassandra, perhaps using Datastax's C Driver? Or do I just add something to the application that writes the MySQL Data to a keyspace in Cassandra as the application is running, like it says here?

A vast majority of resources I've found just show how to move data to Cassandra, as opposed to an entire application's logic. Also, most resources I've found seem to be outdated - it seems that because newer versions of Cassandra have approximately equal read and write rates, my impression is that there isn't a huge need to completely denormalize the data.

FYI: The current data is stored in approximately thirty tables of statistics aggregated from wireless access points.

Upvotes: 1

Views: 326

Answers (1)

ashic
ashic

Reputation: 6495

You will need application changes. Data read / write code is very different between cassandra and mysql. You'll be able to a lot of queries in mysql that you won't be able to in cassandra - cassandra requires data to be modelled in a way that supports efficient querying using its (compared to sql) limited query language, CQL.

Is your data relational? Are joins being used? Or is it mostly key-value data, possibly in a time series? If it's statistics, and without joins, it might be considerably easier than otherwise.

You'll need to model your cassandra data model according to the queries that your application (and possibly other applications) use. You can then create the cassandra schema, and export / import the mysql data. For that you can use tools like Pentaho, or even write a migration application. How much data is there currently in the database? If it's not too much, you might be able to get away with csv export and import.

You're application will need to change. Change the application to read and write to cassandra. Can you tolerate downtime? If not, consider the approaches outlined in the link you posted.

This is not a trivial undertaking. Depending on the data model currently in mysql, this might be a major undertaking.

Good luck!

Upvotes: 3

Related Questions