1.解压es的zip压缩包,解压出来三份

image.png

2.配置每份的elasticsearch.yml配置文件

  1. cluster.name: my-application
  2. node.name: node-1
  3. node.master: true
  4. node.data: true
  5. path.data: .\path\to\data
  6. path.logs: .\path\to\logs
  7. network.host: 0.0.0.0
  8. http.port: 9200
  9. transport.tcp.port: 9300
  10. discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301","localhost:9302"]
  11. discovery.zen.minimum_master_nodes: 2
  1. cluster.name: my-application
  2. node.name: node-2
  3. node.master: true
  4. node.data: true
  5. path.data: .\path\to\data
  6. path.logs: .\path\to\logs
  7. network.host: 0.0.0.0
  8. http.port: 9201
  9. transport.tcp.port: 9301
  10. discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301","localhost:9302"]
  11. discovery.zen.minimum_master_nodes: 2
  1. cluster.name: my-application
  2. node.name: node-3
  3. node.master: true
  4. node.data: true
  5. path.data: .\path\to\data
  6. path.logs: .\path\to\logs
  7. network.host: 0.0.0.0
  8. http.port: 9202
  9. transport.tcp.port: 9302
  10. discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301","localhost:9302"]
  11. discovery.zen.minimum_master_nodes: 2

3.启动即可

image.png

4.配置文件解释

  1. #指定集群名称
  2. cluster.name: my-application
  3. #指定节点名称
  4. node.name: node-3
  5. #指定节点是否可以是master,默认不配置也是true
  6. node.master: true
  7. #指定节点是否可以存储数据,默认不配置也是true
  8. node.data: true
  9. #数据存储位置
  10. path.data: .\path\to\data
  11. #日志存储位置
  12. path.logs: .\path\to\logs
  13. #通过哪个ip可以访问到es
  14. network.host: 0.0.0.0
  15. #RESTful接口的端口
  16. http.port: 9202
  17. #节点节互相通信的端口
  18. transport.tcp.port: 9302
  19. #种子节点八卦节点,配置master-eligible节点
  20. discovery.zen.ping.unicast.hosts: ["localhost:9300", "localhost:9301","localhost:9302"]
  21. #最小的master-eligible节点存活数量,小于这个值,集群不可写操作
  22. discovery.zen.minimum_master_nodes: 2