AWS Managed ElasticSearch上的弹性运输客户端 [英] Elastic Transport client on AWS Managed ElasticSearch
问题描述
我已经按照https://aws.amazon.com/blogs/aws/new-amazon-elasticsearch-service/ ,我可以启动一个实例,哪个是全成。但是我无法使用elasticsearch传输客户端从我的服务连接到同一个实例。
我知道运输客户端应该连接到9300端口,而那个端口i无法通过aws控制台打开。
以下是我用于连接的代码,可以在9300端口的ec2机器上成功连接到我的弹性搜索设置。
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put(cluster.name,my-cluster-name)
.put(client.transport.nodes_sampler_interval,15s)
.put(client
.put(client.transport.sniff,true)
.put(client.transport.ignore_cluster_name,false).build();
client = new TransportClient(settings)
.addTransportAddress(
new InetSocketTransportAddress(
env.getProperty(elastic-host-url-provided-by-aws,80)
));
我得到例外
org.elasticsearch.client.transport.NoNodeAvailableException:
无配置节点可用:[] at
org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java :305)
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:200)
at
org.elasticsearch.client.transport.support.InternalTransportClient .execute(InternalTransportClient.java:106)
org.elasticsearch.client.support.AbstractClient.index(AbstractClient.java:98)
我怀疑这是因为我通过HTTP端口连接TransportClient。但我不知道什么是aws管理弹性搜索实例的TCP端口。我在aws文件中搜索,我找不到任何东西。如果有些人使用TransportClient与Amazon ES连接,让我知道。
注意:我已经验证了我的elasticsearch java jar版本
使用与服务器一样。而从我的系统我可以
访问Kibana和ES HTTP PORTS与任何问题。
AWS相关论坛链接。
此处是对AWS的限制ElasticSearch服务:
TCP传输该服务支持端口80上的HTTP,但不支持
支持TCP传输。
I am trying to use the AWS Managed ElasticSearch for my project.
I have followed https://aws.amazon.com/blogs/aws/new-amazon-elasticsearch-service/ and i am able to start an instance and which is successfull. But I am unable to connect to the same instance from my service using elasticsearch transport client.
I know transport client supposed to connect on to the 9300 port, and that port i am unable to turn on through the aws console.
Here is the code that I am using to connect, which is successfully able to connect to my elastic search setup on an ec2 machine on the 9300 port.
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("cluster.name", "my-cluster-name")
.put("client.transport.nodes_sampler_interval", "15s")
.put("client.transport.ping_timeout", "15s")
.put("client.transport.sniff", true)
.put("client.transport.ignore_cluster_name", false).build();
client = new TransportClient(settings)
.addTransportAddress(
new InetSocketTransportAddress(
env.getProperty("elastic-host-url-provided-by-aws",80)
));
I am getting the Exception
org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [] at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:305) at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:200) at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106) at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.java:98)
I suspect that this error is since I am connecting the TransportClient over the HTTP port. But I dunno what is the TCP port for aws managed elastic search instance. I searched in aws documents, and i couldnt find any. If some have used TransportClient to connect with Amazon ES let me know.
NB: I have verified that the elasticsearch java jar version that I am using is as same as same with the server. And from my system I am able to access the Kibana and the ES HTTP PORTS with out any issue.
AWS related Forum link.
Here are the restrictions for AWS ElasticSearch service:
TCP transport The service supports HTTP on port 80, but does not support TCP transport.
这篇关于AWS Managed ElasticSearch上的弹性运输客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!