Mysql – seed Percona XtraDB cluster from the existing backup

clusteringfailoverMySQLpercona-server

I have a running setup of Percona MySQL 5.7. I would like to try out Percona XtraDB cluster. The current data size is ~500GB. From what I've observed (seen in a couple of YouTube videos: https://www.youtube.com/watch?v=uUVdte3wB3I ), I reckon that the cluster members do the initial sync from the currently serving master.
However, in my case, syncing 500 GB of data would take ages, which I can't afford.
On the other hand, I have a backup of the current data, taken using percona-innobackupex. Can I use this backup to seed the cluster members (like I would feed the slave while doing master-slave replication) so that the initial sync takes less time?

Best Answer

Yes you can.

  1. For do this first start XtraDB Cluster on current server.
  2. Then create an incremental backup from current full backup with --galera-info switch.(It's very important to use --galera-info)
  3. Install Percona server in second server
  4. Prepare the backup files (both backups.Full and Incremental) on second server
  5. Open xtrabackup_galera_info file in your full backup directory and copy uuid and seqno (for example e0d744f3-c88a-11e6-ad0d-6ed1e3c29e6d:0)
  6. create grastate.dat file in full backup directory and add the following lines

    version: 2.1

    uuid: e0d744f3-c88a-11e6-ad0d-6ed1e3c29e6d

    seqno: 0

    cert_index:

  7. Back up is ready to be copied over to the MySQL data directory.

  8. Stop mysql service

  9. Delete all contents in /var/lib/mysql

  10. copy-back prepare backup

    innobackupex --copy-back /restore/full

  11. chown mysql directory to mysql.mysql

  12. Config galera variables in my.cnf

  13. Start mysql

You can find more information in this topic:

http://severalnines.com/blog/how-avoid-sst-when-adding-new-node-galera-cluster