我在外部服务器上托管独立的elasticsearch。使用证书和登录密码身份验证。我能够连接到它使用浏览器或邮递员。
但是,当我尝试这样做时,使用python客户端就不能工作了。我的连接代码:
self.es = Elasticsearch(
address,
ca_certs=cert_path,
basic_auth=(user, password),
)
错误消息:
elastic_transport.TlsError: TLS error caused by: TlsError(TLS error caused by: SSLError(hostname '34.116.***.***' doesn't match either of 'localhost', '172.19.0.2', '127.0.0.1', 'bde723133f75'))
发布于 2022-07-19 08:52:56
用Luc的一些帮助回答:就在我尝试这样的东西之前:
from ssl import create_default_context
import ssl
context = create_default_context(capath=cert_path)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
self.es = Elasticsearch(
address,
ssl_context=context,
basic_auth=(user, password),
verify_certs=False,
)
我收到了一些警告,但另外一些则是这样做的。
https://stackoverflow.com/questions/73032582
复制相似问题