Migrate an .sql file to MongoDB?

-1

I want to import a database from a file .sql to MongoDB, the problem is that it weighs 1.7GB. I was researching and found that I can import a database to mongodb as file .json , but the pages to convert to .json do not support the file.

There is some way to import the BD or to convert my file .sql .

    
asked by José T. 24.05.2018 в 23:58
source

1 answer

1

I was able to import the MySQL Database to MongoDB, using: - Robbery 3T - Pentaho Data Integration - MySQL Workbench

I'm using Ubuntu 18.04 LTS.

  • 3T Theft

    • Download from: link
    • Extract and run / robomongo / bin / robo3t
    • Create a new connection to mongodb (MongoDB should already be running by default on localhost: 27017)
  • Pentaho Data Integration

    • Download and extract: link
    • This guide is essential for Pentaho to work: link (In Install Pentaho Kettle 4.3.0 step number 3, add: cat ~ / .bashrc)
    • When extracting the file, it shows a data-integration folder.
    • Download jar file to connect MySQL: link
    • Place the .jar file in / data-integration / lib (This helps us connect mysql to Pentaho.
    • In the terminal write:

    /data-integration/spoon.sh

  • Automatically starts the Spoon program.

  • Import from MySQL the .sql file Open workbench and user Create a new schema for the database. Go to: File > Open Sql script > select mibasededatos.sql Select the previously created schema and execute.

  • Create connection in Spoon to Mysql -Go to the Spoon program > View

    • Right click on Database connections.
    • Select Connection type: MySQL Access: Native (JDBC) Connection name: my connection Host: localhost Database name: / Mysql's DB name / Username and password: / Mysql credentials /

    • Select the test button to see if the Database has been connected.

    • In the Design tab> Input
    • Select the way you want to import the information and drag to the right panel.
    • Double click on input to enter the data query you want.
    • On the same tab go to Big Data > MongoDB Output and drag to the panel.
    • Mapping the input to MongoDB.
    • In MongoDB Output select Output options > select the MongoDB Database and Collection.
    • Select Run, save the transfer and execute.
  • And the data is stored successfully in MongoDB.

        
    answered by 26.05.2018 в 00:53