下面是注册GCS存储库的Python代码:
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}
1条答案
按热度按时间whlutmcx1#
我想我找到了:* * gcs插件**未安装在我的目标服务器上。
星期一就该修好了所以我开始下一个任务。
希望这是有帮助的!