• 安装opensearch



    title: “安装opensearch”
    createTime: 2021-11-30T19:13:45+08:00
    updateTime: 2021-11-30T19:13:45+08:00
    draft: false
    author: “name”
    tags: [“es”,“安装”]
    categories: [“OpenSearch”]
    description: “测试的”

    说明

    • 基于Elasticsearch7.10.2 的 opensearch-1.1.0

    硬件服务器

    • 10.168.2.87
    • 10.168.2.88
    • 10.168.2.89

    1.环境准备 (每台都需要做)

    1.1创建用户(root用户操作)

    • useradd top

    1.2 修改用户密码(root用户操作)

    • passwd top

    1.3 赋予用户sudo权限(root用户操作)

    • 修改命令

      chmod -v u+w /etc/sudoers
      sed -i 's#.*top.*##g' /etc/sudoers
      sed -i 's#root.*ALL=(ALL).*ALL#root  ALL=(ALL)  ALL \ntop   ALL=(ALL)  ALL#g' /etc/sudoers
      chmod -v u-w /etc/sudoers
      
      • 1
      • 2
      • 3
      • 4

    1.4 安全limits文件限制

    • 修改文件

      vim  /etc/security/limits.conf
      
      • 1
    • 增加的内容

      * soft nofile 65536
      * hard nofile 65536
      
      • 1
      • 2

    最后几行加上 需要增加的部分

    1.5 系统文件限制

    • 修改文件

      vim  /etc/sysctl.conf 
      
      • 1
    • 增加的内容

      vm.max_map_count=655360
      
      • 1

    最后几行加上 需要增加的部分(最后几行加上)

    1.6 载入指定配置

    • 修改文件

      [top@node85 .ssh]$ sudo sysctl -p
      [sudo] top 的密码:
      vm.max_map_count = 655360
      
      • 1
      • 2
      • 3
    • 结果如图

    image-20211111205714215

    1.7 重启

    • 执行命令

      sudo reboot
      
      • 1

    2.opensearch安装参考

    官网下载地址

    2.1 下载安装包:

    • 执行命令

      mkdir /home/top/opensearch
      cd /home/top/opensearch
      wget http://10.168.2.60:35000/opensearch-1.1.0-linux-x64.tar.gz
      
      • 1
      • 2
      • 3

    3.OpenS安装

    3.1 解压OpenS安装包

    • 执行命令

      cd /home/top/opensearch
      tar -xzvf opensearch-1.1.0-linux-x64.tar.gz
      
      • 1
      • 2

    3.2 创建数据目录、日志目录

    • 执行命令

      mkdir /home/top/opensearch/data -p
      mkdir /home/top/opensearch/logs -p
      
      • 1
      • 2

    3.3 删除安装包

    • 执行命令

      rm -rf opensearch-1.1.0-linux-x64.tar.gz
      ln -s opensearch-1.1.0/ opensearch
      
      • 1
      • 2

    3.4分发配置及安装目录

    • 执行命令

      rsync -avl /home/top/opensearch u86:/home/top 
      rsync -avl /home/top/opensearch u87:/home/top
      
      • 1
      • 2
    • 或者

      rsync -avl /home/top/opensearch top@10.168.2.86:/home/top/
      rsync -avl /home/top/opensearch top@10.168.2.87:/home/top/
      
      • 1
      • 2

    4. OpenS节点配置

    4.1、 opensearch-master(10.168.2.85 )

    • cat /home/top/opensearch/opensearch/config/opensearch.yml

      # ---------------------------------- Cluster -----------------------------------
      #
      # Use a descriptive name for your cluster:
      #
      cluster.name: opensearch-cluster
      #
      # ------------------------------------ Node ------------------------------------
      #
      # Use a descriptive name for the node:
      #
      node.name: opensearch-master
      node.master: true #专用的主节点
      node.data: false # 不是子节点
      node.ingest: false # 不是摄取节点 (通道)
      #
      # Add custom attributes to the node:
      #
      #node.attr.rack: r1
      #
      # ----------------------------------- Paths ------------------------------------
      #
      # Path to directory where to store the data (separate multiple locations by comma):
      #
      path.data: /home/top/opensearch/data
      #
      # Path to log files:
      #
      path.logs: /home/top/opensearch/logs
      
      #将集群绑定到特定的 IP 地址
      network.host: node85
      
      #为集群配置发现主机
      discovery.seed_hosts: ["node86","node87","node88"]
      cluster.initial_master_nodes: opensearch-master
      #禁用安全
      plugins.security.disabled: true
      
      #discovery.type: cluster
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23
      • 24
      • 25
      • 26
      • 27
      • 28
      • 29
      • 30
      • 31
      • 32
      • 33
      • 34
      • 35
      • 36
      • 37
      • 38
      • 39

    4.2、opensearch-d1 (10.168.2.86)

    • cat /home/top/elasticsearch-7.10.2/config/elasticsearch.yml
    
    #
    # ---------------------------------- Cluster -----------------------------------
    #
    # Use a descriptive name for your cluster:
    #
    cluster.name: opensearch-cluster
    #
    # ------------------------------------ Node ------------------------------------
    #
    # Use a descriptive name for the node:
    #
    node.name: opensearch-d1
    node.master: true
    node.data: true
    node.ingest: true
    #
    # Add custom attributes to the node:
    #
    #node.attr.rack: r1
    #
    # ----------------------------------- Paths ------------------------------------
    #
    # Path to directory where to store the data (separate multiple locations by comma):
    #
    path.data: /home/top/opensearch/data
    # Path to log files:
    #
    path.logs: /home/top/opensearch/logs
    
    #将集群绑定到特定的 IP 地址
    network.host: node86
    
    
    #为集群配置发现主机
    discovery.seed_hosts: ["node85","node87","node88"]
    cluster.initial_master_nodes: opensearch-master
    #禁用安全
    plugins.security.disabled: true
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39

    4.3、opensearch-d2(10.168.2.87)

    • cat /home/top/elasticsearch-7.10.2/config/elasticsearch.yml
    
    #
    # ---------------------------------- Cluster -----------------------------------
    #
    # Use a descriptive name for your cluster:
    #
    cluster.name: opensearch-cluster
    #
    # ------------------------------------ Node ------------------------------------
    #
    # Use a descriptive name for the node:
    #
    node.name: opensearch-d2
    node.master: true
    node.data: true
    node.ingest: true
    #
    # Add custom attributes to the node:
    #
    #node.attr.rack: r1
    #
    # ----------------------------------- Paths ------------------------------------
    #
    # Path to directory where to store the data (separate multiple locations by comma):
    #
    path.data: /home/top/opensearch/data
    #
    # Path to log files:
    #
    path.logs: /home/top/opensearch/logs
    
    
    #将集群绑定到特定的 IP 地址
    network.host: node87
    
    #为集群配置发现主机
    discovery.seed_hosts: ["node85", "node86","node88"]
    cluster.initial_master_nodes: opensearch-master
    #禁用安全
    plugins.security.disabled: true
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40

    4.4、opensearch-c1 (10.168.2.88)

    • cat /home/top/elasticsearch-7.10.2/config/elasticsearch.yml
    
    #
    # ---------------------------------- Cluster -----------------------------------
    #
    # Use a descriptive name for your cluster:
    #
    cluster.name: opensearch-cluster
    #
    # ------------------------------------ Node ------------------------------------
    #
    # Use a descriptive name for the node:
    # 协调节点
    node.name: opensearch-c1
    node.master: false
    node.data: false
    node.ingest: false
    
    
    # Path to directory where to store the data (separate multiple locations by comma):
    #
    path.data: /home/top/opensearch/data
    #
    # Path to log files:
    #
    path.logs: /home/top/opensearch/logs
    
    #将集群绑定到特定的 IP 地址
    network.host: node88
    
    
    #为集群配置发现主机
    discovery.seed_hosts: ["node85","node86","node87"]
    cluster.initial_master_nodes: opensearch-master
    #禁用安全
    plugins.security.disabled: true
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35

    5. 启动OpenS集群

    • 此操作需要在各个节点上运行
    /home/top/opensearch/opensearch/bin/opensearch -d -p /home/top/opensearch/pid >/dev/null 2>&1 &
    
    • 1

    6. 检测是否启动完成集群

    • [top@localhost ~]$ curl -X GET ‘http://10.168.2.85:9200/’
    • {
      “name”: “node85”,
      “cluster_name”: “es-top”,
      “cluster_uuid”: “v7M5HemdSvmFjVPhEAlhig”,
      “version”: {
      “number”: “7.10.2”,
      “build_flavor”: “default”,
      “build_type”: “tar”,
      “build_hash”: “93d5a7f6192e8a1a12e154a2b81bf6fa7309da0c”,
      createTime: 2021-11-30T19:13:45+08:00
      updateTime: 2021-11-30T19:13:45+08:00
      “build_snapshot”: false,
      “lucene_version”: “8.9.0”,
      “minimum_wire_compatibility_version”: “6.8.0”,
      “minimum_index_compatibility_version”: “6.0.0-beta1”
      },
      “tagline”: “You Know, for Search”
      }
      1. 其他
    根据当前机器的大小修改分配给es的内存
    • 文件位置:vim /home/top/es/elasticsearch-7.10.2/config/jvm.options

    -Xms1g =>修改成想要的内存数
    -Xmx1g =>修改成想要的内存数

  • 相关阅读:
    AI的制作思维导图
    快手、抖音、视频号交战内容付费
    Spring核心接口ObjectProvider
    AS400 大厂面试
    man-cobbler
    hardhat开发dapp初始化操作
    vue项目分环境部署
    由浅入深,从掌握Promise的基本使用到手写Promise
    TiDB故障处理之让人迷惑的Region is Unavailable
    BUG 随想录 - Java: 程序包 com.example.xxx 不存在
  • 原文地址:https://blog.csdn.net/ZHUXIUQINGIT/article/details/133436120