Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrate data from relational DB to NoSQL

Is it possible/are there tools/ best practices etc to migrate data to a NoSQL format from a relational DB.

I have a JEE6 app making use of Hibernate ORM to persist to MySQL but now we wish to move to NoSQL solution but need to bring the existing data with us

Thanks W

like image 660
user1843591 Avatar asked Jul 24 '13 11:07

user1843591


People also ask

How do I migrate a relational database to a NoSQL database?

How to Migrate From RDBMS to NoSQL. It's important to define the document schema when migrating from an RDBMS to a NoSQL system. Review your existing application's most frequently run queries. Identify groups of data that are commonly accessed at the same time.

Can you migrate from SQL to NoSQL?

When migrating from SQL to NoSQL, the primary key in the relational table becomes the partition key in the NoSQL table. If the RDBMS table must be joined to additional tables to retrieve the business object, those closely related tables should combine into a single NoSQL table.

Can you store relational data in NoSQL?

NoSQL databases can store relationship data — they just store it differently than relational databases do. In fact, when compared with relational databases, many find modeling relationship data in NoSQL databases to be easier than in relational databases, because related data doesn't have to be split between tables.

How do I transfer data from RDBMS to MongoDB?

Method 3: Another way of migrating from a Relational Database to MongoDB involves parallelly running the existing RDBMS with the new MongoDB Database, incrementally transferring production data. The records are retrieved from RDBMS and are written back to MongoDB in the required document schema by the application.


1 Answers

There are some tools to help the migration, but in the end, MySQL is a relational database which has a completely different structure from noSQL databases.

In the end, you will almost always have to do these four steps stated in this article (refers to mongoDB, and you didn't specify, but it applies to any):

1. Get to know MongoDB. Download it, read the tutorials, try some toy projects.

2. Think about how to represent your model in its document store.

3. Migrate the data from the database to MongoDB, probably simply by writing a bunch of SELECT * FROM statements against the database and then loading the data into your MongoDB model using the language of your choice.

4. Rewrite your application code to query MongoDB through statements such as insert() or find().

like image 141
Filipe Silva Avatar answered Oct 13 '22 00:10

Filipe Silva