首页 > 其他分享 >opensearch基础知识

opensearch基础知识

时间:2024-11-28 16:21:36浏览次数:5  
标签:name opensearch analysis 基础知识 cluster ik node1

opensearch基础

  1. Cluster

    • Contains one or more nodes
    • Managed by a master node
  2. Node

    • Single server part of a cluster
    • Types: Master-eligible, data, ingest, etc.
  3. Index

    • Collection of documents with similar characteristics
    • Managed by shards
  4. Shard(分片):

    OpenSearch 索引中的数据可以增长到巨大的比例。为了保持其可管理性,它被拆分为多个分片。每个 OpenSearch 分片都是一个 Apache Lucene 索引,每个单独的 Lucene 索引都包含 OpenSearch 索引中文档的子集。以这种方式拆分索引可以控制资源使用。Apache Lucene 索引的文档数量限制为 2,147,483,519 个。

    • Single Lucene instance
    • Holds part of an index's data
    • Types: Primary and replica
  5. Document

    • Basic unit of information
    • Expressed in JSON format
  6. Field

    • Smallest individual unit of data in a document
    • Has a defined datatype
  7. Mapping

    • Defines how a document and its fields are stored and indexed (定义文档及其字段的存储和索引方式)
  8. Segment (段)

    • An inverted index (倒排索引)
    • Created when a new document is indexed (在为新文档编制索引时创建)
    • Merged into larger segments over time

如果安装的opensearch是集群,那么每个node节点都需要安装插件

opensearch安装分词插件

#进入docker容器
docker exec -it opensearch-node1 bash
  1. 安装opensearch提供的分词插件(analysis-smartcn)

    #进入容器后,执行以下命令
    bin/opensearch-plugin install analysis-smartcn
    
  2. 通过压缩包安装插件

    #file:///opensearch-analysis-ik.zip 为压缩文件在容器中的位置
    bin/opensearch-plugin install file:///opensearch-analysis-ik.zip
    

安装IK分词器启动opensearch服务的报错:

  1. NoClassDefFoundError: org/apache/commons/logging/LogFactory

    #缺少jar包,下载commons-logging-1.2.jar后复制到对应的目录(opensearch-node1为容器的名称)
    docker cp /data/openSearch/commons-logging-1.2.jar opensearch-node1:/usr/share/opensearch/plugins/opensearch-analysis-ik
    
  2. 分词插入数据时报错空指针 org.wltea.analyzer.dic.Dictionary.singleton._StopWords;

    #进入docker容器
    docker exec -it opensearch-node1 bash
    #查看/usr/share/opensearch/plugins/opensearch-analysis-ik/config是否存在,如果不存在的话
    cd /usr/share/opensearch/plugins/opensearch-analysis-ik
    mkdir config
    chmod 755
    #将opensearch-analysis-ik目录下的所有文件复制到config目录
    cp -r /usr/share/opensearch/config/opensearch-analysis-ik/* /usr/share/opensearch/plugins/opensearch-analysis-ik/config
    
  3. #本地通过 find 命令查找文件
    find / -name "sonar-pmd-plugin-2.6.jar"
    

其他操作:

#本地通过 find 命令查找文件
find / -name "sonar-pmd-plugin-2.6.jar"
#修改IKAnalyzer.cfg.xml来设置自定义分词
docker cp /data/openSearch/IKAnalyzer.cfg.xml opensearch-node1:/usr/share/opensearch/plugins/opensearch-analysis-ik/config

opensarch集群的docker-compose文件:

version: '3'
services:
  opensearch-node1:
    image: opensearchproject/opensearch:latest
    container_name: opensearch-node1
    environment:
      - cluster.name=opensearch-cluster # Name the cluster
      - node.name=opensearch-node1 # Name the node that will run in this container
      - discovery.seed_hosts=opensearch-node1,opensearch-node2 # Nodes to look for when discovering the cluster
      - cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2 # Nodes eligibile to serve as cluster manager
      - bootstrap.memory_lock=true # Disable JVM heap memory swapping
      - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # Set min and max JVM heap sizes to at least 50% of system RAM
      - "DISABLE_INSTALL_DEMO_CONFIG=true" # Prevents execution of bundled demo script which installs demo certificates and security configurations to OpenSearch
      - "DISABLE_SECURITY_PLUGIN=true" # Disables Security plugin
    ulimits:
      memlock:
        soft: -1 # Set memlock to unlimited (no soft or hard limit)
        hard: -1
      nofile:
        soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536
        hard: 65536
    volumes:
      - opensearch-data1:/usr/share/opensearch/data # Creates volume called opensearch-data1 and mounts it to the container
    ports:
      - 9200:9200 # REST API
      - 9300:9300 # TCP API
      - 9600:9600 # Performance Analyzer
    networks:
      - opensearch-net # All of the containers will join the same Docker bridge network
  opensearch-node2:
    image: opensearchproject/opensearch:latest
    container_name: opensearch-node2
    environment:
      - cluster.name=opensearch-cluster # Name the cluster
      - node.name=opensearch-node2 # Name the node that will run in this container
      - discovery.seed_hosts=opensearch-node1,opensearch-node2 # Nodes to look for when discovering the cluster
      - cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2 # Nodes eligibile to serve as cluster manager
      - bootstrap.memory_lock=true # Disable JVM heap memory swapping
      - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # Set min and max JVM heap sizes to at least 50% of system RAM
      - "DISABLE_INSTALL_DEMO_CONFIG=true" # Prevents execution of bundled demo script which installs demo certificates and security configurations to OpenSearch
      - "DISABLE_SECURITY_PLUGIN=true" # Disables Security plugin
    ulimits:
      memlock:
        soft: -1 # Set memlock to unlimited (no soft or hard limit)
        hard: -1
      nofile:
        soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536
        hard: 65536
    volumes:
      - opensearch-data2:/usr/share/opensearch/data # Creates volume called opensearch-data2 and mounts it to the container
    networks:
      - opensearch-net # All of the containers will join the same Docker bridge network
  opensearch-dashboards:
    image: opensearchproject/opensearch-dashboards:latest
    container_name: opensearch-dashboards
    ports:
      - 5601:5601 # Map host port 5601 to container port 5601
    expose:
      - "5601" # Expose port 5601 for web access to OpenSearch Dashboards
    environment:
      - 'OPENSEARCH_HOSTS=["http://opensearch-node1:9200","http://opensearch-node2:9200"]'
      - "DISABLE_SECURITY_DASHBOARDS_PLUGIN=true" # disables security dashboards plugin in OpenSearch Dashboards
    networks:
      - opensearch-net

volumes:
  opensearch-data1:
  opensearch-data2:

networks:
  opensearch-net:

标签:name,opensearch,analysis,基础知识,cluster,ik,node1
From: https://www.cnblogs.com/MapleDream/p/18574485

相关文章

  • java 基础知识汇总(1)
    目录1.什么是面向对象?1.1面向对象的特征1.1.1封装(Encapsulation):1.1.2继承(Inheritance):1.1.3多态(Polymorphism):1.1.4抽象(Abstraction):1.2面向对象与面向过程的区别1.3重载(Overload)与重写(Override)的区别   1.3.1重写(Override)1.3.2重载(Overload)1.4构造......
  • 这些机器学习基础知识搞懂了,机器学习哪有学不会的
    有无标签:按照求解的方法不同,有监督学习算法可以进一步分为生成模型与判别模型。1.有监督学习:分类问题回归问题2.无监督学习:聚类数据降维问题3.无监督学习机器学习三要素:模型:条件概率分布,决策函数策略:损失函数,最大似然函数,最小二乘算法:梯度下降......
  • 数据共享(基础知识回顾)
    函数之间数据共享的方式有以下几种:1.全局变量和局部变量2.类的数据成员3.类的静态数据成员。静态数据成员存放的是类的所有对象的某个共同特征的数据,对于每个对象而言,该数据都是相同的,在内存中只存在一份。这与类的一般数据成员不同,一般数据成员会在每个对象中都有一个拷贝,......
  • WiFi基础知识合集:WiFi标准、协议、信道、天线、工作原理、认证与加密
    liwen012024.11.24前言WiFi技术在移动互联网和物联网中都有广泛的应用,随着用户对速率、功耗、安全要求的不断提升,WiFi技术标准也在快速更新。对于普通用户、或是嵌入式应用软件开发,如果对WiFi基础原理有个基础的了解,在处理WiFi问题时或许会更有方向和思路。这个合集是我自己W......
  • 计算机基础知识概述
    《计算机基础知识概述》计算机是我们日常生活和工作中不可或缺的工具,了解一些计算机的基础知识,能让我们更好地使用它。一、计算机硬件组成计算机硬件主要包括中央处理器(CPU)、内存、硬盘、输入设备和输出设备等。1.CPU是计算机的核心,负责执行指令和处理数据。2.内存用于......
  • 网络基础知识-1
     前言:本文只是作者整理之前学习的网络内容进行分享,如有错误也欢迎各位大佬指正。一、什么是网络?网络都是为了实现最基本的目的:网络互通什么是网络?所有想要上网的设备连接在一起什么是互通?我给你发送数据包,你给我回应数据包【互通,是双向的,一发一收】任何两个设备之间通......
  • java基础知识(常用类)
    目录一、包装类(Wrapper) (1)包装类与基本数据的转换 (2)包装类与String类型的转换  (3)Integer类和Character类常用的方法二、String类(1)String类介绍1)String对象用于保存字符串,也就是一组字符序列2)字符串常量对象是用双引号括起的字符序列。例如:"你好"、"12.97"、......
  • java基础知识(Math类)
    引入:Math类包含用于执行基本数学运算的方法,如初等指数、对数、平方根importjava.util.Math 1.abs绝对值intabs =Math.abs(-9);2.pow求幂doublepow=Math.pow(2,4);3.向上取整doubleceil=Math.ceil(3.9);//ceil=44.向下取整doublefloor=Math.floor(4......
  • 【软考速通笔记】系统架构设计师③——信息安全技术基础知识
    文章目录一、前言二、信息安全基础知识2.1信息安全的基本要求2.2信息安全的范围2.3网络安全表现2.4安全措施包括三、信息安全系统的组成框架3.1技术体系:3.2组织机构体系:3.3管理体系四、信息加解密技术4.1对称密钥加密算法4.2非对称密钥加密4.3数字签名五、......
  • 【软考速通笔记】系统架构设计师④——系统工程基础知识
    文章目录一、前言二、系统工程方法2.1霍尔的三维结构2.2切克兰德法2.3并行工程2.4综合集成法三、系统工程生命周期四、系统生命周期方法五、系统性能5.1计算机的性能指标5.2路由器的性能指标5.3交换机的性能指标5.4网络的性能资料5.5操作系统的性能指标5.6数......