Move Maria DB from one server to other other server with LVM snapshot
Hi Experts, I would like to move MariaDB from server x to server Y with same OS and patches. Since I'm not expert so would like to know what are all methods available to midrate the MariaDB with LVM snapshots for both online and offline migrations.
Thanks in advance.
Thanks Manohar
Answer Answered by Daniel Black in this comment.
LVM is a suitable tool because it uses consistent snapshot and as such won't corrupt the data directory (like rsync/cp will).
Having LVM snapshot there can create a little more IO work for the OS/MariaDB so recommend testing a few time and observing the impact to see if its within acceptable parameters.
If your second server Y intends to server as a replica, you may need to FLUSH TABLES WITH READ LOCK, observe binlog positions, LVM snapshot, release FLUSH TABLES lock. The binlog position will be needed to create the replica.
When the server Y starts up, there will be an element of crash recovery that will rollback transactions and apply completed transactions to the table space. This is ok and expected.
SET GLOBAL innodb_max_purge_lag_wait=0, if supported on your MariaDB version (see MDEV-16952), a little time before the snapshot will reduce the apply completed transactions step and can be set back to default after the snapshot.