直接下载解压包,复制三份,删除每一份中的data数据文件夹,以及logs文件加里面的日志

    1. #节点 1 的配置信息:
    2. #集群名称,节点之间要保持一致
    3. cluster.name: my-elasticsearch
    4. #节点名称,集群内要唯一
    5. node.name: node-1001
    6. node.master: true
    7. node.data: true
    8. #ip 地址
    9. network.host: localhost
    10. #http 端口
    11. http.port: 1001
    12. #tcp 监听端口
    13. transport.tcp.port: 9301
    14. #discovery.seed_hosts: ["localhost:9301", "localhost:9302","localhost:9303"]
    15. #discovery.zen.fd.ping_timeout: 1m
    16. #discovery.zen.fd.ping_retries: 5
    17. #集群内的可以被选为主节点的节点列表
    18. #cluster.initial_master_nodes: ["node-1", "node-2","node-3"]
    19. #跨域配置
    20. #action.destructive_requires_name: true
    21. http.cors.enabled: true
    22. http.cors.allow-origin: "*"
    1. #节点 2 的配置信息:
    2. #集群名称,节点之间要保持一致
    3. cluster.name: my-elasticsearch
    4. #节点名称,集群内要唯一
    5. node.name: node-1002
    6. node.master: true
    7. node.data: true
    8. #ip 地址
    9. network.host: localhost
    10. #http 端口
    11. http.port: 1002
    12. #tcp 监听端口
    13. transport.tcp.port: 9302
    14. # 把当前节点接入到前一个节点中
    15. discovery.seed_hosts: ["localhost:9301"]
    16. discovery.zen.fd.ping_timeout: 1m
    17. discovery.zen.fd.ping_retries: 5
    18. #集群内的可以被选为主节点的节点列表
    19. #cluster.initial_master_nodes: ["node-1", "node-2","node-3"]
    20. #跨域配置
    21. #action.destructive_requires_name: true
    22. http.cors.enabled: true
    23. http.cors.allow-origin: "*"
    1. #节点 3 的配置信息:
    2. #集群名称,节点之间要保持一致
    3. cluster.name: my-elasticsearch
    4. #节点名称,集群内要唯一
    5. node.name: node-1003
    6. node.master: true
    7. node.data: true
    8. #ip 地址
    9. network.host: localhost
    10. #http 端口
    11. http.port: 1003
    12. #tcp 监听端口
    13. transport.tcp.port: 9303
    14. #候选主节点的地址,在开启服务后可以被选为主节点
    15. discovery.seed_hosts: ["localhost:9301", "localhost:9302"]
    16. discovery.zen.fd.ping_timeout: 1m
    17. discovery.zen.fd.ping_retries: 5
    18. #集群内的可以被选为主节点的节点列表
    19. #cluster.initial_master_nodes: ["node-1", "node-2","node-3"]
    20. #跨域配置
    21. #action.destructive_requires_name: true
    22. http.cors.enabled: true
    23. http.cors.allow-origin: "*"

    依次启动三个节点,双击bin/elasticsearch.bat启动
    然后查看集群健康状态
    http://127.0.0.1:1001/_cluster/health
    image.png

    状态 说明
    green 所有的主分片和副分片都正常运行
    yellow 所有的主分片都正常运行,但不是所有的副分片都正常运行
    red 有主分片没有正常运行