Python elasticutils http 身份验证或 api 密钥?
Python elasticutils http authentication or api key?
你好,我目前在 django 中使用 elasticutils 来搜索索引文档,但我的集群没有任何身份验证方法,因此任何人都可以从互联网访问我的 ES 服务器,有没有办法设置密钥 o auth 方法使用 elasticutils 以便只有具有密钥的服务器可以查询到 ES 服务器?
可能是搜索或亚马逊关键字 api 的
有几种方法可以保护您的 ES 集群。
最简单的方法是安装插件,例如 elasticsearch-http-basic in order to protect your cluster. You can configure it with a BASIC username/password combo and then it's just a matter of configuring elasticutils to pass those BASIC credentials along to the underlying ES client provided by the elasticsearch-py 库。
调用 get_es(...)
时,您只需添加 http_auth
参数,该参数将像这样传递给 Elasticsearch
构造函数:
es_client = get_es(urls=['localhost:9200'], http_auth="username:password")
另一种方法是将您的 ES 集群隐藏在 Apache 或 Nginx 等 Web 服务器后面,但它比上述解决方案涉及更多。
也可以用Shield,知道是商业产品就可以了
你好,我目前在 django 中使用 elasticutils 来搜索索引文档,但我的集群没有任何身份验证方法,因此任何人都可以从互联网访问我的 ES 服务器,有没有办法设置密钥 o auth 方法使用 elasticutils 以便只有具有密钥的服务器可以查询到 ES 服务器?
可能是搜索或亚马逊关键字 api 的
有几种方法可以保护您的 ES 集群。
最简单的方法是安装插件,例如 elasticsearch-http-basic in order to protect your cluster. You can configure it with a BASIC username/password combo and then it's just a matter of configuring elasticutils to pass those BASIC credentials along to the underlying ES client provided by the elasticsearch-py 库。
调用 get_es(...)
时,您只需添加 http_auth
参数,该参数将像这样传递给 Elasticsearch
构造函数:
es_client = get_es(urls=['localhost:9200'], http_auth="username:password")
另一种方法是将您的 ES 集群隐藏在 Apache 或 Nginx 等 Web 服务器后面,但它比上述解决方案涉及更多。
也可以用Shield,知道是商业产品就可以了