久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

ElasticSearch如何進行角色分離部署

218次閱讀
沒有評論

共計 7443 個字符,預計需要花費 19 分鐘才能閱讀完成。

這篇文章給大家介紹 ElasticSearch 如何進行角色分離部署,內容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。

ES 的架構為三節點,即 master、ingest、data 角色同時部署在三臺服務器上。

下面將進行角色分離部署,并且每個角色分別部署三節點,在實現性能最大化的同時保障高可用。

? elasticsearch 的 master 節點:用于調度,采用普通性能服務器來部署

? elasticsearch 的 ingest 節點:用于數據預處理,采用性能好的服務器來部署

? elasticsearch 的 data 節點:用于數據落地存儲,采用存儲性能好的服務器來部署

架構

服務器配置

注意:此處的架構是之前的文章《EFK 教程 – 快速入門指南》的拓展,因此請先按照《EFK 教程 – 快速入門指南》完成部署

步驟說明

1?? 部署 3 臺 data 節點,加入原集群

2?? 部署 3 臺 ingest 節點,加入原集群

3?? 將原有的 es 索引遷移到 data 節點

4?? 將原有的 es 節點改造成 master 節點

elasticsearch-data 部署

之前已完成了基礎的 elasticsearch 架構,現需要新增三臺存儲節點加入集群,同時關閉 master 和 ingest 功能

elasticsearch-data 安裝:3 臺均執行相同的安裝步驟

tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz
mv elasticsearch-7.3.2 /opt/elasticsearch
useradd elasticsearch -d /opt/elasticsearch -s /sbin/nologin
mkdir -p /opt/logs/elasticsearch
chown elasticsearch.elasticsearch /opt/elasticsearch -R
chown elasticsearch.elasticsearch /opt/logs/elasticsearch -R
#  數據盤需要 elasticsearch 寫權限
chown elasticsearch.elasticsearch /data/SAS -R
#  限制一個進程可以擁有的 VMA(虛擬內存區域) 的數量要超過 262144,不然 elasticsearch 會報 max virtual memory areas vm.max_map_count [65535] is too low, increase to at least [262144]
echo  vm.max_map_count = 655350    /etc/sysctl.conf
sysctl -p

elasticsearch-data 配置

? 192.168.1.51 /opt/elasticsearch/config/elasticsearch.yml

cluster.name: my-application
node.name: 192.168.1.51
#  數據盤位置,如果有多個硬盤位置,用 , 隔開
path.data: /data/SAS
path.logs: /opt/logs/elasticsearch
network.host: 192.168.1.51
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: false
#  關閉 ingest 功能
node.ingest: false
#  開啟 data 功能
node.data: true

? 192.168.1.52 /opt/elasticsearch/config/elasticsearch.yml

cluster.name: my-application
node.name: 192.168.1.52
#  數據盤位置,如果有多個硬盤位置,用 , 隔開
path.data: /data/SAS
path.logs: /opt/logs/elasticsearch
network.host: 192.168.1.52
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: false
#  關閉 ingest 功能
node.ingest: false
#  開啟 data 功能
node.data: true

? 192.168.1.53 /opt/elasticsearch/config/elasticsearch.yml

cluster.name: my-application
node.name: 192.168.1.53
#  數據盤位置,如果有多個硬盤位置,用 , 隔開
path.data: /data/SAS
path.logs: /opt/logs/elasticsearch
network.host: 192.168.1.53
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: false
#  關閉 ingest 功能
node.ingest: false
#  開啟 data 功能
node.data: true

elasticsearch-data 啟動

sudo -u elasticsearch /opt/elasticsearch/bin/elasticsearch

elasticsearch 集群狀態

curl  http://192.168.1.31:9200/_cat/health?v

elasticsearch-data 狀態

curl  http://192.168.1.31:9200/_cat/nodes?v

elasticsearch-data 參數說明

status: green #  集群健康狀態
node.total: 6 #  有 6 臺機子組成集群
node.data: 6 #  有 6 個節點的存儲
node.role: d #  只擁有 data 角色
node.role: i #  只擁有 ingest 角色
node.role: m #  只擁有 master 角色
node.role: mid #  擁 master、ingest、data 角色 

elasticsearch-ingest 部署

現需要新增三臺 ingest 節點加入集群,同時關閉 master 和 data 功能

elasticsearch-ingest 安裝:3 臺 es 均執行相同的安裝步驟

tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz
mv elasticsearch-7.3.2 /opt/elasticsearch
useradd elasticsearch -d /opt/elasticsearch -s /sbin/nologin
mkdir -p /opt/logs/elasticsearch
chown elasticsearch.elasticsearch /opt/elasticsearch -R
chown elasticsearch.elasticsearch /opt/logs/elasticsearch -R
#  限制一個進程可以擁有的 VMA(虛擬內存區域) 的數量要超過 262144,不然 elasticsearch 會報 max virtual memory areas vm.max_map_count [65535] is too low, increase to at least [262144]
echo  vm.max_map_count = 655350    /etc/sysctl.conf
sysctl -p

elasticsearch-ingest 配置

? 192.168.1.41 /opt/elasticsearch/config/elasticsearch.yml

cluster.name: my-application
node.name: 192.168.1.41
path.logs: /opt/logs/elasticsearch
network.host: 192.168.1.41
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: false
#  開啟 ingest 功能
node.ingest: true
#  關閉 data 功能
node.data: false

? 192.168.1.42 /opt/elasticsearch/config/elasticsearch.yml

cluster.name: my-application
node.name: 192.168.1.42
path.logs: /opt/logs/elasticsearch
network.host: 192.168.1.42
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: false
#  開啟 ingest 功能
node.ingest: true
#  關閉 data 功能
node.data: false

? 192.168.1.43 /opt/elasticsearch/config/elasticsearch.yml

cluster.name: my-application
node.name: 192.168.1.43
path.logs: /opt/logs/elasticsearch
network.host: 192.168.1.43
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: false
#  開啟 ingest 功能
node.ingest: true
#  關閉 data 功能
node.data: false

elasticsearch-ingest 啟動

sudo -u elasticsearch /opt/elasticsearch/bin/elasticsearch

elasticsearch 集群狀態

curl  http://192.168.1.31:9200/_cat/health?v

elasticsearch-ingest 狀態

curl  http://192.168.1.31:9200/_cat/nodes?v

elasticsearch-ingest 參數說明

status: green #  集群健康狀態
node.total: 9 #  有 9 臺機子組成集群
node.data: 6 #  有 6 個節點的存儲
node.role: d #  只擁有 data 角色
node.role: i #  只擁有 ingest 角色
node.role: m #  只擁有 master 角色
node.role: mid #  擁 master、ingest、data 角色 

elasticsearch-master 部署

首先,將上一篇《EFK 教程 – 快速入門指南》中部署的 3 臺 es(192.168.1.31、192.168.1.32、192.168.1.33)改成只有 master 的功能,因此需要先將這 3 臺上的索引數據遷移到本次所做的 data 節點中

1?? 索引遷移:一定要做這步,將之前的索引放到 data 節點上

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 
}

2?? 確認當前索引存儲位置:確認所有索引不在 192.168.1.31、192.168.1.32、192.168.1.33 節點上

curl  http://192.168.1.31:9200/_cat/shards?h=n

elasticsearch-master 配置

注意事項:修改配置,重啟進程,需要一臺一臺執行,要確保第一臺成功后,再執行下一臺。重啟進程的方法:由于上一篇文章《EFK 教程 – 快速入門指南》里,是執行命令跑在前臺,因此直接 ctrl – c 退出再啟動即可,啟動命令如下

sudo -u elasticsearch /opt/elasticsearch/bin/elasticsearch

? 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

elasticsearch 集群狀態

curl  http://192.168.1.31:9200/_cat/health?v

elasticsearch-master 狀態

curl  http://192.168.1.31:9200/_cat/nodes?v

至此,當 node.role 里所有服務器都不再出現“mid”,則表示一切順利完成。

關于 ElasticSearch 如何進行角色分離部署就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-08-16發表,共計7443字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 民权县| 固始县| 四子王旗| 岳阳市| 盘山县| 合江县| 安顺市| 桂平市| 南通市| 永定县| 高阳县| 邻水| 朝阳市| 井研县| 海城市| 沽源县| 咸丰县| 海兴县| 洪雅县| 合水县| 绥棱县| 富裕县| 平原县| 巴塘县| 新巴尔虎左旗| 三穗县| 皮山县| 棋牌| 曲水县| 宁陵县| 济宁市| 龙陵县| 昌邑市| 抚远县| 贡觉县| 崇仁县| 车险| 吉首市| 泊头市| 永定县| 若尔盖县|