我有这个python脚本:
from requests_aws4auth import AWS4Auth
from elasticsearch import Elasticsearch, RequestsHttpConnection
session = boto3.session.Session()
credentials = session.get_credentials()
awsauth = AWS4Auth(credentials.access_key,
credentials.secret_key,
session.region_name, 'es',
session_token=credentials.token)
es_client = Elasticsearch(
"vpc-mydomain-elasticsearch-xxxxxxxxx.region.es.amazonaws.com:9200",
http_auth=awsauth,
use_ssl=False,
verify_certs=False,
connection_class=RequestsHttpConnection)
print(es_client.info())
运行脚本时出现此错误:
raise ConnectionTimeout('TIMEOUT', str(e), e)
elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by - ReadTimeout(HTTPConnectionPool(host='10.0.2.2', port=3128): Read timed out. (read timeout=10))
集群的安全组为90.0.0.0/0打开了端口9200。 ( 10.0.2.2是我的流浪者机器的IP地址,端口3128是cntlm的侦听端口) 如何获得这项工作?
编辑
我也尝试过,但是没用:
curl -XGET https://vpc-mydomain-elasticsearch-xxxxxxxxx.region.es.amazonaws.com:9200/_cat/indices?v
curl: (56) Received HTTP code 403 from proxy after CONNECT
答案 0 :(得分:0)
尝试以下解决方案:
希望这会有所帮助。