Skip to content

Exploration: Using Apace Nifi to migrate millions of data from MSSQL Server to PGSQL Server

Notifications You must be signed in to change notification settings

ChandanGhosh/nifibigdata

Repository files navigation

Docker Build & Publish

  1. Open CMD command line

  2. See what do you run in containers docker container ls

  3. Connect to NiFi bash

docker exec -it --user root [containerId] /bin/bash

(you have to replace [containerId] with your container from NiFi)

  1. Create folder structure

/usr/lib/jvm/jre/lib/jdbc/

cd /usr/lib/jvm && mkdir jre && cd jre && mkdir lib && cd lib && mkdir jdbc && cd jdbc

  1. Download MS SQL server driver (remove spaces after https:// below )

wget https://download.microsoft.com/download/3/F/7/3F74A9B9-C5F0-43EA-A721-07DA590FD186/sqljdbc_6.2.2.0_enu.tar.gz

  1. Unpack driver

tar xvzf sqljdbc_6.2.2.0_enu.tar.gz

  1. See file location for mssql-jdbc-6.2.2.jre8.jar

ls

  1. Remember path

/usr/lib/jvm/jre/lib/jdbc/sqljdbc_6.2/enu/mssql-jdbc-6.2.2.jre8.jar

  1. Restart container

docker container ls -a

docker container stop [containerId]

docker container start [containerId]

you have to wait around 3 minutes, it takes some time to start that container

  1. Open Nifi

http://localhost:7882/nifi/

  1. Configure new Controlled service:

DBCPConnectionPool (right click on Canvas and choose Configure)

  1. Set up your DB name

  2. Configure properties Database Connection URL - [your database connection]

MSSQL -- jdbc:sqlserver://mssql:1433;databaseName=BikeStores

Postgresql -- jdbc:postgresql://postgresql:5432/BikeStores

Database Driver Class Name

(MSSQL) -- com.microsoft.sqlserver.jdbc.SQLServerDriver

(POSTGRESQL) -- org.postgresql.Driver

Database User(MSSQL) - sa / YourBigLongPassword!123 (POSTGRESQL) - postgres / postgrespassword

Database Driver Location(s)

file:///usr/lib/jvm/jre/lib/jdbc/sqljdbc_6.2/enu/mssql-jdbc-6.2.2.jre8.jar

file:///lib/jdbc/mssql-jdbc-8.2.0.jre8.jar

file:///lib/jdbc/postgresql-42.2.10.jar

  1. Enable configuration and make sure that this is enabled Do not start next step until it says that this is enabled

  2. Add new processor ExecuteSQL

  3. Configure processor with - your SQL server & SQL query

  4. Set up scheduling to 600 seconds (if you wouldn't do it that query would be contantly running)

  5. Disable success & failure

  6. Run it

  7. Observe results - right click on the processor / View data provenance

About

Exploration: Using Apace Nifi to migrate millions of data from MSSQL Server to PGSQL Server

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published