网站制作学习网经验与学习→正文:OpenSearch 安装
字体:

OpenSearch 安装

经验与学习 2025/11/12 20:19:09  点击:不统计

http://www.forasp.cn/

 在 Ubuntu 上安装 OpenSearch 可以通过官方提供的 Debian 包 或 Docker 来进行。下面我给你一个详细、可直接操作的步骤(以 Ubuntu 20.04/22.04 为例)
 
1.安装 Java(OpenSearch 需要 Java 17+)
 
OpenSearch 自带 OpenJDK 17,但如果你想用系统 Java 也可以:
 
sudo apt update
sudo apt install -y openjdk-17-jdk
java -version
 
确保输出类似:
openjdk version "17.x.x"
 
2️.下载并安装 OpenSearch Debian 包
2.1 下载 OpenSearch
 
到 OpenSearch 官方下载页面
 选择 Debian .deb 包:
 
wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.9.0/opensearch-2.9.0-linux-x64.deb
 
 
注意:版本号可以根据你需要选择最新的稳定版本。
 
2.2 安装包
sudo dpkg -i opensearch-2.9.0-linux-x64.deb
 
3.配置 OpenSearch
 
OpenSearch 配置文件在:/etc/opensearch/opensearch.yml
常用配置:
 
cluster.name: my-opensearch-cluster
node.name: node-1
network.host: 0.0.0.0   # 允许外部访问
http.port: 9200
discovery.type: single-node  # 单节点模式
⚠️ 如果用于生产环境,需要开启安全认证(用户名/密码)。
下面是开启https 证书
plugins.security.ssl.transport.pemcert_filepath: esnode.pem
plugins.security.ssl.transport.pemkey_filepath: esnode-key.pem
plugins.security.ssl.transport.pemtrustedcas_filepath: root-ca.pem
plugins.security.ssl.transport.enforce_hostname_verification: false
 
plugins.security.ssl.http.enabled: true
plugins.security.ssl.http.pemcert_filepath: esnode.pem
plugins.security.ssl.http.pemkey_filepath: esnode-key.pem
plugins.security.ssl.http.pemtrustedcas_filepath: root-ca.pem
plugins.security.allow_unsafe_democertificates: true
plugins.security.allow_default_init_securityindex: true

4.启动 OpenSearch
sudo systemctl daemon-reload
sudo systemctl enable opensearch
sudo systemctl start opensearch
 
 
检查状态:
 
sudo systemctl status opensearch
 
5.测试 OpenSearch 在本机执行:
# 默认访问:
curl -k -u admin:admin https://127.0.0.1:9200/
 
返回结果:
{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "zBFxptErSquErr0OajHpFA",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.9.0",
    "build_type" : "deb",
    "build_hash" : "1164221ee2b8ba3560f0ff492309867beea28433",
    "build_date" : "2023-07-18T21:22:32.045158091Z",
    "build_snapshot" : false,
    "lucene_version" : "9.7.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}
}
 
6(可选)安装 OpenSearch Dashboards
 
OpenSearch Dashboards 提供可视化界面:
 
wget https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.9.0/opensearch-dashboards-2.9.0-linux-x64.deb
sudo dpkg -i opensearch-dashboards-2.9.0-linux-x64.deb
sudo systemctl enable opensearch-dashboards
sudo systemctl start opensearch-dashboards
 
 
访问浏览器:http://<你的IP>:5601
 

·上一篇:vscode trae cursor 编辑器字体配置 setting配置 >>    ·下一篇:ubuntu安装指定版本RabbitMQ >>
推荐文章
最新文章