Saturday, 25 January 2014

Importing Big mysqldump + Progress Bar

I have been facing hard time to import a big dump file (27 GB in size to be exact). It could take hours to load data in so it could be worth to watch the progress of this import. Fortunately, Linux has always had a convenient way to do this. I just need to install pv,  which can monitor the progress of piping data.



Enough with talking, let’s start installing!



CentOS 6.4 box, so it requires me to install EPEL repo at the first place:




$ rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


Install pv using yum:




$ yum install -y pv


Installation done. Let the importing begin!




$ pv /home/user/my_big_dump.sql | mysql -uroot -p
928MB 0:07:41 [ 2.3MB/s] [==>                                                      ]  4% ETA 2:35:52


So now I can sit back and relax while watching up the import progress. If no error occurred, the import could finish within two and a half hours. Cheers!

No comments:

Post a Comment