Due to advancements in Big Data, several organizations are now looking for newer database technologies that can handle the current requirements and approaches. The most prominent of them all is migrating from MySQL to MongoDB.
MongoDB is the world’s most popular database specifically developed to address Big Data requirements and take advantage of cloud computing. In this post, learn how to migrate from MySQL to MongoDB using Mongify tool without much effort.
What is Mongify tool?
Mongify is a utility tool which is based on ruby language. Mongify is used for migrating databases from MySQL to MongoDB. Mongify supports data migration from MySQL, SQLite and other related databases.
MySQL to MongoDB migration Steps:
Since Mongify utility tool is based on ruby language, it is necessary to install ruby on your system. If your system has already ruby installed in it then you can skip this step. Use the command apt-get install ruby to install ruby language.
Install gem Package
After the above step, install the ‘gem’ package which is basically a ruby gem manager. We will use the below command to achieve this: Use the command apt-get install gem to install the ‘gem’ package.
Install Other Prerequisites
After the installation of ruby and gem packages, few more prerequisite packages are required to install and run Mongify utility. The prerequisite packages are:>
Apart from these prerequisite packages, there are a few more ‘gems’ needed as run time dependencies. These include
Install the Mongify gem
After the above step, install the ‘Mongify’ gem using the command sudo gem install Mongify to install the Mongify utility.
Create a database.config file
After completing all the above steps, a database configuration file needs to be created. This file will contain all the details and credentials for MySQL database and the MongoDB.
Recheck the Database Configuration
Once the database.config file is created, it needs to be rechecked for accuracy. Use the command mongify check database.config to recheck the configuration file
Create a Database Translation File
After confirming the accuracy of the configuration file, create a database translation file by using the command mongify translation database.config >> translation.rb
Process the Database Translation File
To process the database translation file and to create a new database in MongoDB, use the command mongify process database.config translation.rb
Confirm the Migration
After completing all the above steps, the database should be migrated from MySQL to MongoDB. The migration can be confirmed within the mongo shell by running below command: $ mongo >> db.stats()
MongoDB is the only database which combines the best features of associated databases along with NoSQL. MongoDB has been downloaded over 15 million times and it has a strong developer community, you can rely on it without any hesitation.