0
aws elastic search에 저장소를 등록하는 데 문제가 있습니다. 여기 내가 그렇게하는 데 사용하는 링크입니다 :aws 탄성 검색에 s3 저장소를 등록 할 수 없습니다.
을 그리고 링크에서 언급 된 바와 같이 나는 다음 코드를 복사하고 그것을 실행 :
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이 유효합니다. –
100 % 확실한가요? 오류가 아니라고 말하기 때문입니다. 'getaddrinfo failed '는 일부 호스트 이름을 해석 할 수 없으며 사용자가 제공 한 코드 샘플에서 수동으로 지정하는 유일한 호스트 이름입니다. – kichik