Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- ChatGPT
- Real or Not? NLP with Disaster Tweets
- Git
- 금융문자분석경진대회
- 맥북
- gs25
- Baekjoon
- Docker
- Kaggle
- 데이콘
- 파이썬
- hackerrank
- 더현대서울 맛집
- 캐치카페
- 코로나19
- 프로그래머스 파이썬
- 우분투
- AI 경진대회
- 편스토랑
- programmers
- 백준
- 편스토랑 우승상품
- 프로그래머스
- github
- 자연어처리
- dacon
- ubuntu
- SW Expert Academy
- leetcode
- PYTHON
Archives
- Today
- Total
솜씨좋은장씨
[Elasticsearch] elasticsearch.exceptions.SSLError: ConnectionError([SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:852)) 해결 방법 본문
Programming/Elasticsearch
[Elasticsearch] elasticsearch.exceptions.SSLError: ConnectionError([SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:852)) 해결 방법
솜씨좋은장씨 2021. 5. 14. 15:30728x90
반응형
Python과 elasticsearch 라이브러리를 활용하여 es_client를 생성하고 elasticsearch에 검색식을 통해
결과를 받는 코드를 작성하였는데
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 706, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.6/dist-packages/urllib3/connection.py", line 421, in connect
tls_in_tls=tls_in_tls,
File "/usr/local/lib/python3.6/dist-packages/urllib3/util/ssl_.py", line 432, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "/usr/local/lib/python3.6/dist-packages/urllib3/util/ssl_.py", line 474, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/usr/lib/python3.6/ssl.py", line 817, in __init__
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:852)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/elasticsearch/connection/http_urllib3.py", line 246, in perform_request
method, url, body, retries=Retry(False), headers=request_headers, **kw
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 756, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.6/dist-packages/urllib3/util/retry.py", line 506, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.6/dist-packages/urllib3/packages/six.py", line 734, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 706, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.6/dist-packages/urllib3/connection.py", line 421, in connect
tls_in_tls=tls_in_tls,
File "/usr/local/lib/python3.6/dist-packages/urllib3/util/ssl_.py", line 432, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "/usr/local/lib/python3.6/dist-packages/urllib3/util/ssl_.py", line 474, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/usr/lib/python3.6/ssl.py", line 817, in __init__
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:852)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./app.py", line 169, in check_es_data_by_frm_cd
result = es_client.search(index=index_name, body=es_info.ES_FIND_BY_FRMCD_QUERY)
File "/usr/local/lib/python3.6/dist-packages/elasticsearch/client/utils.py", line 152, in _wrapped
return func(*args, params=params, headers=headers, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/elasticsearch/client/__init__.py", line 1663, in search
body=body,
File "/usr/local/lib/python3.6/dist-packages/elasticsearch/transport.py", line 390, in perform_request
raise e
File "/usr/local/lib/python3.6/dist-packages/elasticsearch/transport.py", line 365, in perform_request
timeout=timeout,
File "/usr/local/lib/python3.6/dist-packages/elasticsearch/connection/http_urllib3.py", line 255, in perform_request
raise SSLError("N/A", str(e), e)
elasticsearch.exceptions.SSLError: ConnectionError([SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:852)) caused by: SSLError([SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:852))
위와 같은 오류가 발생했습니다.
원인은 es_client를 만들때 사용한 url이 https로 시작하는 것 때문이었습니다.
ES_ADRSS = f"https://{ES_IP}:{ES_PORT}"
es_client = Elasticsearch(ES_ADRSS, timeout=100, max_retries=10, retry_on_timeout=True)
해결 방법은 기존에 https로 시작했던 url을
# 기존
ES_ADRSS = f"https://{ES_IP}:{ES_PORT}"
# 변경
ES_ADRSS = f"http://{ES_IP}:{ES_PORT}"
# or
ES_ADRSS = f"{ES_IP}:{ES_PORT}"
http로 바꾸거나 없애면 됩니다.
읽어주셔서 감사합니다.
'Programming > Elasticsearch' 카테고리의 다른 글
[Elasticsearch] 각종 터미널 명령 모음! (0) | 2021.02.02 |
---|---|
[Elasticsearch] Elasticsearch ValueError: Circular reference detected 해결방법 (0) | 2021.01.26 |
Elasticsearch 보안 관련 주의 사항! (0) | 2021.01.15 |
[Elasticsearch] Not whitelisted in reindex.remote.whitelist 해결 방법 (2) | 2020.12.21 |
[Elasticsearch] ConnectionTimeout caused by - ReadTimeoutError (feat. bulk API + python) (2) | 2020.05.08 |
Comments