我在集群中使用了两个 ES 节点(ES 版本 1.0.1),我需要澄清以下内容:
当我启动应用程序并连接到两个节点时,我可以看到两个节点都提供了请求,但是当我停止其中一个服务器时,它会抛出异常,其他节点仍然可以工作,但是 50% 的请求仍然会出现异常,并且整个流量不会被转移到运行中节点。
我有以下集群配置:第一个节点:
discovery.zen.minimum_master_nodes: 1
node.data: true
discovery.zen.ping.unicast.hosts: ["product-elasticsearch-1","product-elasticsearch-2"]
node.master: true
couchbase.maxConcurrentRequests: 1024
2nd Node
discovery.zen.minimum_master_nodes: 1
node.data: true
discovery.zen.ping.unicast.hosts: ["product-elasticsearch","product-elasticsearch-2"]
node.master: false
couchbase.maxConcurrentRequests: 1024
以下是传输客户端的代码:
settings = ImmutableSettings.settingsBuilder().put("cluster.name", clusterName)
.put("es.http.timeout",timeout)
.put("client.transport.ping_timeout",pingTimeout)
.put("es.http.retries",retries)
.build();
for (String host : hostList) {
transportAddressList.add(new InetSocketTransportAddress(host,port));
}
Collections.shuffle(transportAddressList);
// Using Transport Client
trasportClient = new TransportClient(settings).addTransportAddresses(transportAddressList.toArray(addressArray));
当我停止一个 ES 进程时,有人可以让我知道为什么所有请求都不是由正在运行的节点提供服务吗?