简体   繁体   English

下载Google App Engine数据库

[英]Downloading Google App Engine Database

I had created web application and deploy it in Google App Engine after I created table(entity) in Google App Engine datastore. 在Google App Engine数据存储区中创建表(实体)后,我已经创建了Web应用程序并将其部署在Google App Engine中。 My doubt is it possible to download the entity/database? 我怀疑是否可以下载实体/数据库?

to enable remote_api , add this to your web.xml : 要启用remote_api ,请将其添加到您的web.xml

<servlet>
  <servlet-name>remote-api</servlet-name>
  <servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>remote-api</servlet-name>
  <url-pattern>/remote_api</url-pattern>
</servlet-mapping>

details in this thread: http://groups.google.com/group/google-appengine/browse_thread/thread/1bb013cbdd30750b 此线程中的详细信息: http : //groups.google.com/group/google-appengine/browse_thread/thread/1bb013cbdd30750b

then, as shay mentioned, use the bulk loader . 然后,如谢伊所言,使用批量加载器

(added as an answer instead of a comment only because the XML wouldn't format nicely in a comment.) (添加为答案而不是注释,只是因为XML在注释中的格式不正确。)

I had a simple requirement to dump entities from GAE Java based App and restore them to local datastore. 我有一个简单的要求,即从基于GAE Java的App中转储实体并将其还原到本地数据存储区。 I could finally do it with following steps 我最终可以按照以下步骤进行操作

  1. Add RemoteApiServlet to web.xml and deploy the app 将RemoteApiServlet添加到web.xml并部署应用程序

     <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> 
  2. Download Google App Engine SDK for Python and unzip 下载适用于Python的Google App Engine SDK并解压缩

  3. Use bulkloader.py to dump the datastore from GAE 使用bulkloader.py从GAE转储数据存储

    bulkloader.py --dump --application=s~appid --url=http://appid.appspot.com/remote_api --filename=xyz.dump bulkloader.py --dump --application = s〜appid --url = http://appid.appspot.com/remote_api --filename = xyz.dump

    --application is given as s~appid ie s tilda appid as app was using HR datastore. --application是作为s〜appid给出的,即tilda appid是使用HR数据存储区的app。 For Master/Slave datasotre plain appid will do. 对于主/从datasotre,普通appid会这样做。

    bulkload.py will prompt for login credentials for app. bulkload.py将提示您输入应用程序的登录凭据。 On authentication it will dump the entities to the file specified. 进行身份验证时,它将把实体转储到指定的文件中。

  4. To restore use following command 要恢复使用以下命令

    bulkloader.py --restore --application=appid --url=http://127.0.0.1:8888/remote_api --filename=xyz.dump bulkloader.py --restore --application = appid --url = http://127.0.0.1:8888 / remote_api --filename = xyz.dump

    For local credentials use email admin and blank password. 对于本地凭据,请使用电子邮件管理员和空白密码。 Even for HRD local datastore use plain appid (s~appid restores data but entities can't be accessed in Development Console - Datastore viewer. I don't know why) 即使对于HRD本地数据存储区,也请使用普通的appid(s〜appid恢复数据,但无法在开发控制台-数据存储区查看器中访问实体。我不知道为什么)

    Dump can be restored to same appid or even to a different appid 转储可以还原到相同的appid甚至不同的appid

是的,使用BulkLoader

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM