MariaDB Backup from the command line

青春壹個敷衍的年華 提交于 2019-12-02 09:14:27

问题


The Backup feature in the developer console for creating backups is great. I would however like the possibility to automate this. Is there a way to do so from the cf command line app?

Thanks


回答1:


It's not possible from the cf cli, but there's an API endpoint for triggering backups.

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

See for more Info Service Backup and Restore in 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




回答2:


We did this by developing a small Node.js application which is running on the cloud in the same space and which backups our maria and mongo db every night automatically.

EDIT: You can download the code from here: https://github.com/theonlyandone/cf-backup-app




回答3:


Fresh from the press: Swisscom Application Cloud cf CLI Plugin can also automate backup and restore.

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"

from 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)



回答4:


Despite the answer from Matthias Winzeler saying it's not possible, in fact it's totally possible to automate MariaDB backups through the command line.

I developed a plugin for the CF CLI: https://github.com/gsmachado/cf-mariadb-backup-plugin

In future I could extend such plugin to backup any kind of service that is supported by the Cloud Foundry Provider's API (in this case, Swisscom AppCloud API).



来源:https://stackoverflow.com/questions/39655921/mariadb-backup-from-the-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!