当前位置: 首页 > news >正文

Centos安装OpenSearch

Centos安装OpenSearch

  • 下载并安装OpenSearch
    • 下载OpenSearch RPM包
    • 导入公共GNU Privacy Guard(GPG)密钥。此密钥验证您的OpenSearch实例是否已签名
    • 安装RPM包
    • 安装完设置开机自启动OpenSearch
    • 启动OpenSearch
    • 验证OpenSearch是否正确启动
  • 测试OpenSearch
    • 向服务器发送请求以验证OpenSearch是否正在运行
      • 向端口9200发送请求
      • 查询插件端点
  • 设置OpenSearch可远程连接
    • 将OpenSearch绑定到主机上的IP或网络接口
      • 打开opensearch.yml
      • 添加以下行
      • 保存更改并关闭文件
    • 设置初始和最大JVM堆大小
    • 配置TLS
      • 导航到将存储证书的目录
      • 删除演示证书
      • 生成根证书,这将用于签署其他证书
      • 创建管理员证书,此证书用于获得执行与安全插件相关的管理任务的提升权限
      • 为正在配置的节点创建证书
      • 删除不再需要的临时文件
      • 确保其余证书归opensearch用户所有
      • 按照生成证书中的说明将这些证书添加到opensearch.yml,推荐选择使用脚本进行设置
        • 新建shell脚本文件 append-setting.sh
        • 执行append-setting.sh
      • 为自签名根证书添加信任(可选)

下载并安装OpenSearch

下载OpenSearch RPM包

X64系统

wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.16.0/opensearch-2.16.0-linux-x64.rpm

ARM64系统

wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.16.0/opensearch-2.16.0-linux-arm64.rpm

导入公共GNU Privacy Guard(GPG)密钥。此密钥验证您的OpenSearch实例是否已签名

sudo rpm --import https://artifacts.opensearch.org/publickeys/opensearch.pgp

安装RPM包

## Install the x64 package using rpm.
sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password> rpm -ivh opensearch-2.16.0-linux-x64.rpm
## Install the arm64 package using rpm.
sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=<custom-admin-password> rpm -ivh opensearch-2.16.0-linux-arm64.rpm

安装完设置开机自启动OpenSearch

sudo systemctl enable opensearch

启动OpenSearch

sudo systemctl start opensearch

验证OpenSearch是否正确启动

sudo systemctl status opensearch

测试OpenSearch

向服务器发送请求以验证OpenSearch是否正在运行

向端口9200发送请求

curl -X GET https://localhost:9200 -u 'admin:<custom-admin-password>' --insecure

响应:

{"name":"hostname","cluster_name":"opensearch","cluster_uuid":"QqgpHCbnSRKcPAizqjvoOw","version":{"distribution":"opensearch","number":<version>,"build_type":<build-type>,"build_hash":<build-hash>,"build_date":<build-date>,"build_snapshot":false,"lucene_version":<lucene-version>,"minimum_wire_compatibility_version":"7.10.0","minimum_index_compatibility_version":"7.0.0"},"tagline":"The OpenSearch Project: https://opensearch.org/"}

查询插件端点

curl -X GET https://localhost:9200/_cat/plugins?v -u 'admin:<custom-admin-password>' --insecure

响应:

name          component                            versionhostname      opensearch-alerting                  2.15.0hostname      opensearch-anomaly-detection         2.15.0hostname      opensearch-asynchronous-search       2.15.0hostname      opensearch-cross-cluster-replication 2.15.0hostname      opensearch-geospatial                2.15.0hostname      opensearch-index-management          2.15.0hostname      opensearch-job-scheduler             2.15.0hostname      opensearch-knn                       2.15.0hostname      opensearch-ml                        2.15.0hostname      opensearch-neural-search             2.15.0hostname      opensearch-notifications             2.15.0hostname      opensearch-notifications-core        2.15.0hostname      opensearch-observability             2.15.0hostname      opensearch-performance-analyzer      2.15.0hostname      opensearch-reports-scheduler         2.15.0hostname      opensearch-security                  2.15.0hostname      opensearch-security-analytics        2.15.0hostname      opensearch-sql                       2.15.0

设置OpenSearch可远程连接

默认情况下,OpenSearch不绑定到网络接口,外部主机无法访问。此外,安全设置由默认用户名和密码填充。以下建议将使用户能够将OpenSearch绑定到网络接口,创建和签署TLS证书,以及配置基本身份验证

将OpenSearch绑定到主机上的IP或网络接口

打开opensearch.yml

sudo vi /etc/opensearch/opensearch.yml

添加以下行

# Bind OpenSearch to the correct network interface. Use 0.0.0.0
# to include all available interfaces or specify an IP address
# assigned to a specific interface.
network.host: 0.0.0.0# Unless you have already configured a cluster, you should set
# discovery.type to single-node, or the bootstrap checks will
# fail when you try to start the service.
discovery.type: single-node# If you previously disabled the Security plugin in opensearch.yml,
# be sure to re-enable it. Otherwise you can skip this setting.
plugins.security.disabled: false

保存更改并关闭文件

:wq

设置初始和最大JVM堆大小

vi /etc/opensearch/jvm.options

修改初始堆大小和最大堆大小的值。作为起点,您应该将这些值设置为可用系统内存的一半。对于专用主机,可以根据您的工作流程要求增加此值。
例如,如果主机有8GB的内存,那么您可能希望将初始堆大小和最大堆大小设置为4GB:

-Xms4g
-Xmx4g

配置TLS

导航到将存储证书的目录

cd /etc/opensearch

删除演示证书

sudo rm -f *pem

生成根证书,这将用于签署其他证书

# Create a private key for the root certificate
sudo openssl genrsa -out root-ca-key.pem 2048# Use the private key to create a self-signed root certificate. Be sure to
# replace the arguments passed to -subj so they reflect your specific host.
sudo openssl req -new -x509 -sha256 -key root-ca-key.pem -subj "/C=CA/ST=ONTARIO/L=TORONTO/O=ORG/OU=UNIT/CN=ROOT" -out root-ca.pem -days 730

创建管理员证书,此证书用于获得执行与安全插件相关的管理任务的提升权限

# Create a private key for the admin certificate.
sudo openssl genrsa -out admin-key-temp.pem 2048# Convert the private key to PKCS#8.
sudo openssl pkcs8 -inform PEM -outform PEM -in admin-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out admin-key.pem# Create the certficiate signing request (CSR). A common name (CN) of "A" is acceptable because this certificate is
# used for authenticating elevated access and is not tied to a host.
sudo openssl req -new -key admin-key.pem -subj "/C=CA/ST=ONTARIO/L=TORONTO/O=ORG/OU=UNIT/CN=A" -out admin.csr# Sign the admin certificate with the root certificate and private key you created earlier.
sudo openssl x509 -req -in admin.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out admin.pem -days 730

为正在配置的节点创建证书

# Create a private key for the node certificate.
sudo openssl genrsa -out node1-key-temp.pem 2048# Convert the private key to PKCS#8.
sudo openssl pkcs8 -inform PEM -outform PEM -in node1-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out node1-key.pem# Create the CSR and replace the arguments passed to -subj so they reflect your specific host.
# The CN should match a DNS A record for the host-do not use the hostname.
sudo openssl req -new -key node1-key.pem -subj "/C=CA/ST=ONTARIO/L=TORONTO/O=ORG/OU=UNIT/CN=node1.dns.a-record" -out node1.csr# Create an extension file that defines a SAN DNS name for the host. This
# should match the DNS A record of the host.
sudo sh -c 'echo subjectAltName=DNS:node1.dns.a-record > node1.ext'# Sign the node certificate with the root certificate and private key that you created earlier.
sudo openssl x509 -req -in node1.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out node1.pem -days 730 -extfile node1.ext

删除不再需要的临时文件

sudo rm -f *temp.pem *csr *ext

确保其余证书归opensearch用户所有

sudo chown opensearch:opensearch admin-key.pem admin.pem node1-key.pem node1.pem root-ca-key.pem root-ca.pem root-ca.srl

按照生成证书中的说明将这些证书添加到opensearch.yml,推荐选择使用脚本进行设置

新建shell脚本文件 append-setting.sh
vi aplpend-seeting.sh#! /bin/bash# Before running this script, make sure to replace the CN in the 
# node's distinguished name with a real DNS A record.echo "plugins.security.ssl.transport.pemcert_filepath: /etc/opensearch/node1.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.transport.pemkey_filepath: /etc/opensearch/node1-key.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.transport.pemtrustedcas_filepath: /etc/opensearch/root-ca.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.http.enabled: true" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.http.pemcert_filepath: /etc/opensearch/node1.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.http.pemkey_filepath: /etc/opensearch/node1-key.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.ssl.http.pemtrustedcas_filepath: /etc/opensearch/root-ca.pem" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.allow_default_init_securityindex: true" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.authcz.admin_dn:" | sudo tee -a /etc/opensearch/opensearch.yml
echo "  - 'CN=A,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.nodes_dn:" | sudo tee -a /etc/opensearch/opensearch.yml
echo "  - 'CN=node1.dns.a-record,OU=UNIT,O=ORG,L=TORONTO,ST=ONTARIO,C=CA'" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.audit.type: internal_opensearch" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.enable_snapshot_restore_privilege: true" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.check_snapshot_restore_write_privileges: true" | sudo tee -a /etc/opensearch/opensearch.yml
echo "plugins.security.restapi.roles_enabled: [\"all_access\", \"security_rest_api_access\"]" | sudo tee -a /etc/opensearch/opensearch.yml
执行append-setting.sh
sh append-setting.sh

为自签名根证书添加信任(可选)

# Copy the root certificate to the correct directory
sudo cp /etc/opensearch/root-ca.pem /etc/pki/ca-trust/source/anchors/# Add trust
sudo update-ca-trust

相关文章:

Centos安装OpenSearch

Centos安装OpenSearch 下载并安装OpenSearch下载OpenSearch RPM包导入公共GNU Privacy Guard&#xff08;GPG&#xff09;密钥。此密钥验证您的OpenSearch实例是否已签名安装RPM包安装完设置开机自启动OpenSearch启动OpenSearch验证OpenSearch是否正确启动 测试OpenSearch向服务…...

【pkill pgrep】Centos/Linux pkill命令详细介绍

【pkill & pgrep】Centos/Linux pkill命令详细介绍 简介 基础语法 选项介绍 退出状态 基本用法 注意事项 简介 系统版本&#xff1a;Centos7.6 pkill命令用于杀死一个进程&#xff0c;会根据进程名称和其他属性杀死进程&#xff08;默认会向进程发送SIGTERM信号&…...

Java如何使用 HTTP 请求下载图片

工具类&#xff1a; public FileInputStream fileDownload(String fileLink) throws Exception {System.out.println("开始下载"fileLink);// 转码中文URL url new URL(encodeURLChinese(fileLink));System.out.println("fileLink:"url);// 开始下载Trust…...

ARM/Linux嵌入式面经(二十):地平线嵌入式开发

一面 1、自己介绍一下项目 一个清晰、结构化的表达能极大地提升你的专业形象。所以一定要养成结构性的回答,真的铁子,信我。 项目介绍示例 项目名称:智能温控系统 项目背景: 该项目旨在开发一款应用于智能家居环境的智能温控系统,通过精准控制室内温度,提高居住舒适度…...

无人机竞速赛

速度与激情的空中盛宴&#xff0c;无人机竞速赛再次点燃我们的肾上腺素&#xff01; 想象一下&#xff0c;数百架智能飞行器在蓝天下疾驰&#xff0c;如同未来战士穿梭于现实与虚拟的边界&#xff0c;每一次转弯、加速都精准至极&#xff0c;挑战着物理与技术的极限&#xff0…...

【书生大模型实战营(暑假场)】入门任务二 Git 关卡

入门任务二 Git 关卡 参考&#xff1a; 教程任务 注意&#xff1a; 项目Github链接 1 闯关任务 1.1 使用 Git 完成破冰介绍 本任务将基于开发机实现&#xff0c;重点在于熟悉Git操作。首先要了解 Git操作的常见四部曲&#xff0c;即&#xff1a;舔 Add&#xff0c;提 Co…...

OSPF小实验

根据题目完成下列实验&#xff1a; 拓扑图详细设计如下&#xff1a; 1.基础配置 R1&#xff1a; [R1]interface s4/0/0 [R1-Serial4/0/0]ip address 12.1.1.1 24 [R1]interface LoopBack 0 [R1-LoopBack0]ip address 1.1.1.1 24 R2&#xff1a; [R2]interface s4/0/1 [R2-…...

蛋白质生物学:从序列到结构和疾病 下载并同时打开1LYZ和1H6M的PDB文件(提交图片)。描述这种蛋白质的二级和三级结构。(10分)

Download and open the PDB files of 1LYZ and 1H6M together in one view (submit an image). Describe the secondary and tertiary structure of this protein. (10 marks) 下面给出完整详细的解答&#xff1a; 同时打开1LYZ和1H6M的PDB文件得到&#xff1a; 首先二级结构…...

用VBA在Word中随机打乱单词表,进行分列

一、效果展示&#xff08;以下是三次随机打乱的结果&#xff09; 二、代码 Sub 随机分单词到后面的单元格()Dim C1 As CellDim str, str1, aDim shuffledArray() As VariantSet C1 Selection.Range.Tables(1).Cell(1, 1)str C1.Range.textstr mid(str, 3, Len(str) - 4)str…...

UNI-APP_点击,长按,触摸,结束触摸事件

touchstartEventHandle手指触摸动作开始字节跳动小程序不支持touchmoveEventHandle手指触摸后移动字节跳动小程序不支持touchendEventHandle手指触摸动作结束字节跳动小程序不支持touchcancelEventHandle手指触摸动作被打断&#xff0c;如来电提醒&#xff0c;弹窗字节跳动小程…...

【QT】Qt 音视频

Qt 音视频 Qt 音视频1. Qt 音频2. Qt 视频 Qt 音视频 在 Qt 中&#xff0c;音频主要是通过 QSound 类来实现。但是需要注意的是 QSound 类只支持播放 wav 格式的音频文件。也就是说如果想要添加音频效果&#xff0c;那么首先需要将非 wav 格式的音频文件转换为 wav 格式。 通…...

CSP-J 复赛 模拟题6

1.大小写字母互换&#xff1a; 题目描述 由输入给定一个字符串&#xff0c;你的任务是将原字符串中的大写字母转换成其对应的小写字母&#xff0c;还要将原字符串中的小写字母转换成对应的大写字母&#xff0c;其余字符不变。 输出转换之后得到的新字符串。 输入格式 一行…...

拷贝函数的三种调用方式

1.使用一个已经创建完成的对象来初始化一个新对象&#xff0c;就比如有参构造接收了一个属性后拷贝构造copy它后可以将获取的值赋值给自己的属性 记得拷贝后还要再进行赋值才行 2.值传递的方式给函数参数 额外声明一点&#xff0c;因为我们知道struct和class很相似&#xff0c…...

C语言 | Leetcode C语言题解之第327题区间和的个数

题目&#xff1a; 题解&#xff1a; #define FATHER_NODE(i) (0 (i) ? -1 : ((i) - 1 >> 1)) #define LEFT_NODE(i) (((i) << 1) 1) #define RIGHT_NODE(i) (((i) << 1) 2)/* 优先队列&#xff08;小根堆&#xff09;。 */ typedef s…...

统计学:条件概率模型

照片由Edge2Edge Media在Unsplash上拍摄 一、介绍 在概率的许多应用中&#xff0c;不可能直接观察实验的结果&#xff1b;而是观察与结果相关的事件。因此&#xff0c;条件概率模型对于考虑和利用从观察到的事件中获得的信息至关重要。此外&#xff0c;条件概率模型与贝叶斯定理…...

前端工程师学习springboot2.x之配置idea热更新实现高效率开发节奏

目前已经学习springboot实现了增删改查分页查询&#xff0c;每次修改业财或者是代码重启项目都让我觉得很闹心&#xff0c;现在给出idea2021版本自带热更新操作设置&#xff0c;设置过程分享给大家 总结&#xff1a;以上就是配置的全部过程&#xff0c;祝大家写代码快乐…...

文本rerank与图像rerank

1、文本rerank&#xff1a; 这里介绍的是目前比较流行和通用一套方案&#xff1a;先利用特征检索&#xff08;这里是特征空间上的相似度&#xff09;&#xff0c;召回相关信息&#xff0c;然后对query与召回的相关信息进行rerank&#xff08;这里是利用cross-encoder网络做一个…...

Docker 在 Windows 系统下的使用指南:数据卷和数据库

Docker 在 Windows 系统下的使用指南&#xff1a;数据卷和数据库 Docker 提供了强大的功能来创建、管理和持久化数据。数据卷是 Docker 中用于存储和管理数据的机制&#xff0c;使得数据能够在容器的生命周期之外持久化。数据库容器可以利用数据卷来持久化数据库文件&#xff…...

[数据集][目标检测]轴承缺陷划痕检测数据集VOC+YOLO格式1166张1类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;1166 标注数量(xml文件个数)&#xff1a;1166 标注数量(txt文件个数)&#xff1a;1166 标注…...

将本地微服务发布到docker镜像二:

上一篇文章我们介绍了如何将一个简单的springboot服务发布到docker镜像中&#xff0c;这一篇我们将介绍如何将一个复杂的微服务&#xff08;关联mysql、redis&#xff09;发布到docker镜像。 我们将使用以下两种不同的方式来实现此功能。 redis、mysql、springboot微服务分开…...

19c补丁后oracle属主变化,导致不能识别磁盘组

补丁后服务器重启&#xff0c;数据库再次无法启动 ORA01017: invalid username/password; logon denied Oracle 19c 在打上 19.23 或以上补丁版本后&#xff0c;存在与用户组权限相关的问题。具体表现为&#xff0c;Oracle 实例的运行用户&#xff08;oracle&#xff09;和集…...

Vue记事本应用实现教程

文章目录 1. 项目介绍2. 开发环境准备3. 设计应用界面4. 创建Vue实例和数据模型5. 实现记事本功能5.1 添加新记事项5.2 删除记事项5.3 清空所有记事 6. 添加样式7. 功能扩展&#xff1a;显示创建时间8. 功能扩展&#xff1a;记事项搜索9. 完整代码10. Vue知识点解析10.1 数据绑…...

【入坑系列】TiDB 强制索引在不同库下不生效问题

文章目录 背景SQL 优化情况线上SQL运行情况分析怀疑1:执行计划绑定问题?尝试:SHOW WARNINGS 查看警告探索 TiDB 的 USE_INDEX 写法Hint 不生效问题排查解决参考背景 项目中使用 TiDB 数据库,并对 SQL 进行优化了,添加了强制索引。 UAT 环境已经生效,但 PROD 环境强制索…...

Debian系统简介

目录 Debian系统介绍 Debian版本介绍 Debian软件源介绍 软件包管理工具dpkg dpkg核心指令详解 安装软件包 卸载软件包 查询软件包状态 验证软件包完整性 手动处理依赖关系 dpkg vs apt Debian系统介绍 Debian 和 Ubuntu 都是基于 Debian内核 的 Linux 发行版&#xff…...

python爬虫:Newspaper3k 的详细使用(好用的新闻网站文章抓取和解析的Python库)

更多内容请见: 爬虫和逆向教程-专栏介绍和目录 文章目录 一、Newspaper3k 概述1.1 Newspaper3k 介绍1.2 主要功能1.3 典型应用场景1.4 安装二、基本用法2.2 提取单篇文章的内容2.2 处理多篇文档三、高级选项3.1 自定义配置3.2 分析文章情感四、实战案例4.1 构建新闻摘要聚合器…...

今日科技热点速览

&#x1f525; 今日科技热点速览 &#x1f3ae; 任天堂Switch 2 正式发售 任天堂新一代游戏主机 Switch 2 今日正式上线发售&#xff0c;主打更强图形性能与沉浸式体验&#xff0c;支持多模态交互&#xff0c;受到全球玩家热捧 。 &#x1f916; 人工智能持续突破 DeepSeek-R1&…...

聊一聊接口测试的意义有哪些?

目录 一、隔离性 & 早期测试 二、保障系统集成质量 三、验证业务逻辑的核心层 四、提升测试效率与覆盖度 五、系统稳定性的守护者 六、驱动团队协作与契约管理 七、性能与扩展性的前置评估 八、持续交付的核心支撑 接口测试的意义可以从四个维度展开&#xff0c;首…...

Spring AI与Spring Modulith核心技术解析

Spring AI核心架构解析 Spring AI&#xff08;https://spring.io/projects/spring-ai&#xff09;作为Spring生态中的AI集成框架&#xff0c;其核心设计理念是通过模块化架构降低AI应用的开发复杂度。与Python生态中的LangChain/LlamaIndex等工具类似&#xff0c;但特别为多语…...

均衡后的SNRSINR

本文主要摘自参考文献中的前两篇&#xff0c;相关文献中经常会出现MIMO检测后的SINR不过一直没有找到相关数学推到过程&#xff0c;其中文献[1]中给出了相关原理在此仅做记录。 1. 系统模型 复信道模型 n t n_t nt​ 根发送天线&#xff0c; n r n_r nr​ 根接收天线的 MIMO 系…...

10-Oracle 23 ai Vector Search 概述和参数

一、Oracle AI Vector Search 概述 企业和个人都在尝试各种AI&#xff0c;使用客户端或是内部自己搭建集成大模型的终端&#xff0c;加速与大型语言模型&#xff08;LLM&#xff09;的结合&#xff0c;同时使用检索增强生成&#xff08;Retrieval Augmented Generation &#…...