Configuring MySQL on the source filesystem is a case of creating
the data on the filesystem that you will be replicating. The
configuration file in the example below has been updated to use
/opt/mysql-data as the data directory, and now
I can initialize the tables:
root-shell> mysql_install_db --defaults-file=/etc/mysql/5.0/my.cnf --user=mysql
To synchronize the initial information, perform a new snapshot and
then send an incremental snapshot to the slave using
root-shell> zfs snapshot opt@snap2 root-shell> zfs send -i opt@snap1 opt@snap2|ssh email@example.com pfexec zfs recv slavepool
Double check that the slave has the data by looking at the MySQL
data directory on the
root-shell> ls -al /slavepool/mysql-data/
Now we can start up MySQL, create some data, and then replicate
the changes using
recv to the slave to synchronize the changes.
The rate at which you perform the synchronization is dependent on your application and environment. The limitation is the speed required to perform the snapshot and then to send the changes over the network.
To automate the process, you should create a script that performs
the snapshot, send, and receive operation, and then use
cron to synchronize the changes at set times or
intervals. For automated operations, see
Foster's zfs replication tool.