安装OpenSearch

news/2024/7/7 5:52:25 标签: linux, 运维, 服务器, mysql, elasticsearch

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.4 安全limits文件限制

  • 修改文件

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

    * soft nofile 65536
    * hard nofile 65536
    

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

1.5 系统文件限制

  • 修改文件

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

    vm.max_map_count=655360
    

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

1.6 载入指定配置

  • 修改文件

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

image-20211111205714215

1.7 重启

  • 执行命令

    sudo reboot
    

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
    

3.OpenS安装

3.1 解压OpenS安装包

  • 执行命令

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

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

  • 执行命令

    mkdir /home/top/opensearch/data -p
    mkdir /home/top/opensearch/logs -p
    

3.3 删除安装包

  • 执行命令

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

3.4分发配置及安装目录

  • 执行命令

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

    rsync -avl /home/top/opensearch top@10.168.2.86:/home/top/
    rsync -avl /home/top/opensearch top@10.168.2.87:/home/top/
    

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
    

4.2、opensearch-d1 (10.168.2.86)


#
# ---------------------------------- 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

4.3、opensearch-d2(10.168.2.87)


#
# ---------------------------------- 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

4.4、opensearch-c1 (10.168.2.88)


#
# ---------------------------------- 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

5. 启动OpenS集群

  • 此操作需要在各个节点上运行
/home/top/opensearch/opensearch/bin/opensearch -d -p /home/top/opensearch/pid >/dev/null 2>&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 =>修改成想要的内存数


http://www.niftyadmin.cn/n/5047132.html

相关文章

IO多路复用实现TCP客户端与TCP并发服务器

IO多路复用实现TCP客户端与并发服务器 IO多路复用 :select函数 功能:阻塞函数,让内核监测集合中是否有文件描述符准备就绪,若准备就绪则解除阻塞;当函数解除阻塞后,集合中会只剩下产生事件的文件描述符;例…

【Spring Boot 源码学习】OnBeanCondition 详解

Spring Boot 源码学习系列 OnBeanCondition 详解 引言往期内容主要内容1. getOutcomes 方法2. getMatchOutcome 方法2.1 ConditionalOnBean 注解处理2.2 ConditionalOnSingleCandidate 注解处理2.3 ConditionalOnMissingBean 注解处理 3. getMatchingBeans 方法 总结 引言 上篇…

排序:冒泡排序算法分析

1.交换排序 基于“交换”的排序︰ 根据序列中两个元素关键字的比较结果来对换这两个记录在序列中的位置。 交换排序包括冒泡排序和快速排序。 2.冒泡排序 1.算法原理 从后往前(或从前往后)两两比较相邻元素的值,若为逆序(即 A [ i − 1 ] > A [ i ] A[i-1]&…

Cortex-M3/M4之SVC和PendSV异常

一、SVC异常 SVC(系统服务调用,亦简称系统调用)用于产生系统函数的调用请求。例如,操作系统不让用户程序直接访问硬件,而是通过提供一些系统服务函数,用户程序使用 SVC 发出对系统服务函数的呼叫请求,以这种方法调用它…

恒合仓库 - 采购单管理模块

采购单管理模块 文章目录 采购单管理模块一、添加采购单(核心)1.1 采购流程1.2 采购单实体类1.3 添加采购单1.3.1 Mapper1.3.2 Service1.3.3 Controller1.3.4 效果图 二、采购单管理模块2.1 仓库数据回显2.1.1 Mapper2.1.2 Service2.1.3 Controller2.1.4 效果图 2.2 采购单列表…

力扣:105. 从前序与中序遍历序列构造二叉树(Python3)

题目: 给定两个整数数组 preorder 和 inorder ,其中 preorder 是二叉树的先序遍历, inorder 是同一棵树的中序遍历,请构造二叉树并返回其根节点。 来源:力扣(LeetCode) 链接:力扣&am…

怎样快速打开github.com

1访问这个网站很慢是因为有DNS污染,被一些别有用心的人搞了鬼了, 2还有一个重要原因是不同的DNS服务器解析的速度不一样。 1 建议设置dns地址为114.114.114.114.我觉得假设一个县城如果有一个DNS服务器的话,这个服务器很可能不会存储…

PPT系统化学习 - 第1天

文章目录 更改PPT主题更改最大撤回次数自动保存禁止PPT压缩图片字体嵌入PPTPPT导出为PDFPPT导出为图片PPT导出为图片型幻灯片PPT导出成视频添加参考线设置默认字体设置默认形状建立模板、保存模板、使用模板建立模板保存模板使用模板 更改PPT主题 更改PPT的主题: 夜…