https://github.com/memgraph/mgmigrate
mgmigrate is a tool for migrating data from MySQL or PostgreSQL to Memgraph and between Memgraph instances.
https://github.com/memgraph/mgmigrate
cypher memgraph migration migration-tool mysql postgresql
Last synced: 7 months ago
JSON representation
mgmigrate is a tool for migrating data from MySQL or PostgreSQL to Memgraph and between Memgraph instances.
- Host: GitHub
- URL: https://github.com/memgraph/mgmigrate
- Owner: memgraph
- License: gpl-3.0
- Created: 2020-09-26T15:02:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-10T12:07:25.000Z (over 2 years ago)
- Last Synced: 2023-08-10T16:37:30.504Z (over 2 years ago)
- Topics: cypher, memgraph, migration, migration-tool, mysql, postgresql
- Language: Cypher
- Homepage: https://github.com/memgraph/mgmigrate
- Size: 5.62 MB
- Stars: 20
- Watchers: 6
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mgmigrate
## 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](https://www.discord.gg/memgraph)**
Welcome to the **mgmigrate** tool repository. This tool can help you migrate
data from a
[PostgreSQL](https://memgraph.com/docs/memgraph/import-data/migrate/postgresql)
or [MySQL](https://memgraph.com/docs/memgraph/import-data/migrate/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 instructions](#linux)
* [Windows instructions](#windows)
* [macOS instructions](#macos)
### 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:
```console
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..
```
Continue with the [Building and installing](#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](https://www.msys2.org), up to step 6. In addition, OpenSSL must
be installed. You can easily install it with an
[installer](https://slproweb.com/products/Win32OpenSSL.html). 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:
```console
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:
```console
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=. ..
```
Continue with the [Building and installing](#building-and-installing) step.
### macOS
On **macOS**, first, make sure you have
[XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh)
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:
```console
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](#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:
```console
make
```
Once all the requirements are in place, run:
```console
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:
```console
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:
```console
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