关于集群的特殊问题

环境:
    jdk 1.8
    Elasticsearch 5.5.0

原因:
我有A,B,C,D 共4台服务器,每台配置的集群共同的集群名称,每台的数据是独立的。
然后我有个java程序来调用es客户端:代码如下

Settings settings = Settings.builder().put("cluster.name", "data").build();
esClient = new PreBuiltTransportClient(settings);

//A
esClient.addTransportAddress(new InetSocketTransportAddress(
InetAddress.getByName('192.168.1.10'), Integer.parseInt(9300)));

//B
esClient.addTransportAddress(new InetSocketTransportAddress(
InetAddress.getByName('192.168.1.11'), Integer.parseInt(9300)));

//C
esClient.addTransportAddress(new InetSocketTransportAddress(
InetAddress.getByName('192.168.1.13'), Integer.parseInt(9300)));

//D
esClient.addTransportAddress(new InetSocketTransportAddress(
InetAddress.getByName('192.168.1.14'), Integer.parseInt(9300)));

贴上elasticsearch.yml配置(四台除了ip和节点名称不同,其他配置一样)

cluster.name: data
network.host: 192.168.1.14
transport.tcp.port: 9300 
http.port: 9200

请问这样能实现集群吗?
SearchRequestBuilder prepareSearch = esClient.prepareSearch();
prepareSearch搜索的是所有的吗?

我猜想应该是可以实现集群吧?

但我的搜索的时候,发现出现这样奇怪的规律,一下数据多,一下数据少,一下数据多,一下数据少。 请问这是什么原因

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.