Skip to content

mgmigrate is a tool for migrating data from MySQL or PostgreSQL to Memgraph and between Memgraph instances.

License

Notifications You must be signed in to change notification settings

memgraph/mgmigrate

Repository files navigation

mgmigrate

license build build

Follow @memgraphdb

Notice:

The project has been archived. It's based on some really interesting research papers, however unfortunately the code has not kept up with changes so we've decided to archive it. We might revisit this research and resurrect this project in the future. If you would like to contribute, have feedback or suggestions please visit our Discord server

Welcome to the mgmigrate tool repository. This tool can help you migrate data from a PostgreSQL or MySQL database to Memgraph. It can also be used to migrate data between Memgraph instances.

⚙️ Installation guide

You can install mgmigrate on the following systems:

Linux

To install compile dependencies on Debian / Ubuntu run:

apt-get install -y git cmake make gcc g++ python3 libpq-dev postgresql-server-dev-all
pip3 install pymgclient psycopg2 mysql-connector-python

On RedHat / CentOS / Fedora run:

yum install -y git cmake make gcc gcc-c++ python3 libpqxx-devel
pip3 install pymgclient psycopg2 mysql-connector-python

Once all the requirements are in place, create a build directory inside the source directory and configure the build by running CMake from it as follows:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..

Continue with the Building and installing step.

Windows

Before you can install mgmigrate on Windows, you will need to install the needed dependencies. On Windows, you need to install the MSYS2. Just follow the instructions, up to step 6. In addition, OpenSSL must be installed. You can easily install it with an installer. The Win64 version is required, although the "Light" version is enough. Both EXE and MSI variants should work. Then, you'll need to install the dependencies using the MSYS2 MINGW64 terminal, which should be available from your Start menu. Just run the following command inside the MSYS2 MINGW64 terminal:

pacman -Syu --needed base-devel git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-openssl mingw-w64-x86_64-postgresql

Once all the requirements are in place, create a build directory inside the source directory and configure the build by running CMake from it as follows:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=. ..

Continue with the Building and installing step.

macOS

On macOS, first, make sure you have XCode and Homebrew installed. Then, in the terminal, run:

brew install git cmake make openssl postgresql

Once all the requirements are in place, create a build directory inside the source directory and configure the build by running CMake from it as follows:

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR="$(ls -rd -- /usr/local/Cellar/openssl@1.1/* | head -n 1)" -DCMAKE_INSTALL_PREFIX=. ..

Continue with the Building and installing step.

Building and installing

After running CMake, you should see a Makefile in the build directory. Then you can build the project by running:

make

Once all the requirements are in place, run:

make install

This will install mgmigrate in the default system installation directory. If you want to change this location, use -DCMAKE_INSTALL_PREFIX option when running CMake.

📋 Usage

MySQL

This is an example of using mgmigrate with a MySQL database:

build/src/mgmigrate --source-kind=mysql /
  --source-host 127.0.0.1 /
  --source-port 33060 /
  --source-username root /
  --source-password mysql /
  --source-database=exampledatabase /
  --destination-host 127.0.0.1 /
  --destination-port 7687 /
  --destination-use-ssl=false

PostgreSQL

Here is an example of how to use the mgmigrate tool with PostgreSQL:

build/src/mgmigrate --source-kind=postgresql /
  --source-host 127.0.0.1 /
  --source-port 5432 /
  --source-username postgres /
  --source-password postgres /
  --source-database=exampledatabase /
  --destination-host 127.0.0.1 /
  --destination-port 7687 /
  --destination-use-ssl=false

🔎 Arguments

The available arguments are:

Parameter Description Default
--source-kind The kind of the given server. Supported options are: memgraph , mysql and postgresql. memgraph
--source-host Server address of the source database. 127.0.0.1
--source-port Server port of the source database. 0
--source-username Username for the source database. -
--source-password Password for the source database. -
--source-database Database name. Applicable to PostgreSQL and MySQL source. -
--destination-use-ssl Should the connection to the source database (if Memgraph) use SSL. false
--destination-host Server address of the destination database. 127.0.0.1
--destination-port Server port number of the destination database. 7687
--destination-username Username for the destination database. -
--destination-password Password for the destination database. -
--destination-use-ssl Should the connection to the destination database (if Memgraph) use SSL. false

About

mgmigrate is a tool for migrating data from MySQL or PostgreSQL to Memgraph and between Memgraph instances.

Topics

Resources

License

Stars

Watchers

Forks

Languages