阐述了EFK的data/ingest/master角色的用途及分别部署三节点,在实现性能最大化的同时保障高可用
elasticsearch-data
安装
3台均执行相同的安装步骤
1 | tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz |
elasticsearch-data配置
1 | # 192.168.1.51 /opt/elasticsearch/config/elasticsearch.yml |
elasticsearch-data启动
1 | sudo -u elasticsearch /opt/elasticsearch/bin/elasticsearch |
elasticsearch集群状态
1 | curl "http://192.168.1.31:9200/_cat/health?v" |
elasticsearch-data状态
1 | curl "http://192.168.1.31:9200/_cat/nodes?v" |
elasticsearch-data参数说明
1 | status: green # 集群健康状态 |
elasticsearch-ingest
新增三台ingest节点加入集群,同时关闭master和data功能
elasticsearch-ingest安装
3台es均执行相同的安装步骤
1 | tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz |
elasticsearch-ingest配置
1 | # 192.168.1.41 /opt/elasticsearch/config/elasticsearch.yml |
elasticsearch-ingest启动
1 | sudo -u elasticsearch /opt/elasticsearch/bin/elasticsearch |
elasticsearch集群状态
1 | curl "http://192.168.1.31:9200/_cat/health?v" |
elasticsearch-ingest状态
1 | curl "http://192.168.1.31:9200/_cat/nodes?v" |
elasticsearch-ingest参数说明
1 | status: green # 集群健康状态 |
curl -X PUT "192.168.1.31:9200/*/_settings?pretty" -H 'Content-Type: application/json' -d'
{
"index.routing.allocation.include._ip": "192.168.1.51,192.168.1.52,192.168.1.53"
}'
1 | ## 确认当前索引存储位置 |
curl "http://192.168.1.31:9200/_cat/shards?h=n"
1 | ## elasticsearch-master配置 |
192.168.1.31 /opt/elasticsearch/config/elasticsearch.yml
cluster.name: my-application
node.name: 192.168.1.31
path.logs: /opt/logs/elasticsearch
network.host: 192.168.1.31
discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]
cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]
http.cors.enabled: true
http.cors.allow-origin: "*"
#开启master功能
node.master: true
#关闭ingest功能
node.ingest: false
#关闭data功能
node.data: false
192.168.1.32 /opt/elasticsearch/config/elasticsearch.yml
cluster.name: my-application
node.name: 192.168.1.32
path.logs: /opt/logs/elasticsearch
network.host: 192.168.1.32
discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]
cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]
http.cors.enabled: true
http.cors.allow-origin: "*"
#开启master功能
node.master: true
#关闭ingest功能
node.ingest: false
#关闭data功能
node.data: false
192.168.1.33 /opt/elasticsearch/config/elasticsearch.yml
cluster.name: my-application
node.name: 192.168.1.33
path.logs: /opt/logs/elasticsearch
network.host: 192.168.1.33
discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]
cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]
http.cors.enabled: true
http.cors.allow-origin: "*"
#开启master功能
node.master: true
#关闭ingest功能
node.ingest: false
#关闭data功能
node.data: false
1 | ## elasticsearch集群状态 |
curl "http://192.168.1.31:9200/_cat/health?v"
1 | ## elasticsearch-master状态 |
curl "http://192.168.1.31:9200/_cat/nodes?v"
`
至此,当node.role里所有服务器都不再出现“mid”,则表示一切顺利完成。