使用https与elasticsearch-php客户端 [英] using https with elasticsearch-php client

查看:156
本文介绍了使用https与elasticsearch-php客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 php elasticsearch client

我无法使用 https 端点。我的集群背后是一个带有VIP的负载平衡器,它正在使用Apache身份验证,并且在端口443上。我遇到的麻烦是客户端的配置似乎是解析主机并删除 https:// 。这导致客户端总是尝试通过端口80连接。我尝试添加:443到主机名,但是我得到一个卷曲错误从服务器的空答复。我知道这台服务器可以访问(没有防火墙阻止),因为我可以使用 https://myelasticsearch.com

I am having trouble using an https endpoint for this. I have my cluster behind a load balancer with a VIP in front, it is using Apache authentication and is on port 443. The trouble I am running into is that the config for the client seems to be parsing the hosts and removes https:// from the host name. this results in the client always trying to connect over port 80. I have tried adding :443 to the host name but I am then getting a curl error "empty reply from server". I know that this server has access (no firewall blocking) because i can manually make the curl call using https://myelasticsearch.com.

我的问题是,是否有一种方法来指定使用此客户端请求的协议?如果没有,源中的哪里是主机阵列的解析发生?

My question is, is there a way to specify the protocol to make the request over using this client? if not, where in the source is the parsing of the host array happening?

推荐答案

只要更新此问题(万一有人绊倒),这个错误在Elasticsearch-PHP v1中被修复.1.0。您现在可以在主机中指定 https 以使用SSL:

Just as an update to this question (in case anyone stumbles into it), this bug was fixed in Elasticsearch-PHP v1.1.0. You can specify https in the host now to use SSL:

$params = array();
$params['hosts'] = array (
    'https://localhost',        // SSL to localhost
    'https://192.168.1.3:9200'  // SSL to IP + Port
);

$client = new Elasticsearch\Client($params);

这篇关于使用https与elasticsearch-php客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆