0
私は弾性検索にリポジトリを登録する際に問題があります。ここで が、私はそれを行うために使用するリンクです:は、s3リポジトリをawsの弾性検索に登録できません。
としては、リンクに記載されている私は、次のコードをコピーし、それを実行しました:
from boto.connection import AWSAuthConnection
クラスESConnection(AWSAuthConnection):
def __init__(self, region, **kwargs):
super(ESConnection, self).__init__(**kwargs)
self._set_auth_region_name(region)
self._set_auth_service_name("es")
def _required_auth_capability(self):
return ['hmac-v4']
if __name__ == "__main__":
client = ESConnection(
region='us-east-1',
host='search-weblogs-etrt4mbbu254nsfupy6oiytuz4.us-east-1.es.example.com',
aws_access_key_id='my-access-key-id',
aws_secret_access_key='my-access-key', is_secure=False)
print 'Registering Snapshot Repository'
resp = client.make_request(method='POST',
path='/_snapshot/weblogs-index-backups',
data='{"type": "s3","settings": { "bucket": "es-index-backups","region": "us-east-1","role_arn": "arn:aws:iam::123456789012:role/TheServiceRole"}}')
body = resp.read()
print body
また、私はセキュリティとアカウントIDを変更しています。 私はそれを実行すると、私は次のエラーを取得する:
Traceback (most recent call last):
File "C:/Users/hminaee/Documents/bni-tj-cm-Copy-Sep/test-image-repo.py",
line 24, in <module>
data='{"type": "s3","settings": { "bucket": "mybucket","region": "us-
east-1","role_arn": "arn:aws:s3:::mybucket"}}')
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-
packages\boto\connection.py", line 1071, in make_request
retry_handler=retry_handler)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-
packages\boto\connection.py", line 1030, in _mexe
raise ex
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-
packages\boto\connection.py", line 943, in _mexe
request.body, request.headers)
File
"C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\http\client.py",
line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File
"C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\http\client.py",
line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File
"C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\http\client.py",
line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File
"C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\http\client.py",
line 1026, in _send_output
self.send(msg)
File
"C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\http\client.py",
line 964, in send
self.connect()
File
"C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\http\client.py",
line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\socket.py",
line
704, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\socket.py",
line
743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed
私の問題は何ですか?私はそれを行うことができるより良いチュートリアルや方法はありますか?
実際私の例では、これと似た弾性検索のエンドポイントを使用しています。https://search-test-tj-xxxxxxxxxxx.us-east-1.es.amazonaws.com –
URLはvaildです –
あなたはそれが有効であることを100%確信していますか?エラーはそうではないと言っているからです。 'getaddrinfo failed'は、あなたが提供したコードサンプルで手動で指定する唯一のホスト名で、解決できないホスト名があることを意味します。 – kichik