1
这可能是一个愚蠢的问题,但我无法找到答案。 如果我的集群中有3个节点,那么在创建传输客户端时需要提供每个节点的IP和端口,以便我可以与每个节点通信?Elasticsearch集群连接
new PreBuiltTransportClient(settings, AuthenticationPlugin.class).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"),
Integer.parseInt("9300")))
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"),
Integer.parseInt("9301")))
InetSocketTransportAddress(InetAddress.getByName("localhost"),
Integer.parseInt("9302")));;
有什么办法,我不需要提供每个节点的IP和端口? 请帮忙
如果我连接到节点1(本地主机,9300),但一些如何ES节点出现故障,有2个节点端口仍然运行[(本地主机,9301)和(localhost,9302)。所有节点都在单个集群中,那么我的传输客户端将自动连接到正在运行的节点之一(9301或9302)? – Wolverine
每个elasticsearch节点至少使用2个端口(transport.tcp.port:9300 默认为http.port:9200) 如果您在同一台服务器上启动多个节点,请确保您覆盖这两个端口 – pkhlop
约定elasticsearch对每个端口使用2个端口1为tcp和1为http,但我仍然不清楚我的问题 \t **如果我连接到节点1(本地主机,9300),但一些ES节点如何关闭,并有2个节点仍在运行端口[(localhost,9301)和(localhost,9302)。所有节点都在单个集群中,那么我的传输客户端将自动连接到正在运行的节点之一(9301或9302)?? ** – Wolverine