简体   繁体   中英

Moving of large MySQL database from limited resource server

I have a Windows Server with MySQL Database Server installed. Multiple databases exist among them, database A contains a huge table named 'tlog', size about 220gb.

I would like to move over database A to another server for backup purposes.

I know I can do SQL Dump or use MySQL Workbench/SQLyog to do table copy.

  • But due to limited disk storage in server (less than 50gb) SQL Dump is not possible.

  • The server is serving other works so basically the CPU & RAM is limited too. As a result, copy table without used up CPU & RAM is not possible.

Is there any other method that can do the moving of the huge database A over to another server please?

Thanks in advance.

You have a few ways:

Method 1

Dump and compress at the same time: mysqldump ... | gzip > blah.sql.gz mysqldump ... | gzip > blah.sql.gz

This method is good because chances are your database will be less than 50GB; as the database dump should be in ASCII; you're then compressing it on the fly.

Method 2

You can use slave replication; this method will require a dump of the data.

Method 3

You can also use xtrabackup .

Method 4

You can shutdown the database, and rsync the data directory.

Note: You don't actually have to shutdown the database; you can however do multiple rsync s; and eventually nothing will change (unlikely if the database is busy; have to do during slow time); which means the database would have sync'd over.

I've had to do this method with fairly large PostgreSQL databases (1TB+). It takes a few rsync s: but, hey; it's the cost of 0 down time.

Method 5

If you're in a virtual environment you could:

  • Clone the disk image.
  • If you're in AWS you could create an AMI.
  • You could add another disk and just sync locally; then detach the disk, and re-attach to the new VM.

If you're worried about consuming resources during the dump or transfer you can use ionice and renice to limit the priority of the dump/transfer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM