Skip to content

Instantly share code, notes, and snippets.

@meteozond meteozond/
Last active Jan 1, 2016

What would you like to do?
Create mysql replication
#! /bin/bash
# Usage <db root password> <remote host_name>
# Just run on future slave machine:
# cd /var/lib/mysql/; nc -l -p 8888 | pigz -d | tar xvf - -C .; chown -R mysql:mysql .
mkdir -p $backup
path="$backup/`date "+%Y-%m-%d-%H-%M"`/";
time innobackupex --user=root --password=$1 --parallel=64 --slave-info --no-timestamp $path;
time innobackupex --use-memory=4g --apply-log $path;
cd $path;
time tar -c . | pv --size `du -csb . | grep total | cut -f1` | pigz | nc $2 8888;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.