zoukankan      html  css  js  c++  java
  • ES 数据节点、协调节点、master节点高性能高可用搭建二

    目录

    ▪ 用途 ▪ 架构 ▪ 步骤说明 ▪ elasticsearch-data部署 ▪ elasticsearch-ingest部署 ▪ elasticsearch-master部署


    用途

    在第一篇《EFK教程 - 快速入门指南》中,阐述了EFK的安装部署,其中ES的架构为三节点,即master、ingest、data角色同时部署在三台服务器上。

    在本文中,将进行角色分离部署,并且每个角色分别部署三节点,在实现性能最大化的同时保障高可用。

    ▷ elasticsearch的master节点:用于调度,采用普通性能服务器来部署 ▷ elasticsearch的ingest节点:用于数据预处理,采用性能好的服务器来部署 ▷ elasticsearch的data节点:用于数据落地存储,采用存储性能好的服务器来部署

    1. 若不知道去哪找《EFK教程 - 快速入门指南》,可在主流搜索引擎里搜索:

    2. 小慢哥 EFK教程 快速入门指南

    3. 或者

    4. 小慢哥 EFK教程 基于多节点ESEFK安装部署配置


    架构

    服务器配置

    注意:此处的架构是之前的文章《EFK教程 - 快速入门指南》的拓展,因此请先按照《EFK教程 - 快速入门指南》完成部署


    步骤说明

    1️⃣ 部署3台data节点,加入原集群 2️⃣ 部署3台ingest节点,加入原集群 3️⃣ 将原有的es索引迁移到data节点 4️⃣ 将原有的es节点改造成master节点


    elasticsearch-data部署

    之前已完成了基础的elasticsearch架构,现需要新增三台存储节点加入集群,同时关闭master和ingest功能

    elasticsearch-data安装:3台均执行相同的安装步骤

    1. tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz

    2. mv elasticsearch-7.3.2 /opt/elasticsearch

    3. useradd elasticsearch -d /opt/elasticsearch -s /sbin/nologin

    4. mkdir -p /opt/logs/elasticsearch

    5. chown elasticsearch.elasticsearch /opt/elasticsearch -R

    6. chown elasticsearch.elasticsearch /opt/logs/elasticsearch -R

    7. # 数据盘需要elasticsearch写权限

    8. chown elasticsearch.elasticsearch /data/SAS -R

    9. # 限制一个进程可以拥有的VMA(虚拟内存区域)的数量要超过262144,不然elasticsearch会报max virtual memory areas vm.max_map_count [65535] is too low, increase to at least [262144]

    10. echo "vm.max_map_count = 655350" >> /etc/sysctl.conf

    11. sysctl -p

    elasticsearch-data配置

    ▷ 192.168.1.51 /opt/elasticsearch/config/elasticsearch.yml

    1. cluster.name: my-application

    2. node.name: 192.168.1.51

    3. # 数据盘位置,如果有多个硬盘位置,用","隔开

    4. path.data: /data/SAS

    5. path.logs: /opt/logs/elasticsearch

    6. network.host: 192.168.1.51

    7. discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    8. cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    9. http.cors.enabled: true

    10. http.cors.allow-origin: "*"

    11. # 关闭master功能

    12. node.master: false

    13. # 关闭ingest功能

    14. node.ingest: false

    15. # 开启data功能

    16. node.data: true

    ▷ 192.168.1.52 /opt/elasticsearch/config/elasticsearch.yml

    1. cluster.name: my-application

    2. node.name: 192.168.1.52

    3. # 数据盘位置,如果有多个硬盘位置,用","隔开

    4. path.data: /data/SAS

    5. path.logs: /opt/logs/elasticsearch

    6. network.host: 192.168.1.52

    7. discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    8. cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    9. http.cors.enabled: true

    10. http.cors.allow-origin: "*"

    1. # 关闭master功能

    2. node.master: false

    3. # 关闭ingest功能

    4. node.ingest: false

    5. # 开启data功能

    6. node.data: true

    ▷ 192.168.1.53 /opt/elasticsearch/config/elasticsearch.yml

    1. cluster.name: my-application

    2. node.name: 192.168.1.53

    3. # 数据盘位置,如果有多个硬盘位置,用","隔开

    4. path.data: /data/SAS

    5. path.logs: /opt/logs/elasticsearch

    6. network.host: 192.168.1.53

    7. discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    8. cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    9. http.cors.enabled: true

    10. http.cors.allow-origin: "*"

    11. # 关闭master功能

    12. node.master: false

    13. # 关闭ingest功能

    14. node.ingest: false

    15. # 开启data功能

    16. node.data: true

    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 # 集群健康状态

    2. node.total: 6 # 有6台机子组成集群

    3. node.data: 6 # 有6个节点的存储

    4. node.role: d # 只拥有data角色

    5. node.role: i # 只拥有ingest角色

    6. node.role: m # 只拥有master角色

    7. node.role: mid # 拥master、ingest、data角色


    elasticsearch-ingest部署

    现需要新增三台ingest节点加入集群,同时关闭master和data功能

    elasticsearch-ingest安装:3台es均执行相同的安装步骤

    1. tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz

    2. mv elasticsearch-7.3.2 /opt/elasticsearch

    3. useradd elasticsearch -d /opt/elasticsearch -s /sbin/nologin

    4. mkdir -p /opt/logs/elasticsearch

    5. chown elasticsearch.elasticsearch /opt/elasticsearch -R

    6. chown elasticsearch.elasticsearch /opt/logs/elasticsearch -R

    7. # 限制一个进程可以拥有的VMA(虚拟内存区域)的数量要超过262144,不然elasticsearch会报max virtual memory areas vm.max_map_count [65535] is too low, increase to at least [262144]

    8. echo "vm.max_map_count = 655350" >> /etc/sysctl.conf

    9. sysctl -p

    elasticsearch-ingest配置

    ▷ 192.168.1.41 /opt/elasticsearch/config/elasticsearch.yml

    1. cluster.name: my-application

    2. node.name: 192.168.1.41

    3. path.logs: /opt/logs/elasticsearch

    4. network.host: 192.168.1.41

    5. discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    6. cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    7. http.cors.enabled: true

    8. http.cors.allow-origin: "*"

    9. # 关闭master功能

    10. node.master: false

    11. # 开启ingest功能

    12. node.ingest: true

    13. # 关闭data功能

    14. node.data: false

    ▷ 192.168.1.42 /opt/elasticsearch/config/elasticsearch.yml

    1. cluster.name: my-application

    2. node.name: 192.168.1.42

    3. path.logs: /opt/logs/elasticsearch

    4. network.host: 192.168.1.42

    5. discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    6. cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    7. http.cors.enabled: true

    8. http.cors.allow-origin: "*"

    9. # 关闭master功能

    10. node.master: false

    11. # 开启ingest功能

    12. node.ingest: true

    13. # 关闭data功能

    14. node.data: false

    ▷ 192.168.1.43 /opt/elasticsearch/config/elasticsearch.yml

    1. cluster.name: my-application

    2. node.name: 192.168.1.43

    3. path.logs: /opt/logs/elasticsearch

    4. network.host: 192.168.1.43

    5. discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    6. cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    7. http.cors.enabled: true

    8. http.cors.allow-origin: "*"

    9. # 关闭master功能

    10. node.master: false

    11. # 开启ingest功能

    12. node.ingest: true

    13. # 关闭data功能

    14. node.data: false

    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 # 集群健康状态

    2. node.total: 9 # 有9台机子组成集群

    3. node.data: 6 # 有6个节点的存储

    4. node.role: d # 只拥有data角色

    5. node.role: i # 只拥有ingest角色

    6. node.role: m # 只拥有master角色

    7. 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节点上

    1. curl -X PUT "192.168.1.31:9200/*/_settings?pretty" -H 'Content-Type: application/json' -d'

    2. {

    3. "index.routing.allocation.include._ip": "192.168.1.51,192.168.1.52,192.168.1.53"

    4. }'

    2️⃣ 确认当前索引存储位置:确认所有索引不在192.168.1.31、192.168.1.32、192.168.1.33节点上

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

    elasticsearch-master配置

    注意事项:修改配置,重启进程,需要一台一台执行,要确保第一台成功后,再执行下一台。重启进程的方法:由于上一篇文章《EFK教程 - 快速入门指南》里,是执行命令跑在前台,因此直接ctrl - c退出再启动即可,启动命令如下

    1. sudo -u elasticsearch /opt/elasticsearch/bin/elasticsearch

    ▷ 192.168.1.31 /opt/elasticsearch/config/elasticsearch.yml

    1. cluster.name: my-application

    2. node.name: 192.168.1.31

    3. path.logs: /opt/logs/elasticsearch

    4. network.host: 192.168.1.31

    5. discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    6. cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    7. http.cors.enabled: true

    8. http.cors.allow-origin: "*"

    9. #开启master功能

    10. node.master: true

    11. #关闭ingest功能

    12. node.ingest: false

    13. #关闭data功能

    14. node.data: false

    ▷ 192.168.1.32 /opt/elasticsearch/config/elasticsearch.yml

    1. cluster.name: my-application

    2. node.name: 192.168.1.32

    3. path.logs: /opt/logs/elasticsearch

    4. network.host: 192.168.1.32

    5. discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    6. cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    7. http.cors.enabled: true

    8. http.cors.allow-origin: "*"

    9. #开启master功能

    10. node.master: true

    11. #关闭ingest功能

    12. node.ingest: false

    13. #关闭data功能

    14. node.data: false

    ▷ 192.168.1.33 /opt/elasticsearch/config/elasticsearch.yml

    1. cluster.name: my-application

    2. node.name: 192.168.1.33

    3. path.logs: /opt/logs/elasticsearch

    4. network.host: 192.168.1.33

    5. discovery.seed_hosts: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    6. cluster.initial_master_nodes: ["192.168.1.31","192.168.1.32","192.168.1.33"]

    7. http.cors.enabled: true

    8. http.cors.allow-origin: "*"

    9. #开启master功能

    10. node.master: true

    11. #关闭ingest功能

    12. node.ingest: false

    13. #关闭data功能

    14. node.data: false

    elasticsearch集群状态

    1. curl "http://192.168.1.31:9200/_cat/health?v"

    elasticsearch-master状态

    1. curl "http://192.168.1.31:9200/_cat/nodes?v"

    至此,当node.role里所有服务器都不再出现“mid”,则表示一切顺利完成。

    螃蟹在剥我的壳,笔记本在写我,漫天的我落在枫叶上雪花上,而你在想我。 --章怀柔
  • 相关阅读:
    Arcengine效率探究之二——属性的更新 转载
    ArcEngine GDB数据库查询方法总结 转载
    黄聪:Python 字符串操作(string替换、删除、截取、复制、连接、比较、查找、包含、大小写转换、分割等)
    arcgis10.1补丁下载
    arcgis 分式标注jscript "<und>"+ [DLBM] +"</und>"+ "\r\n" + [DLMC]
    arcgis开发,C盘磁盘空间消失元凶,让c盘可以多出10G
    arcgis 查询 group by order by
    arcgis jscript参考http://technet.microsoft.com/zhcn/library/997bcd30(v=vs.80)
    在ArcEngine下实现图层属性过滤的两种方法 转载http://www.gisall.com/html/72/1242722990.html
    使用Geoprocessor 计算面积和长度 转载
  • 原文地址:https://www.cnblogs.com/lovezhr/p/15033867.html
Copyright © 2011-2022 走看看