ElasticSearch7.9.3 windows单机-集群

1.创建elasticsearch-cluster文件夹,在内部复制三个elasticsearch服务

2.修改集群文件目录中第一个节点的config/elasticsearch.yml配置文件

参数说明
1cluster.namemy-application集群名称,节点之间保持一致
2node.namenode-1001节点名称,集群内要唯一
3node.mastertrue
4node.datatrue
5network.hostlocalhostIP
6http:port9201http:端口
7transport.tcp.port9301Tcp监听端口
8discovery.zen.fd.ping_timeout
9discovery.zen.fd.ping_retries
10discovery.seed_hosts
11http.cors.enabledtrue跨域配置
12http.cors.allow-origin“*”

3.执行 bin/elasticsearch.bat, 启动节点服务器,启动后,会自动加入指定名称的集群

4.启动node-1001后,查看集群状态

  在Postman中向ES服务器发,GET: http://localhost:9201/_cluster/health  

{
    "cluster_name": "my-application",
    "status": "green",
    "timed_out": false,
    "number_of_nodes": 1,
    "number_of_data_nodes": 1,
    "active_primary_shards": 0,
    "active_shards": 0,
    "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
}

5.修改集群文件目录中第二个节点的config/elasticsearch.yml配置文件

参数说明
1cluster.namemy-application集群名称,节点之间保持一致
2node.namenode-1002节点名称,集群内要唯一
3node.mastertrue
4node.datatrue
5network.hostlocalhostIP
6http:port9202http:端口
7transport.tcp.port9302Tcp监听端口
8discovery.zen.fd.ping_timeout
9discovery.zen.fd.ping_retries
10discovery.seed_hosts["localhost:9301"]
11http.cors.enabledtrue跨域配置
12http.cors.allow-origin“*”

6.启动node-1002后,查看集群状态

  在Postman中向ES服务器发,GET: http://localhost:9201/_cluster/health

{
    "cluster_name": "my-application",
    "status": "green",
    "timed_out": false,
    "number_of_nodes": 2,
    "number_of_data_nodes": 2,
    "active_primary_shards": 0,
    "active_shards": 0,
    "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
}

7.修改集群文件目录中第三个节点的config/elasticsearch.yml配置文件

参数说明
1cluster.namemy-application集群名称,节点之间保持一致
2node.namenode-1003节点名称,集群内要唯一
3node.mastertrue
4node.datatrue
5network.hostlocalhostIP
6http:port9203http:端口
7transport.tcp.port9303Tcp监听端口
8discovery.zen.fd.ping_timeout这个节点时间太短容易找不到Master
9discovery.zen.fd.ping_retries
10discovery.seed_hosts["localhost:9301","localhost:9302"]
11http.cors.enabledtrue跨域配置
12http.cors.allow-origin“*”

8.启动node-1003后,查看集群状态

  在Postman中向ES服务器发,GET: 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": 0,
    "active_shards": 0,
    "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
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wang_peng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值