从命令行备份 MariaDB

MariaDB Backup from the command line

开发人员控制台中用于创建备份的备份功能很棒。但是,我希望有可能将其自动化。有没有办法从 cf 命令行应用程序执行此操作?

谢谢

cf cli 不可能,但有一个 API endpoint 用于触发备份。

API Docs | Custom Extensions | Swisscom Application Cloud Filter for Cloud Foundry (CF) Cloud Controller (CC) API. Implements Swisscom proprietary extensions

POST /custom/service_instances/{service-instance-id}/backups

Creates a backup for a given service instance

有关更多信息,请参阅 Service Backup and Restore docs.developer.swisscom.com

Create Backup To create a backup, navigate to the service instance in the web console and then to the “Backups” tab. There you can click the “Create” button to trigger a manual backup.

Note: Backups have to be triggered manually from the web console.

Be aware that you can only keep a set number of backups per service instance. The actual number is dependent on the service type and service plan. In case you already have the maximum number, you cannot create any new backups before deleting one of the existing.

It may take several minutes to backup your service (depending on the size of your service instance).

Restore Backup You can restore any backup at any time. The current state of your backup will be overwritten and replaced with the state saved to the backup. You are advised to create a backup of the current state before restoring an old state.

Limitations You can only perform one backup or restore action per service instance at a time. If an action is still ongoing, you cannot trigger another one. You cannot exceed the maxmimum number of backups per service instance

尽管 from Matthias Winzeler 说这是不可能的,但实际上完全可以通过命令行自动执行 MariaDB 备份。

我为 CF CLI 开发了一个插件: https://github.com/gsmachado/cf-mariadb-backup-plugin

将来我可以扩展此类插件以备份 Cloud Foundry 提供商 API(在本例中为 Swisscom AppCloud API)支持的任何类型的服务。

我们通过开发一个小型 Node.js 应用程序来做到这一点,该应用程序 运行 在同一个 space 的云上,每晚备份我们的 maria 和 mongo 数据库自动。

编辑: 您可以从这里下载代码: https://github.com/theonlyandone/cf-backup-app

新鲜出炉:Swisscom Application Cloud cf CLI Plugin 还可以自动备份和恢复。

The official cf CLI plugin for the Swisscom Application Cloud gives you access to all the additional features of the App Cloud.

cf install-plugin -r CF-Community "Swisscom Application Cloud"

来自 0.1.0 release notes

Service Instance Backups

  • Add cf backups command (list all backups of a service instance)
  • Add cf create-backup command (create a new backup of a service instance)
  • Add cf restore-backup command (restore an existing backup of a service instance)
  • Add cf delete-backup command (delete an existing backup of a service instance)