Skip to content

Instantly share code, notes, and snippets.

@danf0rth
danf0rth / CHEATSHEET.MD
Last active June 11, 2021 08:11
MariaDB master/slave replication
  • install mariadb-backup package on both servers
  • mariadb-backup --backup --stream | ssh user@slave-host-ip 'cat > xbstream.mb' or xtrabackup --backup --stream=xbstream | ssh root@1.2.3.4 'xbstream -x -C /var/backups/mysql' with xtrabackup
  • mbstream -x xbstream.mb -C /var/backups/mysql
  • mariadb-backup --prepare --target-dir /var/backups/mysql
  • rm -rf /var/lib/mysql/* && cp -r /var/backups/mysql/* /var/lib/mysql/
  • chown -R mysql:mysql /var/lib/mysql
  • service mysql start
  • use your replication user to start replication
@danf0rth
danf0rth / hosts-passwords.txt
Last active September 17, 2021 14:50
Copy public key to multiple servers
1.2.3.4 secret-pass
123.14.144.42 another-pass