Google App Engine for Java数据备份下载
It is possible to use python tool bulkloader.py to create datastore backup of GAE Java app. You just have to set up remote_api by adding following lines to web.xml: After that you can use bulkloader.py with --dump to download backup and with --restore to upload backup to datastore. You can also use the You can download and upload every entity of a kind in a format suitable for backup and restore, all without writing any additional code or configuration. To download all entities of all kinds, run the folowing command: To start a data download, run If you are using a Google Apps domain name and need appcfg.py to sign in using an account on that domain, you must specify the If the transfer is interrupted, you can resume the transfer from where it left off using the <?xml version="1.0" encoding="utf-8"?>
<web-app>
<!-- Add this to your web.xml to enable remote API on Java. -->
<servlet>
<servlet-name>remoteapi</servlet-name>
<servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>remoteapi</servlet-name>
<url-pattern>/remote_api</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>remoteapi</web-resource-name>
<url-pattern>/remote_api</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
</web-app> --kind=...
argument to download all entities of a specific kind:
bulkloader.py --dump --app_id=<app-id> --kind=<kind> --url=http://<appname>.appspot.com/remote_api --filename=<data-filename>
bulkloader.py --dump --app_id=<app-id> --url=http://<appname>.appspot.com/remote_api --filename=<data-filename>
Downloading Data from App Engine
appcfg.py download_data
with the appropriate arguments:
appcfg.py download_data --config_file=album_loader.py --filename=album_data_archive.csv --kind=Album <app-directory>
--auth_domain=...
option, whose value is your domain name.--db_filename=...
and --result_db_filename=...
arguments. These arguments are the names of the progress file and the results file created by the tool, which are either names you provided with the arguments when you started the transfer, or default names that include a timestamp. This assumes you have sqlite3
installed, and did not disable progress files with --db_filename=skip
.