Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_29556507/article/details/89637924
My environment is ubuntu16.04 memory 2g
I configured the two machines, but the best suggestion is N / 2 + 1 nodes
This is the official website detailed data configuration
https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html
This is a detailed official java client's network
https://www.elastic.co/guide/en/elasticsearch/reference/current/integration-tests.html
I have two machines configuration
这个是 192.168.1.116:9300 从节点
cluster.name: elasticsearchkplbug
node.name: node-2
network.host: 0.0.0.0
http.port: 9200
node.master: false
# node.data: true
discovery.seed_hosts:
- 192.168.1.117:9300
- 192.168.1.116:9300
cluster.initial_master_nodes:
- 192.168.1.116:9300
这个是 192.168.1.117:9300 主节点
cluster.name: elasticsearchkplbug
node.name: node-2
network.host: 0.0.0.0
http.port: 9200
# node.master: true
# node.data: true
discovery.seed_hosts:
- 192.168.1.117:9300
- 192.168.1.116:9300
cluster.initial_master_nodes:
- 192.168.1.116:9300
The java maven configuration
<dependencies>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.7.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>6.7.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.54</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>transport-netty4-client</artifactId>
<version>6.7.0</version>
</dependency>
</dependencies>
If you are not a stand-alone configuration, you can refer to my article
elasticsearch7.0 single building problems encountered