ElasticSearch window 服务器扩容

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

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

参数说明
1cluster.namemy-application集群名称,节点之间保持一致
2node.namenode-1001节点名称,集群内要唯一
3discovery.seed_hosts["192.168.2.3:9301","192.168.2.3:9302","192.168.2.3:9303"]
4cluster.initial_master_nodes["192.168.2.3:9301"]maste节点必须有
5network.host0.0.0.0IP
6http:port9201http:端口
7transport.tcp.port9301Tcp监听端口
8bootstrap.memory_locktrue
9bootstrap.system_call_filterfalse
10http.cors.enabledtrue跨域配置
11http.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节点名称,集群内要唯一
3discovery.seed_hosts["192.168.2.3:9301","192.168.2.3:9302","192.168.2.3:9303"]
4cluster.initial_master_nodes["192.168.2.3:9301"]maste节点必须有
5network.host0.0.0.0IP
6http:port9202http:端口
7transport.tcp.port9302Tcp监听端口
8bootstrap.memory_locktrue
9bootstrap.system_call_filterfalse
10http.cors.enabledtrue跨域配置
11http.cors.allow-origin“*”
12

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节点名称,集群内要唯一
3discovery.seed_hosts["192.168.2.3:9301","192.168.2.3:9302","192.168.2.3:9303"]
4cluster.initial_master_nodes["192.168.2.3:9301"]maste节点必须有
5network.host0.0.0.0IP
6http:port9203http:端口
7transport.tcp.port9303Tcp监听端口
8bootstrap.memory_locktrue
9bootstrap.system_call_filterfalse
10http.cors.enabledtrue跨域配置
11http.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
}

9. discovery.seed_hosts值最少是填写3个,少了运行不起来,如果每个节点都是一台服务器,可以把端口呈去掉按默认9300即可

10.如想添加第4个节点,配置如下:

参数说明
1cluster.namemy-application集群名称,节点之间保持一致
2node.namenode-1004节点名称,集群内要唯一
3discovery.seed_hosts

["192.168.2.3:9301","192.168.2.3:9302"

,"192.168.2.3:9303","192.168.2.3:9304"]

4cluster.initial_master_nodes["192.168.2.3:9301"]maste节点必须有
5network.host0.0.0.0IP
6http:port9204http:端口
7transport.tcp.port9304Tcp监听端口
8bootstrap.memory_locktrue
9bootstrap.system_call_filterfalse
10http.cors.enabledtrue跨域配置
11http.cors.allow-origin“*”

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

wang_peng

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

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

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

打赏作者

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

抵扣说明:

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

余额充值