How to export data from Cassandra to mongodb?

1.8k views Asked by At

I am using Apache (Kafka-Storm-Cassandra) for real time processing.The problem I am facing is that I can't use aggregation queries on Cassandra directly(Datastax can be used but it is a paid service).Moreover, I also considered using mongodb but It is not good for more and frequent writes. So, I am thinking to do all my calculation in storm and store it into Cassandra and move it on hourly basis or so to mongodb to perform my further analytics.

Is this the right approach or are there any better options to achieve this ?

Also, How can I export data directly from Cassandra to mongodb prefebly using JAVA?

Thanks In Advance !!

1

There are 1 answers

7
Nachiket Kate On BEST ANSWER

Without knowing your full requirement, amount of inserts/updates one cannot predict is it a good or bad approach. Mongo is less preferable for heavy writes but it can support quite a good no. of inserts. So important thing is how many writes you have per unit time and based on that you can take the decision.

I have seen Mongo taking upto 1000-2000 writes per sec with avg of 4-5ms on server class machines. Of course Cassandra beats it by margin but if you need to perform any aggregation then Mongo has better framework and capabilities.

For export and import, flat csv can be used. Cassandra can export data to csv and MongoDB can import data from csv with export/import options.

Check MongoImport and for exporting from cassandra, example could be,

copy employee (emp_id, dept, designation, emp_name, salary)
 to 'employee.csv';