wiki:SQLCloning

Version 1 (modified by quentin, 11 years ago) (diff)

--

To create a clone of a SQL server from scratch (~pseudocode):

  • iptables -A INPUT -p tcp --dport mysql -j REJECT
  • Wait for connections to die down
  • mysql -e "show master status" and save the output
  • mysqladmin shutdown
  • umount /path/to/mysqldata
  • sync
  • lvcreate -s -L 10G -n snapshot /dev/vg/mysqldata
  • mount /path/to/mysqldata
  • /etc/init.d/mysql restart
  • Copy from /dev/vg/mysqldata at your leisure