April 16, 2012
Experimental!
Datastore Administration is an experimental, innovative, and rapidly changing new feature for Google App Engine. Unfortunately, being on the bleeding edge means that we may make backwards-incompatible changes to Datastore Administration. We will inform the community when this feature is no longer experimental.
Introduction
Note: Use of this feature is limited to backups started from the application's cron or task queue.
You can run scheduled backups for your application using the App Engine Cron service. To do this for Python or Go apps, specify backup cron jobs in cron.yaml . For Java apps, specify the backup cron job in cron.xml . Currently there is no way to specify a scheduled backup programmatically.
Setting Up a Scheduled Backup
To set a scheduled backup for your app,
- If you haven't already done so, enable Datastore Admin for your app.
- If you are using Google Cloud Storage for your backups, and have not yet done so, properly configure the bucket you are using for backups.
-
In your application directory, if you don't already have one, create a
cron.yaml
file for a Python or Go app or acron.xml
file for a Java app. -
Add the backup cron entries. These specify the backup schedule, the set of
entities to back up, and the storage to be used for the backups, as described in
Specifying Backups in a Cron File
.
Here are some examples:
Python
Sample Python
cron.yaml
cron: - description: My Daily Backup url: /_ah/datastore_admin/backup.create?name=BackupToCloud&kind=LogTitle&kind=EventLog&filesystem=gs&gs_bucket_name=whitsend schedule: every 12 hours target: ah-builtin-python-bundle
Java
Sample Java
cron.xml
(note use of "&", as "&" is interpreted by XML)<?xml version="1.0" encoding="UTF-8"?> <cronentries> <cron> <description>My Daily Backup</description> <url>/_ah/datastore_admin/backup.create?name=BackupToCloud&kind=LogTitle&kind=EventLog&filesystem=gs&gs_bucket_name=whitsend</url> <schedule>every 12 hours</schedule> <target>ah-builtin-python-bundle</target> </cron> </cronentries>
- Deploy this file with your app. (You can verify the Cron job you just deployed by clicking Cron Jobs in the left nav pane.)
The backups will occur on the schedule you specified. While it runs, it will show up in the Pending Backups list. After the backup is complete, you can view it and use it in the list of available backups within the Datastore Admin tab.
Specifying Backups in a Cron File
These are the fields to include in your cron file to perform scheduled backups:
-
description
- This is the title that appears in the Cron Job list. It can be anything you wish.
-
url
-
The url is required and must be in this format:
/_ah/datastore_admin/backup.create?name=<backup-name-prefix>&kind=<kind-1>&kind=<kind-N>&queue=<task-queue>&filesystem=<filesystem-type>&gs_bucket_name=<bucket-name>