Elasticsearch集群部署(windows)

一、环境介绍

  1. 系统:Windows10
  2. elasticSearch版本:6.5.4
  3. 节点3个:127.0.0.1:9200,127.0.0.1:9201,127.0.0.1:9202

二、插件下载

ES下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch
下载完成后,把elasticsearch-6.5.4.zip解压成-a、-b、-c的三个文件
elasticSearch三个
kibana下载地址:https://www.elastic.co/cn/downloads/past-releases#kibana

三、修改配置文件

1、修改elasticsearch-6.5.4-a配置

#如果要配置集群需要两个节点上的elasticsearch配置的cluster.name相同,都启动可以自动组成集群,默认my-application
cluster.name: my-application
#是否作为主机
node.master: true
#指定该节点是否存储索引数据,默认为true
node.data: false
#随意取但是集群内的各节点不能相同
node.name: node-1
bootstrap.memory_lock: true
network.host: 0.0.0.0
# Set a custom port for HTTP:
http.port: 9200
#节点间交互的tcp 端口
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300","127.0.0.1:9301", "127.0.0.1:9302"]
#保证集群中的节点可以知道其它N个有master资格的节点。默认为1
discovery.zen.minimum_master_nodes: 2
## 是否支持跨域 和允许的域范围,默认为* 所有,可用正则匹配
http.cors.enabled: true
http.cors.allow-origin: "*"
## 禁用xpack安全机制
xpack.security.enabled: false
## 是否开启监控
xpack.monitoring.enabled: true
## 收集集群统计信息的超时。默认为10s
xpack.monitoring.collection.cluster.stats.timeout: 10s
## index 缓冲区大小 
indices.memory.index_buffer_size: 20%
## 传输流量最大值
indices.recovery.max_bytes_per_sec: 10000mb
## 节点fielddata 的最大内存,达到则交换旧数据,建议设置小一点
indices.fielddata.cache.size: 10%
## fielddata限制大小,一定要大于cache 大小
indices.breaker.fielddata.limit: 60%
## request数量使用内存限制,默认为JVM堆的40%
indices.breaker.request.limit: 60%
## 所有breaker使用的内存值,默认值为 JVM 堆内存的70%,当内存达到最高值时会触发内存回收
indices.breaker.total.limit: 80%
## 动作自动创建索引
action.auto_create_index: true

2、修改elasticsearch-6.5.4-b配置

#指定该节点是否存储索引数据,默认为true
node.data: true
#随意取但是集群内的各节点不能相同
node.name: node-2
bootstrap.memory_lock: true
network.host: 0.0.0.0
# Set a custom port for HTTP:
http.port: 9201
#节点间交互的tcp 端口
transport.tcp.port: 9301
其他的一样

3、修改elasticsearch-6.5.4-c配置

#指定该节点是否存储索引数据,默认为true
node.data: true
#随意取但是集群内的各节点不能相同
node.name: node-3
# Set a custom port for HTTP:
http.port: 9202
#节点间交互的tcp 端口
transport.tcp.port: 9302
其他的一样

3、修改kibana配置

server.port: 5601
server.host: "localhost"
elasticsearch.url: "http://localhost:9200"
xpack.security.enabled: false

四、编写启动脚本

@echo off
	start "node-a" cmd /k "cd /d E:\a-toolsStudy\elasticsearch\elasticsearch-6.5.4-a\bin && CHCP 65001 && elasticsearch.bat"
	start "node-b" cmd /k "cd /d E:\a-toolsStudy\elasticsearch\elasticsearch-6.5.4-b\bin && CHCP 65001 && elasticsearch.bat"
	start "node-c" cmd /k "cd /d E:\a-toolsStudy\elasticsearch\elasticsearch-6.5.4-c\bin && CHCP 65001 && elasticsearch.bat"
	start "kibana" cmd /k "cd /d E:\a-toolsStudy\elasticsearch\kibana-6.5.4-windows-x86_64\bin && kibana.bat"
@pause

五、结果验证

1、查看个节点情况:http://127.0.0.1:9201/_cat/nodes?v
2、验证集群健康: http://localhost:9200/_cat/health
3、验证kibana:http://localhost:5601/
在这里插入图片描述
4、注意的问题

kibana启动报错msg:{“type”:“log”,"@timestamp":“2019-12-11T08:03:14Z”,“tags”:[“warning”,“migrations”],“pid”:1,“message”:“Another Kibana instance appears to be migrating the index. Waiting for that migration to complete. If no other Kibana instance is attempting migrations, you can get past this message by deleting index .kibana_1 and restarting Kibana.”}
解决方案:curl -XDELETE http://localhost:9200/.kibana_1

六、 整合springboot(待续)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值