Copy Plugin

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

Copy plugin allow administrators to specify the mechanism to transfer files between the local ZRM for MySQL host and the remote MySQL server. The MySQL server should have ZRM client package installed.

Copy plugin could be used when carrying out

  • Incremental backups of remote MySQL server
  • Transferring Replication files from a remote MySQL server to the local ZRM for MySQL host.
  • Raw backups of remote MySQL server using MySQL tool - mysqlhotcopy or snapshots.
  • Database is being restored to a remote machine.

Configuration

The copy plugin can be configured in the global mysql-zrm.conf or backup set specific mysql-zrm.conf configuration file.

The copy-plugin parameter should include the name and the full path to the plugin. The recommended location for plugins is /usr/share/mysql-zrm/plugins directory.

The following parameters can be specified in the mysql-zrm.conf to modify the behavior of the copy plugins.

  • remote-mysql-binpath
  • ssh-user
  • socket-remote-port

Please refer to the chapter on ZRM plugin parameters for more details.

Plugin Interface

The parameters to Copy plugin are different from parameters to the rest of plugins. When the Copy plugin is used to perform raw backups (using mysqlhotcopy) of remote MySQL server, the first parameter will be --mysqlhotcopy[=path_to_mysql_binaries]. The remaining parameters will be mysqlhotcopy command line parameters. If raw backup method is not used, it is not necessary to implement mysqlhotcopy interface.

In all other circumstances, the plugin takes four parameters.

  • --source-host
  • --source-file
  • --destination-host
  • --destination-directory

The file specified by --source-file on the server specified by --source-host is transferred to the server specified by --destination-host into the directory specified by --destination-directory.

If the plugin exit status is 0, the file transfer is considered as successful. Otherwise, it is treated as failure. Copy plugin failure might result in database backup or database restoration failure.

Examples

Two examples of copy plugin - ssh based and socket based, are available in /usr/share/mysql-zrm/plugins/ directory. There are README files available in /usr/share/doc/MySQL-zrm*/ directory that document the configuration changes required to use the example plugins. Users are expected to the file to suit their environment.

SSH Copy Plugin

The ssh based plugin is called ssh-plugin.pl. This plugin uses SSH protocol to transfer files from and to MySQL server from the server running ZRM for MySQL. Since SSH is being used, the data transfer is secure. When ssh copy plugin is used, ZRM for MySQL uses mysql user on the MySQL server to execute commands.

The ssh plugin can be customized using the following parameters in mysql-zrm.conf configuration file.

  • remote-mysql-binpath
  • ssh-user

Please refer to the chapter on ZRM plugin parameters for more details about these parameters.

Socket Copy Plugin

The socket based plugin is called socket-copy.pl. The socket copy plugin requires MySQL ZRM socket server package to be installed on all MySQL servers. The socket-server package installs xinetd/inetd socket server service and reloads the xinetd/inetd.

The socket copy plugin uses tcp protocol to transfer data from MySQL server to the server running ZRM for MySQL. It uses port 25300 by default on the MySQL server. The port can be changed using mysql-zrm.conf and xinetd/inetd configuration files must be updated.

The socket plugin can be customized using the following parameters in mysql-zrm.conf configuration file.

  • remote-mysql-binpath
  • socket-remote-port

Please refer to the chapter on ZRM plugin parameters for more details about these parameters.

Summary

Plugin Port used Protocol used Configuration
SSH 22 SSH secure protocol ssh has to be configured between remote MySQL server and local server running ZRM for MySQL
Socket 25300 TCP MySQL-zrm-socket-server package has to be installed on MySQL server

Logs

  • Errors and Messages from the ssh and socket copy plugin are logged to mysql-zrm logs ( /var/log/mysql-zrm/mysql-zrm.log ).
  • SSH configuration messages appear in system logs ( /var/log/messages ).
  • Socket server messages (socket plugin component that runs on MySQL server) are logged in /var/log/mysql-zrm/socket-server.log file on the MySQL server.