Birendra Kumar
Birendra Kumar

Reputation: 441

How to transfer mysql data to cassandra database?

I am running mysql server in production side which is currently having 200 GB data. Now it is very difficult to manage mysql server because it is growing exponetially. I have heard a lot about cassandra and I did POC on that. Cassandra provide high availability and eventually consistent data . Cassandra is perfect for our requirement. Now the problem is how to transfer all mysql data to cassandra database.

Since MYSQL is relational database and cassandra is NOSQL. How to map MYSQL table and its relational table to cassandra table.

Upvotes: 2

Views: 4843

Answers (3)

Loic
Loic

Reputation: 1248

I believe you are asking the wrong question. There is no rule for transitionning from a relational model to Cassandra.

The first question is the following: What are your requirements in terms of performance, availability, data volume & growth, and most important of all query abilities? Do you need ACID? Can you change the applicative code accessing the database to fit to a Cassandra more denormalized model?

The answer to these questions will tell you whether Cassandra is compatible with your use case or not.

As a rule of thumb:

  • If you use mysql with a lot of indices and usually perform join during queries the Cassandra data model, then the applicative code to use the database will require a lot of work, or maybe even Cassandra will not be the right choice. Same, if you really need ACID you may have a problem with Cassandra consistency model.
  • If your SQL data model is fully denormalized and your perform queries without joins, then you can just replicate your DB tables schema as Cassandra column families and you're done, even if this may not be optimal.

Your use case is probably in between and you really need to understand how you can model your data in cassandra, you have to get this understanding and perform this analysis by yourself because you know your domain and we don't. However, don't hesitate to give clues about your model and how you need to query your data so you can be advised.

200GB is low for Cassandra and you may discover that your data is taking much less space in Cassandra than in MYSQL, even when widely denormalized because Cassandra is pretty efficient.

Upvotes: 1

piotrwest
piotrwest

Reputation: 2166

Transferring relational data directly to Cassandra isn't possible. You have to denormalize it. However, be warned that some queries and methods of denormalizing those are anti-patterns. Get through those free courses first:

If you fail at Cassandra's data model design of your relational data, you won't get nice features provided by Cassandra. For eample you won't get horizontal scalability (you might have hot-spots in your claster) or high avaiability (it might happen that for some queries all of the nodes will be needed to build response)

Upvotes: 0

Mahendra Singh
Mahendra Singh

Reputation: 28

you can migrate data from mysql to cassandra using spark . spark have connectivity with mysql as well as cassandra . First you have create model in cassandra according your requirement after that you have pull all data from mysql and after done some transformation you can directly push data in cassandra .

Upvotes: 0

Related Questions