尝试在Google App Engine专案中建立备份时,显示404 [英] 404 when trying to create backup in a Google App Engine project
问题描述
设置
在遇到未接受问题的答案后遇到404问题AppEngine数据存储 - 以程序方式备份
我已启用Datastore Admin,由答案提供商之一建议。我可以在Google App Engine控制台中手动触发数据存储区备份,备份运行时不会出现任何故障。
此问题中的代码位于一个名为app的模块中。不是默认值。
404问题
in cron.yaml。
cron:
- 描述:常规备份
url:/ _backup / fullbackup
schedule:每24小时
url的处理程序会将一个备份任务放入队列,然后依次调用
_ah / datastore_admin / backup.create?
gs_bucket_name =%2Fgs%2Ftest.appspot.com%2F21-06-2015& kind = Test& kind = TestContent
& kind = TestDocument& filesystem = gs
(我用app替换了我的应用程序id)
日志中出现 404 错误。
如果我在浏览器中使用上述网址和我的应用程序主机名(即
https:// test .appspot.com / _ah / datastore_admin / backup.create?
),我也得到了一个404。
gs_bucket_name =%2Fgs%2Ftest.appspot.com%2F21-06-2015& kind = Test& kind = TestContent
& kind = TestDocument& kind ; filesystem = gs
以下是路由处理程序中的相关代码
/ _ backup / fullbackup
task = taskqueue.add(
url ='/ _ ah / datastore_admin / backup .create',
method ='GET',
target ='ah-builtin-python-bundle',
params = {
'filesystem':'gs',
'gs_bucket_name':self.get_bucket_name(),
'kind':(
'Test',
'TestContent',
'TestDocument'
)
}
)
问题:
- 问题的原因是什么?
- 我需要一个队列名称
taskqueue.add
python代码的一部分 - 在我的cron.yaml中,我需要设置目标为
ah-builtin-python-bundle
?
EDIT
已启用datastore-admin内置版本,如此截图所示。
且没有dispatch.yaml
>
它与队列配置问题相关。
app.yaml中存在'实施定期备份。因此,备份任务无法到达目标ah-builtin-python-bundle
如果我定义了一个新队列
- name:data-backup
rate:1 / s
target:ah-builtin-python-bundle
然后使用此代码插入任务
task = taskqueue.add(
url ='/ _ ah / datastore_admin / backup.create',
method ='GET',
queue_name =data-backup ,
params = {
'filesystem':'gs',
'gs_bucket_name':self.get_bucket_name(),
'kind':kinds_list#我想备份
}
)
设置
Setup
I encountered the 404 problem after following the unaccepted answers of the question AppEngine datastore - backup programatically
I have enabled the Datastore Admin, as suggested by one of the answer provider. I can manually trigger a datastore backup in Google App Engine console and the backup runs without any failure.
The code in this question lives in a module called 'app'. Not 'default'.
The 404 Problem
This is the cron job in cron.yaml.
cron: - description: Regular backup url: /_backup/fullbackup schedule: every 24 hours
The handler of url will put a backup task in a queue, which in turn make a call to
_ah/datastore_admin/backup.create? gs_bucket_name=%2Fgs%2Ftest.appspot.com%2F21-06-2015&kind=Test&kind=TestContent &kind=TestDocument&filesystem=gs
(I replaced my app id with 'test' here)
This shows a 404 error in the log.
If I use the above url with my app host name in a brower (i.e.
https://test.appspot.com/_ah/datastore_admin/backup.create? gs_bucket_name=%2Fgs%2Ftest.appspot.com%2F21-06-2015&kind=Test&kind=TestContent &kind=TestDocument&filesystem=gs
), I get a 404 too.Here is the relevant code in the handler of the route
/_backup/fullbackup
task = taskqueue.add( url='/_ah/datastore_admin/backup.create', method='GET', target='ah-builtin-python-bundle', params={ 'filesystem': 'gs', 'gs_bucket_name': self.get_bucket_name(), 'kind': ( 'Test', 'TestContent', 'TestDocument' ) } )
Questions:
- What is the cause of the issue?
- Do I need a queue name in the
taskqueue.add
part of python code? - In my cron.yaml, do I need to set target to
ah-builtin-python-bundle
?
EDIT
The datastore-admin built-in has been enabled, as seen in this screenshot.
And there is no dispatch.yaml
It is related to a queue configuration issue.
A 'default' queue definition was present in the app.yaml prior to the implementation of regular backup. The backup tasks are, as a result, not reaching the target 'ah-builtin-python-bundle'
If I define a new queue
- name: data-backup
rate: 1/s
target: ah-builtin-python-bundle
Then use this code to insert task,
task = taskqueue.add(
url='/_ah/datastore_admin/backup.create',
method='GET',
queue_name="data-backup",
params={
'filesystem': 'gs',
'gs_bucket_name': self.get_bucket_name(),
'kind': kinds_list # A list of ndb model classes I want to backup
}
)
Then Google app engine can create backup set
这篇关于尝试在Google App Engine专案中建立备份时,显示404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!