1、复制3份ES文件:
2、分别对node1、node2、node3修改config/elasticsearch.yml
node1:
cluster.name: my-application
network.host: localhost
http.port: 9201
transport.tcp.port: 9301
node.name: node-1
node.master: true
node.data: true
http.cors.enabled: true
http.cors.allow-origin: "*"
node2:
cluster.name: my-application
network.host: localhost
http.port: 9202
transport.tcp.port: 9302
node.name: node-2
node.master: true
node.data: true
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["localhost:9301"]
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5
node3:
cluster.name: my-application
network.host: localhost
http.port: 9203
transport.tcp.port: 9303
node.name: node-3
node.master: true
node.data: true
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["localhost:9301","localhost:9302"]
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5
3、分别启动node1、node2、node3
启动bin/elasticsearch.bat
4、启动完成后,可以查看集群状态:
访问:http://localhost:9201/_cluster/health
{
"cluster_name": "my-application",
"status": "green",
"timed_out": false,
"number_of_nodes": 3,
"number_of_data_nodes": 3,
"active_primary_shards": 2,
"active_shards": 4,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 0,
"delayed_unassigned_shards": 0,
"number_of_pending_tasks": 0,
"number_of_in_flight_fetch": 0,
"task_max_waiting_in_queue_millis": 0,
"active_shards_percent_as_number": 100.0
}
"status": "green",
"number_of_data_nodes": 3,
表示集群配置成功。