1. 全部解压,修改配置文件

      1. # 集群名称,节点之间要保持一致
      2. cluster.name: my-elasticsearch
      3. # 节点名称,集群内要唯一
      4. node.name: node-1
      5. # 是否可以成为主节点
      6. node.master: true
      7. # 是否是数据节点
      8. node.data: true
      9. # ip地址,也可以是虚拟机别名
      10. network.host: 192.168.58.128
      11. # rest http api端口
      12. http.port: 9201
      13. # 组件内通讯 tcp 监听端口
      14. transport.tcp.port: 9301
      15. # 跨域配置
      16. http.cors.enabled: true
      17. http.cors.allow-origin: "*"
      18. # host:后面写的是主机和从机的别名,也可以写IP地址,此处,主机和从机的配置相同
      19. # discovery.zen.ping.unicast.hosts: ["192.168.58.128", "192.168.58.132"]
      20. # 锁住物理内存,不使用swap内存,有swap内存的可以开启此项
      21. bootstrap.memory_lock: true
      22. # 自动发现ping其他节点超时时间
      23. discovery.zen.ping_timeout: 150s
      24. # 主节点是哪一个
      25. cluster.initial_master_nodes: ["node-1"]
    2. 启动

      1. su - elastic -c "cd /opt/application/elasticsearch-7.8.0 && ./bin/elasticsearch &"
    3. 多个节点都启动

    4. get``[http://192.168.58.128:9200/_cat/nodes](http://192.168.58.128:9200/_cat/nodes),表明集群搭建成功

    image.png