Snapshot Plugin

From The Open Source Backup Wiki (Amanda, MySQL Backup, BackupPC)
Jump to navigationJump to search

Snapshot plugin allows administrators to use filesystem or volume manager or disk snapshot mechanism to create consistent snapshots of MySQL database.

Configured snapshot plugin is used during MySQL backup process. A consistent view of the database(s) are created using the plugin and MySQL database backup is performed from the snapshot.

Plugin Interface

Any snapshot plugin should implement the following actions:

  • get-vm-device-details
  • create-snapshot
  • mount
  • umount
  • remove-snapshot

get-vm-device-details

The action get-vm-device-details is used by ZRM to find out details of the logical volume the given directory is residing on. If the plugin does not output any data, it assumes that the given directory does not reside on a logical volume. The data that it expects from the plugin are

  1. The device path that the filesytem resides on
  2. The device path that would be created when the snapshot is created (The snapshot name is passed to the plugin by ZRM)
  3. The mount point that the volume is mounted on
  4. The type of filesystem that the volume contains

get-vm-device-details action takes two input parameters:

--directory <path>
directory specifies the name of the directory that is on the logical volume
--sname <name of snapshot>
sname specifies the identifier that ZRM will use for this particular snapshot.

If the given directory is not on a logical volume, no output should be generated.

The output is expected in STDOUT and should have following 4 lines:

device=<device path>
snapshot-device=<snapshot device path>
device-mount-point=<where the device is mounted>
filesystem-type=<type of filesystem created on the device>

For example: the output should look like

device=/dev/system/mysql_volume
snapshot-device=/dev/system/zrm_snapshot
device-mount-point=/var/lib/mysql
filesystem-type=xfs

create-snapshot

The action create-snapshot is used by ZRM to actually create the snapshot. No output is expected. There are three input parameters:

--dev <device>
Defines the device for which snapshot is to be created.
--size <size of snapshot>
Defines the size of the snapshot volume to be created.
--sname <name of snapshot>
The name of the snapshot to be created.

If there is an error in creating of the snapshot call printAndDie() with appropriate error message.

mount

The action mount is used by ZRM to mount the snapshot on a given directory. There are three input parameters:

--dev <device>
The device to be mounted.
--directory <mount point>
The directory on which the device should be mounted.
--fstype <type>
Type of filesystem on the volume.

If there is an error in creating of the snapshot call printAndDie() with appropriate error message.

umount

The action umount is used by ZRM to unmount the snapshot. There is one input parameter:

--directory <path>
The directory to be unmounted.

If there is an error in creating of the snapshot call printAndDie() with appropriate error message.

remove-snapshot

The action remove-snapshot is used by ZRM to remove the snapshot. There is one input parameter:

--dev <device>
The snapshot device to be removed.

If there is an error in creating of the snapshot call printAndDie() with appropriate error message.

Logs

Errors and Messages from the snapshot plugin are logged to mysql-zrm logs ( /var/log/mysql-zrm/mysql-zrm.log ).