GAE / J数据存储备份 [英] GAE/J datastore backup

查看:86
本文介绍了GAE / J数据存储备份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行GAE / J数据存储备份的最简单方法是什么?

看起来有python bulkloader.py工具可以为Python应用程序做备份,但我应该怎么做备份Java应用程序?有什么方法可以使用python工具?

解决方案

可以使用python工具bulkloader.py创建GAE的数据存储备份Java应用程序。您只需在web.xml中添加以下几行即可设置remote_api:

 <?xml version =1.0编码= UTF-8 >?; 
< web-app>
<! - 将此添加到您的web.xml以在Java上启用远程API。 - >
< 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>
<角色名称>管理员< /角色名称>
< / auth-constraint>
< / security-constraint>
< / web-app>

之后,您可以使用bulkloader.py和--dump下载备份并使用--restore上传备份到数据存储。


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?

解决方案

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.

这篇关于GAE / J数据存储备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆