项目作者: icecreamsandwich

项目描述 :
Mysql database to mongo schema mapper
高级语言: TypeScript
项目地址: git://github.com/icecreamsandwich/mysql-mongo-mapper.git
创建时间: 2019-03-13T14:07:20Z
项目社区:https://github.com/icecreamsandwich/mysql-mongo-mapper

开源协议:MIT License

下载


MySQL to MongoDB data migration tool

A Node.js script to migrate MySQL data to MongoDB, mapping MySQL tables to MongoDB collections.

Will allow migrations from and to remote sites.

mysql-to-mongo

Migrate your existing MySQL data into MongoDB

Open terminal in your working directory and …..

Method I

  1. Clone project

    git clone https://github.com/dannysofftie/mysql-mongo-migrate.git

  2. Install dependencies

    npm install

  3. Make it happen :wink:

    npm run migrate

Method II

  1. Install package globally

    npm i -g mysql-mongo-migrate

  2. Run command

    \$> mysql-mongo-migrate


Issues might occur if you don’t have authentication set up in your MongoDB database, as read and write roles are required when inserting bulk data into MongoDB.

Follow below steps to enable authentication in your server:

This set up is for Linux distros only. Check online for your operating system if not a linux distro.

  • Uncomment the following code block at the bottom of /etc/mongo.conf

    1. $> sudo vi /etc/mongo.conf
    2. # security:
    3. # authorization: enabled
  • Login to your server and create a user for your database.

    1. $> mongo
    2. > use databaseName
    3. > db.createUser({user: "username", pwd: "password", role: [{roles: "readWrite", db: "databaseName"}]})

    Replace with your preferred credentials. You will use them to do migration in the other steps

  • Exit the mongo shell and restart mongod service.

    1. $> sudo service restart mongo

    You should be ready to migrate your data now.

Roadmap

  • Retrieve MySQL database models and data
  • Generate Mongoose schemas in Typescript
  • Dump MySQL data into MongoDB