Hi all;

I'm currently working on a small "cookbook" to showcase the backup and restore capabilities of ZFS using snapshots. I chose to backup the data directory of a MySQL 5.1 server for the example purpose, using several backup/restore scenarios. The most simple is to simple snapshot the file system where the data directory resides, and use a "zfs rollback" to come back to a previous state.

But a better scenario would be to backup the data on a remote server. I thus have two servers, both running OpenSolaris 2009.06 (ZFS version 14). One running the MySQL server (Server A) and the second for the remote backup (Server B).

1) Do the snapshots:

[Server A] # zfs snapshot -r rpool/mysql-d...@mysql-snap1
[Server A] # zfs snapshot -r rpool/mysql-d...@mysql-snap2
   ...
[Server A] # zfs snapshot -r rpool/mysql-d...@mysql-snap4

Between each snapshot I have changed the contend of my database (drop tables, creante new ones, update or delete rows etc.)

2) Send the snapshots on the remote server:

[Server A] # zfs send -R rpool/mysql-d...@mysql-snap1 | ssh -l mysql ServerB /usr/sbin/zfs receive -du npool
This will send the full data stream for the first time.

Here is my first question. Concerning the incremental sends are the two following solutions equivalent or is there a nuance I missed between -i and -I ?

[Server A] # zfs send -R*I *mysql-snap1 rpool/mysql-d...@mysql-snap4 | ssh -l mysql ServerB /usr/sbin/zfs receive -du npool or

[ServerA] # zfs send -R*i* mysql-snap1 rpool/mysql-d...@mysql-snap2 | ssh -l mysql ServerB /usr/sbin/zfs receive -du npool [ServerA] # zfs send -R*i* mysql-snap2 rpool/mysql-d...@mysql-snap3 | ssh -l mysql ServerB /usr/sbin/zfs receive -du npool [ServerA] # zfs send -R*i* mysql-snap3 rpool/mysql-d...@mysql-snap4 | ssh -l mysql ServerB /usr/sbin/zfs receive -du npool

3) Restore from the remote server

But here is my main question: I can obviously restore my database data directory from the remote server:

[ServerB] # zfs send -R npool/mysql-d...@mysql-snap4 | ssh -l mysql ServerA /usr/sbin/zfs receive -d rpool

However this only works if I recreate from scratch my data directory. I must either destroy the entire file system on ServerA or rename it before the restore. The problem is that I need to resend the entire dataset over the network to do this full restore. It's ok for small databases but I'm more thinking of the real life with multi gigabyte databases.

Is there a way to do simple an incremental receive, the same way we did an incremental send ?
Let me give a precise scenario:

Imagine I have destroyed on my pool/mysql-d...@mysql-snap4 ServerA, and a user deleted a table by mistake on the DB. I wuold like to go back to the state of snap4. Since the snapshot is not on ServerA I can not just do a rollback. However the snapshot still is on ServerB. I would just want to restore snap4, but it looks as if this is impossible. ZFS asks me te first destroy (or rename) the existing file system on server A. So the restore will be a complete restore not incremental.

Can you please let me know If I got something wrong ? Is it possible to do what I want to do with ZFS ?


Regards
Amir
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to