我有这个Python代码来注册谷歌云存储(GCS)存储库:
import requests
from grabconfig import grabconfig
(HOSTS, ign) = grabconfig()
reqHeaders = {'content-type' : 'application/json'}
for h in HOSTS:
url = f'http://{h}:9200'
r = requests.put(f'{url}/_snapshot/prod_backup2',
'''{ "type" : "gcs" }, { "settings" : { "client" : "secondary", "bucket" : "prod_backup2" },
{ "compress" : "true" }}''',
headers=reqHeaders)
print(r)
print(r.json())
r2 = requests.get(f'{url}/_cat/snapshots')
print(r2)
print(r2.json())
我使用的配置文件是prod.py一:
HOSTS = ['10.x.x.x']
BACKUP_REPO = ['prod_backup2']
但是当我运行代码时,我得到这个错误,总是:
<Response [500]>
{'error': {'root_cause': [{'type': 'repository_exception', 'reason': '[prod_backup2] repository type [gcs] does not exist'}], 'type': 'repository_exception', 'reason': '[prod_backup2] repository type [gcs] does not exist'}, 'status': 500}
我想我找到了:gcs插件
没有安装在我的目标服务器上。应该在周一之前完成,所以我要开始下一个任务了。