EFKチュートリアル2:ElasticSearchの高パフォーマンスおよび高可用性アーキテクチャ

:より転載https://mp.weixin.qq.com/s?__biz=MzUyNzk0NTI4MQ==&mid=2247483811&idx=1&sn=a413dea65f8f64abb24d82feea55db5b&chksm=fa769a8dcd01139b1da8794914e10989c6a39a99971d8013e9d3b26766b80d5833e2fbaf0ab8&mpshare=1&scene=1&srcid=1125tjbylqn3EdoMtaX2p73J&sharer_sharetime=1574686271229&sharer_shareid=6ec87ec9a11a0c18d61cde7663a9ef87#rd

EFKのデータ/取り込み/マスターの役割と3つのノードの展開の目的を説明し、高可用性を確保しながらパフォーマンスを最大化する

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 start

    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

3つの新しい取り込みノードを追加してクラスターに参加し、マスター機能とデータ機能をオフにします

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 start

    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-1」でデプロイされた3つのes(192.168.1.31、192.168.1.32、192.168.1.33)をマスターのみの機能に変更するため、これら3つのesのインデックスデータを今回作ったデータノードで

インデックスの移行

この手順を実行する必要があります。前のインデックスをデータノードに配置します

    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"
    }'

現在のインデックスの保存場所を確認する

すべてのインデックスが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配置

注:構成を変更してプロセスを再始動するには、1つずつ実行する必要があります。次の実行の前に、最初の実行が成功したことを確認してください。

# 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」が表示されない場合、すべてが正常に完了していることを意味します。

おすすめ

転載: www.cnblogs.com/sanduzxcvbnm/p/12698464.html