views:

584

answers:

3

What is the easiest way to do a GAE/J datastore backup?

It looks like there is python bulkloader.py tool to do backup for Python apps, but what should I do to backup Java app? Is there any way to use python tool?

A: 

Just set up remote_api for your app using the directions here - notably the tip:

Tip: If you have a Java app, you can use the Python bulkloader.py tool by installing the Java version of the remote_api handler, which is included with the Java runtime environment. The handler servlet class is com.google.apphosting.utils.remoteapi.RemoteApiServlet.

Then, use the Python bulkloader with --dump or --restore.

Nick Johnson
can bulkloader --dump do incremental downloads?
Thilo
No. There's currently no generic way to do incremental downloads, since App Engine doesn't expose a total order over entities.
Nick Johnson
+5  A: 

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:

<?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> 

After that you can use bulkloader.py with --dump to download backup and with --restore to upload backup to datastore.

jb
A: 

Or if you can, you may wait for the datastore backup-restore feature in GAE upcoming versions as seen in the roadmap. http://code.google.com/appengine/docs/roadmap.html

Gopi
Still waiting for it :)
Guido