如何备份 AppEngine 网站?
因此,您在 AppEngine 之上构建了一个出色的、闪亮的多云 2.0 网站,其中将成千上万的图像保存到数据存储中,并在 blob 存储中保存大量数据。你如何备份它们?
So, you build a great shiny cloudy 2.0 website on top of AppEngine, with thousands upon thousands of images saved into the datastore and gigs of data at the blobstore. How do you backup them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用 Google App Engine 数据导出 http://code.google.com/ appengine/docs/python/tools/uploadingdata.html
use google app engine data export http://code.google.com/appengine/docs/python/tools/uploadingdata.html
此处的命令不起作用
http ://code.google.com/appengine/docs/python/tools/uploadingdata.html#Downloading_and_Uploading_All_Data
--dump
需要替换为download_data
,--restore
需要替换为upload_data
,--app_id
需要更改为--application
然后它将显示
“下载和上传所有数据”
您可以以适合备份和恢复的格式下载和上传某种实体,所有这些都无需编写任何额外的代码或配置。要下载所有类型的所有实体,请运行以下命令:
您还可以使用 --kind=... 参数来下载特定类型的所有实体:
注意:下载所有类型的所有实体仅适用于 App Engine,并且不适用于开发服务器。
要将数据从 appcfg.py --dump 创建的文件上传到应用程序的数据存储区,请运行以下命令:
下载数据时,实体与其原始密钥一起存储。当数据恢复时,使用原始密钥。如果数据存储中存在与要恢复的实体具有相同键的实体,则数据存储中的实体将被替换。
您可以使用 --restore 替换从中转储数据的应用程序中的数据,也可以使用它将数据上传到其他应用程序。具有数字系统 ID 的实体将使用相同的 ID 进行恢复,并且引用属性将被保留。
The command here does not work
http://code.google.com/appengine/docs/python/tools/uploadingdata.html#Downloading_and_Uploading_All_Data
--dump
needs to be replaced withdownload_data
,--restore
needs to be replaced withupload_data
and--app_id
needs to be changed to--application
Then it would read
Downloading and Uploading All Data
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:
You can also use the --kind=... argument to download all entities of a specific kind:
Note: Downloading all entities of all kinds only works on App Engine, and does not work with the development server.
To upload data to the app's datastore from a file created by appcfg.py --dump, run the following command:
When data is downloaded, the entities are stored along with their original keys. When the data is restored, the original keys are used. If an entity exists in the datastore with the same key as an entity being restored, the entity in the datastore is replaced.
You can use --restore to replace the data in the app from which it was dumped, or you can use it to upload the data to a different application. Entities with numeric system IDs will be restored with the same IDs, and reference properties will be preserved.
现在仪表板中提供了一个备份选项。请参阅“数据存储管理”。
There is now a backup option available in the dashboard. See "datastore admin".
我对建议的解决方案遇到了一些麻烦,所以我不得不与它进行一些斗争。这是我想到的:
/bulkloader.yaml/
/ --filename=backup/$f.csv --config_file=/bulkloader.yaml --kind=$f
1. 将remote_api添加到app.yaml中,如上所述或简单地添加为
<代码>
内置函数:
- 远程API:打开
2. 如上所述创建批量加载程序会导致我出现身份验证错误,例如 bug1125。下面的命令有效
<代码>
appcfg.py create_bulkloader_config --filename=
3. 更改bulkloader 中的所有TODO。就我而言,我将所有连接器更改为“csv”,并为所有外键指定了有意义的名称。
4.我使用以下(bash)命令来备份所有类型
<代码>
for f in
cat/bulkloader.yaml | grep "\- 种类" | awk '{print $3}'
做
appcfg.py download_data
完成
注意:这两个命令都适用于应用程序文件夹上方的文件夹
I had some trouble with the suggested solution, so I had to fight with it a little. Here's what I came up with:
1. Add remote_api to app.yaml as described above or simply as
builtins:
- remote_api: on
2. Creating bulk loader as described above resulted in an authentication error for me like bug1125. The command below worked
appcfg.py create_bulkloader_config --filename=<appfolder>/bulkloader.yaml <appfolder>/
3. Change all the TODOs in bulkloader. In my case I changed all the connectors to "csv" and gave all foreign keys meaningful names.
4. I used the following (bash) command to back up all the kinds
for f in
cat <appfolder>/bulkloader.yaml | grep "\- kind" | awk '{print $3}'
do
appcfg.py download_data <appfolder>/ --filename=backup/$f.csv --config_file=<appfolder>/bulkloader.yaml --kind=$f
done
Note: Both commands are meant to run for a folder above the app folder