nmig/README.md

103 lines
4.9 KiB
Markdown
Raw Permalink Normal View History

2016-01-25 15:39:57 +02:00
<h3>NMIG - the database migration tool.</h3>
<h3>WHAT IS IT ALL ABOUT?</h3>
<p>NMIG is an app, intended to make a process of migration
from MySQL to PostgreSQL as easy and smooth as possible.</p>
<h3>KEY FEATURES</h3>
<ul>
<li> Precise migration of the database structure - NMIG converts
2016-01-25 15:39:57 +02:00
MySQL data types to corresponding PostgreSQL data types, creates constraints,
2016-01-25 15:42:39 +02:00
indexes, primary and foreign keys exactly as they were before migration.</li>
2016-01-25 15:39:57 +02:00
2017-01-23 00:32:10 +02:00
<li>Ability to rename tables and columns during migration.</li>
2017-01-23 00:26:04 +02:00
<li>Ability to recover migration process if disaster took place (without restarting from the beginning).</li>
<li>Ability to migrate big databases - in order to eliminate "process out of memory" issues NMIG will split each table's data into several chunks.<br>Each group of chunks will be loaded via separate worker process.</li>
2016-01-25 15:39:57 +02:00
2016-03-24 07:21:19 +02:00
<li> Speed of data transfer - in order to migrate data fast NMIG uses PostgreSQL COPY protocol.</li>
2016-01-25 15:39:57 +02:00
<li>Ease of monitoring - NMIG will provide detailed output about every step, it takes during the execution.</li>
<li>
Ease of configuration - all the parameters required for migration should be put in one single JSON document.
</li>
</ul>
<h3>SYSTEM REQUIREMENTS</h3>
<ul>
2017-12-30 20:24:55 +02:00
<li> <b>Node.js 8 or higher</b></li>
2016-01-25 15:39:57 +02:00
</ul>
<h3>USAGE</h3>
2018-09-19 17:06:06 +03:00
<p><b>1.</b> Create a new PostgreSQL database.<br />
2017-07-03 02:34:06 +03:00
<b>Sample:</b>&nbsp;<code> CREATE DATABASE my_postgresql_database;</code><br />
If you are planning to migrate spatial data (geometry type columns), then <b>PostGIS</b> should be installed and enabled.
</p>
2016-01-25 15:39:57 +02:00
2018-02-13 21:08:33 +02:00
<p><b>2.</b> Download Nmig package and put it on the machine running your PostgreSQL (not mandatory, but preferably).<br />
2016-02-25 19:39:10 +02:00
<b>Sample:</b>&nbsp;<code>/path/to/nmig</code></p>
<p><b>3.</b> Edit configuration file located at <code>/path/to/nmig/config/config.json</code> with correct details.<br /></p>
<b>Notes:</b>
2016-02-25 19:39:10 +02:00
<ul>
<li> config.json contains brief description of each configuration parameter</li>
2016-03-05 19:23:44 +02:00
<li>Make sure, that username, you use in your PostgreSQL connection details, defined as superuser (usually "postgres")<br> More info: <a href="http://www.postgresql.org/docs/current/static/app-createuser.html">http://www.postgresql.org/docs/current/static/app-createuser.html</a></li>
2016-02-25 19:39:10 +02:00
</ul>
2016-01-25 15:39:57 +02:00
2018-10-07 00:05:55 +03:00
<p><b>4.</b> Go to Nmig directory, install dependencies, compile and run the app<br />
2016-01-30 20:57:05 +02:00
&nbsp;&nbsp;&nbsp;&nbsp;<b>Sample:</b><br />
<pre>$ cd /path/to/nmig</pre><br />
2016-02-13 20:00:32 +02:00
<pre>$ npm install</pre><br />
2018-10-07 00:05:55 +03:00
<pre>$ npm run build</pre><br />
2017-05-20 14:16:19 +03:00
<pre>$ npm start</pre><br />
2016-03-05 19:23:44 +02:00
</p>
<p><b>5.</b> If a disaster took place during migration (for what ever reason) - simply restart the process
2017-05-20 14:16:19 +03:00
<code>$ npm start</code><br>&nbsp;&nbsp;&nbsp;&nbsp;NMIG will restart from the point it was stopped at.
2016-03-05 19:23:44 +02:00
</p>
2016-01-25 15:39:57 +02:00
<p><b>6.</b> At the end of migration check log files, if necessary.<br />&nbsp;&nbsp;&nbsp;
2016-01-25 15:39:57 +02:00
Log files will be located under "logs_directory" folder in the root of the package.<br />&nbsp;&nbsp;&nbsp;
<b>Note:</b> "logs_directory" will be created during script execution.</p>
<p><b>7.</b> In case of any remarks, misunderstandings or errors during migration,<br /> &nbsp;&nbsp;&nbsp;
2016-01-25 15:39:57 +02:00
please feel free to email me
2016-01-25 15:50:48 +02:00
<a href="mailto:anatolyuss@gmail.com?subject=NMIG">anatolyuss@gmail.com</a></p>
2016-01-25 15:39:57 +02:00
2018-02-13 21:08:33 +02:00
<h3>RUNNING TESTS</h3>
<p><b>1.</b> Create a new PostgreSQL database.<br />
<b>Sample:</b>&nbsp;<code> CREATE DATABASE nmig_test_db;</code><br />
</p>
2018-09-19 17:06:06 +03:00
<p><b>2.</b> Download Nmig package.<br/ ><b>Sample:</b>&nbsp;<code>/path/to/nmig</code></p>
<p><b>3.</b> Edit configuration file located at <code>/path/to/nmig/config/test_config.json</code> with correct details.<br /></p>
2018-02-13 21:08:33 +02:00
<b>Notes:</b>
<ul>
<li> test_config.json contains brief description of each configuration parameter</li>
<li>Make sure, that username, you use in your PostgreSQL connection details, defined as superuser (usually "postgres")<br>
More info:
<a href="http://www.postgresql.org/docs/current/static/app-createuser.html">http://www.postgresql.org/docs/current/static/app-createuser.html</a>
</li>
</ul>
2018-10-07 00:05:55 +03:00
<p><b>4.</b> Go to nmig directory, install dependencies, compile and run tests<br />
2018-02-13 21:08:33 +02:00
&nbsp;&nbsp;&nbsp;&nbsp;<b>Sample:</b><br />
<pre>$ cd /path/to/nmig</pre><br />
<pre>$ npm install</pre><br />
2018-10-07 00:05:55 +03:00
<pre>$ npm run build</pre><br />
2018-02-13 21:08:33 +02:00
<pre>$ npm test</pre><br />
</p>
<p><b>5.</b> At the end of migration check log files, if necessary.<br />&nbsp;&nbsp;&nbsp;
Log files will be located under "logs_directory" folder in the root of the package.<br />&nbsp;&nbsp;&nbsp;
<b>Note:</b> "logs_directory" will be created during script execution.</p>
2016-01-25 15:39:57 +02:00
<h3>VERSION</h3>
<p>Current version is 4.0.0<br />
2016-01-25 15:39:57 +02:00
(major version . improvements . bug fixes)</p>
<h3>KNOWN ISSUES</h3>
<ul>
<li>Empty strings in char/varchar columns may be interpreted as NULL.</li>
</ul>
<h3>LICENSE</h3>
<p>NMIG is available under "GNU GENERAL PUBLIC LICENSE" (v. 3) <br />
<a href="http://www.gnu.org/licenses/gpl.txt">http://www.gnu.org/licenses/gpl.txt.</a></p>