In the present scenario due to the influence, Bigdata people started to move on from RDBMS to NoSQL for a better excellence. So its necessary to have a database that is good enough in performance and handling the big data. MongoDB a document-oriented database would fit into it which has high availability and scaling. In this post, we are going to see how to migrate all the data from a MySQL instance to MongoDB instance. It can be performed without downtime and the data loss. The tool used to perform the migration task is the Mongify.
Mongify tool was developed by Andrew Kalek from Anlek Consulting. This tool helps for migrating data from MySQL to mongodb.No need to worry about the IDs or foreign IDs.Allows embedding data into documents, including polymorphic associations. The problem is it can't do anything to an embedded table. Some packages are to be necessary before installing mongify in Linux so install them as below:
To install mongify issue the below command:yum install gemgem install bundlerbundle installgem install json_pure
Setup:gem install mongify
To perform the migration task it needs some requirements in the system:
- There must be MySQL client running as rpm in because the tool listens only for the rpm connection
- Also, have a binary or rpm instance of mongodb running in the machine
- Make sure that both mysql & MongoDB servers are running
It involves mainly a two files database.config and ruby file translation.rb
- The database.config file contains the credentials of the mysql such as host,username,password,database and for mongodb credentials like host,database
- The translation.rb is a ruby file that should contain the details of mysql tables and column values with the proper datatype mentioned
It is used to connect the both mysql and mongodb instances & checks whether connection works.It checks the configuration file database.config whether the database credentials present are correct.Once the connection is established it throws a message “SQL connection works NoSQL connection works”.This command can be performed as below:
Mongify Translation:mongify check database.config
The is a ruby file used to translate SQL data before saving it into MongoDB.In order for Mongify to know with the data provide a translation file(translation.rb).It contains the tables and column values with the datatypes defined.This command can be performed as below:
Mongify Process:mongify translation database.config > translation.rb
Once the translation file is setup, it tells mongify to move the data by issuing the process command. This command initiates the migration process from the MySQL to MongoDB . This command can be performed as below:
mongify process database.config translation.rb
Its very simple to migrate the data to MongoDB from MySQL.Have a great time guys meet you in another good post.
0 comments:
Post a Comment