Docs cn #3
+14
-2
@@ -21,6 +21,18 @@ const FORUM_URL = 'https://www.isharkfly.com/tag/opensearch';
|
||||
const CONTACT_URL = 'https://www.isharkfly.com/t/opensearch/15530';
|
||||
const REPO_URL = 'https://github.com/iSharkFly-Docs/opensearch-docs-cn';
|
||||
|
||||
// iSharkFly links shown as a dropdown at the end of the nav bar.
|
||||
function isharkflyNav(zh: boolean): DefaultTheme.NavItem {
|
||||
return {
|
||||
text: 'iSharkFly',
|
||||
items: [
|
||||
{ text: zh ? 'iSharkFly' : 'iSharkFly', link: FORUM_URL },
|
||||
{ text: zh ? '文档导航' : 'Docs Portal', link: 'https://docs.isharkfly.com/' },
|
||||
{ text: zh ? '本站源码' : 'Source Code', link: 'https://src.sharkdat.com/iSharkFly-Docs/OpenSearch-iSharkFly-Com' },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
// Sidebar group names (just-the-docs collection names from _config.yml).
|
||||
const zhSidebarText: Record<string, string> = {
|
||||
'About OpenSearch': '关于 OpenSearch',
|
||||
@@ -131,7 +143,7 @@ for (const [key, locale] of Object.entries(site.locales)) {
|
||||
{ text: '客户端', link: `${b}clients/`, activeMatch: `^${b}clients/` },
|
||||
{ text: 'Data Prepper', link: `${b}data-prepper/`, activeMatch: `^${b}data-prepper/` },
|
||||
{ text: 'Benchmark', link: `${b}benchmark/`, activeMatch: `^${b}benchmark/` },
|
||||
{ text: '中文论坛', link: FORUM_URL },
|
||||
isharkflyNav(true),
|
||||
],
|
||||
sidebar: mapSidebar(locale.sidebar, link => link, text => zhSidebarText[text] ?? text),
|
||||
},
|
||||
@@ -151,7 +163,7 @@ for (const [key, locale] of Object.entries(site.locales)) {
|
||||
{ text: 'Clients', link: `${enBase}clients/`, activeMatch: `^${enBase}clients/` },
|
||||
{ text: 'Data Prepper', link: `${enBase}data-prepper/`, activeMatch: `^${enBase}data-prepper/` },
|
||||
{ text: 'Benchmark', link: `${enBase}benchmark/`, activeMatch: `^${enBase}benchmark/` },
|
||||
{ text: 'Forum', link: FORUM_URL },
|
||||
isharkflyNav(false),
|
||||
],
|
||||
sidebar: mapSidebar(locale.sidebar, enLink, text => text),
|
||||
},
|
||||
|
||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ pipeline {
|
||||
DOCS_TOOLS = '.vitepress/node_modules'
|
||||
WRANGLER = '.vitepress/node_modules/.bin/wrangler'
|
||||
// 发布到线上的分支
|
||||
RELEASE_BRANCH = 'docs_cn'
|
||||
RELEASE_BRANCH = 'main'
|
||||
// Cloudflare API Token(Jenkins Secret text 凭据,需要 Workers Scripts:Edit 权限)
|
||||
CLOUDFLARE_API_TOKEN = credentials('sharkdat-cloudflare-api-token')
|
||||
// Cloudflare Account ID(Secret text 凭据)。设置后 wrangler 不再调用 /memberships 查询账号,
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
---
|
||||
title: 入门
|
||||
---
|
||||
|
||||
# OpenSearch 和 OpenSearch Dashboards
|
||||
<Badge type="tip" text="Version 2.12" />
|
||||
|
||||
本部分包含 OpenSearch 和 OpenSearch Dashboards 的文档。
|
||||
|
||||
## 入门
|
||||
|
||||
- [OpenSearch 简介](/intro)
|
||||
- [快速入门](/quickstart)
|
||||
- [安装 OpenSearch](/install-and-configure/install-opensearch/)
|
||||
- [安装 OpenSearch Dashboards](/install-and-configure/install-dashboards/)
|
||||
- [查看常见问题](https://opensearch.org/faq)
|
||||
|
||||
## 为什么使用 OpenSearch?
|
||||
|
||||
借助 OpenSearch,你可以实现以下用例:
|
||||
|
||||
<table style="table-layout: auto ; width: 100%;">
|
||||
<tbody>
|
||||
<tr style="text-align: center; vertical-align:center;">
|
||||
<td><img src="/images/1_search.png" class="no-border" alt="Fast, scalable full-text search" height="100"/></td>
|
||||
<td><img src="/images/2_monitoring.png" class="no-border" alt="Application and infrastructure monitoring" height="100"/></td>
|
||||
<td><img src="/images/3_security.png" class="no-border" alt="Security and event information management" height="100"/></td>
|
||||
<td><img src="/images/4_tracking.png" class="no-border" alt="Operational health tracking" height="100"/></td>
|
||||
</tr>
|
||||
<tr style="text-align: left; vertical-align:top; font-weight: bold; color: rgb(0,59,92)">
|
||||
<td>快速、可扩展的全文搜索</td>
|
||||
<td>应用程序和基础设施监控</td>
|
||||
<td>安全和事件信息管理</td>
|
||||
<td>运行健康状况跟踪</td>
|
||||
</tr>
|
||||
<tr style="text-align: left; vertical-align:top;">
|
||||
<td>帮助用户在你的应用程序、网站或数据湖目录中找到所需的信息。</td>
|
||||
<td>轻松存储和分析日志数据,并针对性能下降设置自动告警。</td>
|
||||
<td>集中管理日志,实现实时安全监控和取证分析。</td>
|
||||
<td>使用可观测性日志、指标和追踪实时监控你的应用程序和业务。</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
**其他功能和插件:**
|
||||
|
||||
OpenSearch 提供了多种功能和插件(plugin),帮助你索引、保护、监控和分析数据。大多数 OpenSearch 插件都有对应的 OpenSearch Dashboards 插件,提供方便、统一的用户界面。
|
||||
- [异常检测](/observing-your-data/ad/) - 识别异常数据并接收自动通知
|
||||
- [KNN](/search-plugins/knn/) - 在向量数据中查找「最近邻」
|
||||
- [Performance Analyzer](/monitoring-your-cluster/pa/) - 监控和优化你的集群
|
||||
- [SQL](/search-plugins/sql/) - 使用 SQL 或管道处理语言查询数据
|
||||
- [索引状态管理](/im-plugin/) - 自动执行索引操作
|
||||
- [ML Commons 插件](/ml-commons-plugin/) - 训练和运行机器学习模型
|
||||
- [异步搜索](/search-plugins/async/) - 在后台运行搜索请求
|
||||
- [跨集群复制](/tuning-your-cluster/replication-plugin/) - 在多个 OpenSearch 集群之间复制数据
|
||||
|
||||
## 安全的前进之路
|
||||
OpenSearch 自带一套演示配置,便于你快速上手。但在生产环境中使用 OpenSearch 之前,你必须使用自己的证书、身份验证方法、用户和密码[手动配置 Security 插件](/security/configuration/)。
|
||||
|
||||
## 在找 Javadoc 吗?
|
||||
|
||||
请参阅 [opensearch.org/javadocs/](https://opensearch.org/javadocs/)。
|
||||
|
||||
## 参与贡献
|
||||
|
||||
[OpenSearch](https://opensearch.org) 由 Amazon Web Services 提供支持。所有组件均在 [GitHub](https://github.com/opensearch-project/) 上以 [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.html) 许可证提供。
|
||||
本项目欢迎 GitHub issue、缺陷修复、新功能、插件、文档——任何贡献都可以。要参与贡献,请参阅 OpenSearch 网站上的[贡献指南](https://opensearch.org/source.html)。
|
||||
|
||||
---
|
||||
|
||||
<small>OpenSearch 包含来自 Elasticsearch B.V. 的部分 Apache 许可的 Elasticsearch 代码以及其他源代码。Elasticsearch B.V. 不是这些其他源代码的来源。ELASTICSEARCH 是 Elasticsearch B.V. 的注册商标。</small>
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: 破坏性变更
|
||||
---
|
||||
|
||||
## 1.x {#x}
|
||||
|
||||
### 迁移到 OpenSearch 以及嵌套 JSON 对象数量的限制
|
||||
|
||||
如果集群中存在任何文档在所有字段中包含超过 10,000 个嵌套 JSON 对象,那么从 Elasticsearch OSS 6.8 版本迁移到 OpenSearch 1.x 版本将会失败。Elasticsearch 7.0 版本引入了 `index.mapping.nested_objects.limit` 设置以防止内存溢出错误,并将该设置的默认值设为 `10000`。OpenSearch 从一开始就采用了此设置,并强制执行嵌套 JSON 对象的限制。然而,由于 Elasticsearch 6.8 中不存在该设置,该版本也无法识别它,因此当任何文档中的嵌套 JSON 对象数量超过默认限制时,迁移到 OpenSearch 1.x 可能会导致不兼容问题,从而阻止分片在 Elasticsearch 6.8 和 OpenSearch 1.x 版本之间重新分配。
|
||||
|
||||
因此,我们建议在尝试从 Elasticsearch 6.8 迁移之前,先评估你的数据是否超出这些限制。
|
||||
|
||||
## 2.0.0 {#section}
|
||||
|
||||
### 移除映射类型参数
|
||||
|
||||
`type` 参数已从所有 OpenSearch API 端点中移除。取而代之的是,可以按文档类型对索引进行分类。有关更多详细信息,请参阅 issue [#1940](https://github.com/opensearch-project/opensearch/issues/1940)。
|
||||
|
||||
### 弃用非包容性术语
|
||||
|
||||
非包容性术语在 2.x 版本中已被弃用,并将在 OpenSearch 3.0 中被永久移除。我们使用以下替代术语:
|
||||
|
||||
- "Whitelist" 现在改为 "Allow list"
|
||||
- "Blacklist" 现在改为 "Deny list"
|
||||
- "Master" 现在改为 "Cluster Manager"
|
||||
|
||||
### 添加 OpenSearch Notifications 插件
|
||||
|
||||
在 OpenSearch 2.0 中,Alerting 插件现已与新的 Notifications 插件集成。如果你想继续使用 Alerting 插件中的通知操作,请安装新的后端插件 `notifications-core` 和 `notifications`。如果你想在 OpenSearch Dashboards 中管理通知,请使用新的 `notificationsDashboards` 插件。有关更多信息,请参阅 OpenSearch 文档页面上的[通知](/observing-your-data/notifications/)。
|
||||
|
||||
### 不再支持 JDK 8
|
||||
|
||||
由于 Lucene 升级,OpenSearch 不得不放弃对 JDK 8 的支持。因此,[Java 高级 REST 客户端](/clients/java-rest-high-level)不再支持 JDK 8。恢复对 JDK 8 的支持目前是 `opensearch-java` 的一项提案 [#156](https://github.com/opensearch-project/opensearch-java/issues/156),这需要从 Java 客户端中移除对 OpenSearch 核心的依赖(issue [#262](https://github.com/opensearch-project/opensearch-java/issues/262))。
|
||||
|
||||
## 2.5.0 {#section-1}
|
||||
|
||||
### 文本字段的通配符查询行为
|
||||
|
||||
OpenSearch 2.5 包含一项缺陷修复,纠正了文本字段上 `wildcard` 查询的 `case_insensitive` 参数的行为。因此,在此修复之前忽略大小写并错误返回结果的文本字段通配符查询,将不再返回相同的结果。有关更多信息,请参阅 issue [#8711](https://github.com/opensearch-project/OpenSearch/issues/8711)。
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
title: 配置 OpenSearch Dashboards
|
||||
---
|
||||
|
||||
# 配置 OpenSearch Dashboards
|
||||
|
||||
OpenSearch Dashboards 在你启动集群时使用 `opensearch_dashboards.yml` 配置文件读取设置。在每个节点上,你可以在 `/usr/share/opensearch-dashboards/config/opensearch_dashboards.yml`(Docker)或 `/etc/opensearch-dashboards/opensearch_dashboards.yml`(大多数 Linux 发行版)中找到 `opensearch_dashboards.yml`。
|
||||
|
||||
有关 OpenSearch Dashboards 设置的信息,请参阅示例 [`opensearch_dashboards.yml`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/config/opensearch_dashboards.yml) 文件。
|
||||
@@ -0,0 +1,69 @@
|
||||
---
|
||||
title: 可用性和恢复设置
|
||||
---
|
||||
|
||||
# 可用性和恢复设置
|
||||
|
||||
可用性和恢复设置包括以下方面的设置:
|
||||
|
||||
- [快照](#snapshot-settings)
|
||||
- [集群管理器任务限流](#cluster-manager-task-throttling-settings)
|
||||
- [远程存储](#remote-backed-storage-settings)
|
||||
- [搜索背压](#search-backpressure-settings)
|
||||
- [分片索引背压](#shard-indexing-backpressure-settings)
|
||||
- [段复制](#segment-replication-settings)
|
||||
- [跨集群复制](#cross-cluster-replication-settings)
|
||||
|
||||
要了解有关静态设置和动态设置的更多信息,请参阅[配置 OpenSearch](/install-and-configure/configuring-opensearch/)。
|
||||
|
||||
## 快照设置
|
||||
|
||||
OpenSearch 支持以下快照(Snapshot)设置:
|
||||
|
||||
- `snapshot.max_concurrent_operations`(动态,integer):并发快照操作的最大数量。默认值为 `1000`。
|
||||
|
||||
### 与安全相关的快照设置
|
||||
|
||||
有关与安全相关的快照设置,请参阅[安全设置](/install-and-configure/configuring-opensearch/security-settings)。
|
||||
|
||||
### 文件系统设置
|
||||
|
||||
有关文件系统设置的信息,请参阅[共享文件系统](/tuning-your-cluster/availability-and-recovery/snapshots/snapshot-restore#shared-file-system)。
|
||||
|
||||
### Amazon S3 设置
|
||||
|
||||
有关 Amazon S3 存储库设置的信息,请参阅 [Amazon S3](/tuning-your-cluster/availability-and-recovery/snapshots/snapshot-restore#amazon-s3)。
|
||||
|
||||
## 集群管理器任务限流设置
|
||||
|
||||
有关集群管理器任务限流设置的信息,请参阅[设置限流阈值](/tuning-your-cluster/cluster-manager-task-throttling#setting-throttling-limits)。
|
||||
|
||||
## 远程存储设置
|
||||
|
||||
OpenSearch 支持以下集群级远程存储(Remote Store)设置:
|
||||
|
||||
- `cluster.remote_store.translog.buffer_interval`(动态,time unit):执行定期 translog 更新时使用的 translog 缓冲间隔的默认值。仅当索引设置 `index.remote_store.translog.buffer_interval` 不存在时,此设置才生效。
|
||||
|
||||
- `remote_store.moving_average_window_size`(动态,integer):用于计算通过 [Remote Store Stats API](/tuning-your-cluster/availability-and-recovery/remote-store/remote-store-stats-api) 公开的滚动统计值的移动平均窗口大小。默认值为 `20`。强制的最小值为 `5`。
|
||||
|
||||
有关更多远程存储设置,请参阅[远程存储](/tuning-your-cluster/availability-and-recovery/remote-store/)和[配置远程存储](/tuning-your-cluster/availability-and-recovery/remote-store/#configuring-remote-backed-storage)。
|
||||
|
||||
有关远程段背压设置,请参阅[远程段背压设置](/tuning-your-cluster/availability-and-recovery/remote-store/remote-segment-backpressure#remote-segment-backpressure-settings)。
|
||||
|
||||
## 搜索背压设置
|
||||
|
||||
搜索背压(Search Backpressure)是一种用于识别资源密集型搜索请求,并在节点负载过高时取消这些请求的机制。有关更多信息,请参阅[搜索背压设置](/tuning-your-cluster/availability-and-recovery/search-backpressure#search-backpressure-settings)。
|
||||
|
||||
## 分片索引背压设置
|
||||
|
||||
分片索引背压(Shard Indexing Backpressure)是一种分片级别的智能拒绝机制,当集群承受压力时,它会动态拒绝索引请求。有关更多信息,请参阅分片索引背压[设置](/tuning-your-cluster/availability-and-recovery/shard-indexing-settings)。
|
||||
|
||||
## 段复制设置
|
||||
|
||||
有关段复制(Segment Replication)设置的信息,请参阅[段复制](/tuning-your-cluster/availability-and-recovery/segment-replication/)。
|
||||
|
||||
有关段复制背压设置的信息,请参阅[段复制背压](/tuning-your-cluster/availability-and-recovery/segment-replication/backpressure)。
|
||||
|
||||
## 跨集群复制设置
|
||||
|
||||
有关跨集群复制(Cross-cluster Replication)设置的信息,请参阅[复制设置](/tuning-your-cluster/replication-plugin/settings)。
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
title: 断路器设置
|
||||
---
|
||||
|
||||
# 断路器设置
|
||||
|
||||
断路器(Circuit Breaker)可以防止 OpenSearch 引发 Java OutOfMemoryError。父断路器指定所有子断路器可用的内存总量。子断路器指定其自身可用的内存总量。
|
||||
|
||||
要了解有关静态设置和动态设置的更多信息,请参阅[配置 OpenSearch](/install-and-configure/configuring-opensearch/)。
|
||||
|
||||
## 父断路器设置
|
||||
|
||||
OpenSearch 支持以下父断路器设置:
|
||||
|
||||
- `indices.breaker.total.use_real_memory`(静态,Boolean):如果为 `true`,父断路器会考虑实际内存使用量。否则,父断路器会考虑子断路器预留的内存量。默认值为 `true`。
|
||||
|
||||
- `indices.breaker.total.limit`(动态,percentage):指定父断路器的初始内存限制。如果 `indices.breaker.total.use_real_memory` 为 `true`,默认值为 JVM 堆的 95%。如果 `indices.breaker.total.use_real_memory` 为 `false`,默认值为 JVM 堆的 70%。
|
||||
|
||||
## 字段数据断路器设置
|
||||
|
||||
字段数据断路器限制将字段加载到字段数据缓存中所需的堆内存。OpenSearch 支持以下字段数据断路器设置:
|
||||
|
||||
- `indices.breaker.fielddata.limit`(动态,percentage):指定字段数据断路器的内存限制。默认值为 JVM 堆的 40%。
|
||||
|
||||
- `indices.breaker.fielddata.overhead`(动态,double):一个常数,字段数据估算值乘以该常数即得到最终估算值。默认值为 1.03。
|
||||
|
||||
## 请求断路器设置
|
||||
|
||||
请求断路器限制构建请求所需数据结构(例如计算聚合时)所需的内存。OpenSearch 支持以下请求断路器设置:
|
||||
|
||||
- `indices.breaker.request.limit`(动态,percentage):指定请求断路器的内存限制。默认值为 JVM 堆的 60%。
|
||||
|
||||
- `indices.breaker.request.overhead`(动态,double):一个常数,请求估算值乘以该常数即得到最终估算值。默认值为 1。
|
||||
|
||||
## 传输中请求断路器设置
|
||||
|
||||
传输中请求断路器限制传输层和 HTTP 层上当前正在运行的所有传入请求的内存使用量。请求的内存使用量基于请求的内容长度,包括原始请求以及表示该请求的结构化对象所需的内存。OpenSearch 支持以下传输中请求断路器设置:
|
||||
|
||||
- `network.breaker.inflight_requests.limit`(动态,percentage):指定传输中请求断路器的内存限制。默认值为 JVM 堆的 100%(因此,传输中请求的内存使用限制由父断路器的内存限制决定)。
|
||||
|
||||
- `network.breaker.inflight_requests.overhead`(动态,double):一个常数,传输中请求估算值乘以该常数即得到最终估算值。默认值为 2。
|
||||
|
||||
## 脚本编译断路器设置
|
||||
|
||||
脚本编译断路器限制在一个时间间隔内内联脚本的编译次数。OpenSearch 支持以下脚本编译断路器设置:
|
||||
|
||||
- `script.max_compilations_rate`(动态,rate):对于给定上下文,在一个时间间隔内编译的唯一动态脚本的最大数量。默认值为每 5 分钟 150 个(`150/5m`)。
|
||||
|
||||
## 正则表达式断路器设置
|
||||
|
||||
正则表达式断路器用于启用或禁用正则表达式,并限制其复杂度。OpenSearch 支持以下正则表达式断路器设置:
|
||||
|
||||
- `script.painless.regex.enabled`(静态,string):在 Painless 脚本中启用正则表达式。
|
||||
有效值为:
|
||||
- `limited`:启用正则表达式,并使用 `script.painless.regex.limit-factor` 设置限制其复杂度。
|
||||
- `true`:启用正则表达式。关闭正则表达式断路器,不限制正则表达式的复杂度。
|
||||
- `false`:禁用正则表达式。如果 Painless 脚本包含正则表达式,则返回错误。
|
||||
|
||||
默认值为 `limited`。
|
||||
|
||||
- `script.painless.regex.limit-factor`(静态,integer):仅当 `script.painless.regex.enabled` 设置为 `limited` 时才适用。限制 Painless 脚本中正则表达式的字符数。字符数上限的计算方式为:脚本输入中的字符数乘以 `script.painless.regex.limit-factor`。默认值为 6(因此,如果输入有 5 个字符,则正则表达式中的最大字符数为 5 · 6 = 30)。
|
||||
@@ -0,0 +1,140 @@
|
||||
---
|
||||
title: 集群设置
|
||||
---
|
||||
|
||||
# 集群设置
|
||||
|
||||
以下设置与 OpenSearch 集群相关。
|
||||
|
||||
要了解有关静态设置和动态设置的更多信息,请参阅[配置 OpenSearch](/install-and-configure/configuring-opensearch/)。
|
||||
|
||||
## 集群级路由和分配设置
|
||||
|
||||
OpenSearch 支持以下集群级路由和分片分配设置。此列表中的所有设置都是动态的:
|
||||
|
||||
- `cluster.routing.allocation.enable`(String):为特定类型的分片启用或禁用分配。
|
||||
|
||||
有效值为:
|
||||
- `all` – 允许为所有类型的分片分配。
|
||||
- `primaries` – 仅允许为主分片分配。
|
||||
- `new_primaries` – 仅允许为新索引的主分片分配。
|
||||
- `none` – 不允许为任何索引分配分片。
|
||||
|
||||
默认值为 `all`。
|
||||
|
||||
- `cluster.routing.allocation.node_concurrent_incoming_recoveries`(Integer):配置一个节点上允许同时进行多少个传入分片恢复。默认值为 `2`。
|
||||
|
||||
- `cluster.routing.allocation.node_concurrent_outgoing_recoveries`(Integer):配置一个节点上允许同时进行多少个传出分片恢复。默认值为 `2`。
|
||||
|
||||
- `cluster.routing.allocation.node_concurrent_recoveries`(String):用于将 `cluster.routing.allocation.node_concurrent_incoming_recoveries` 和 `cluster.routing.allocation.node_concurrent_outgoing_recoveries` 设置为相同的值。
|
||||
|
||||
- `cluster.routing.allocation.node_initial_primaries_recoveries`(Integer):设置节点重启后未分配主分片的恢复数量。默认值为 `4`。
|
||||
|
||||
- `cluster.routing.allocation.same_shard.host`(Boolean):设置为 `true` 时,会阻止将同一分片的多个副本分配到同一主机上的不同节点。默认值为 `false`。
|
||||
|
||||
- `cluster.routing.rebalance.enable`(String):为特定类型的分片启用或禁用重新平衡。
|
||||
|
||||
有效值为:
|
||||
- `all` – 允许对所有类型的分片进行平衡。
|
||||
- `primaries` – 仅允许对主分片进行平衡。
|
||||
- `replicas` – 仅允许对副本分片进行平衡。
|
||||
- `none` – 不允许对任何索引进行分片平衡。
|
||||
|
||||
默认值为 `all`。
|
||||
|
||||
- `cluster.routing.allocation.allow_rebalance`(String):指定何时允许分片重新平衡。
|
||||
|
||||
有效值为:
|
||||
- `always` – 始终允许重新平衡。
|
||||
- `indices_primaries_active` – 仅当集群中的所有主分片都已分配时才允许重新平衡。
|
||||
- `indices_all_active` – 仅当集群中的所有分片都已分配时才允许重新平衡。
|
||||
|
||||
默认值为 `indices_all_active`。
|
||||
|
||||
- `cluster.routing.allocation.cluster_concurrent_rebalance`(Integer):用于控制整个集群中允许同时进行多少个分片重新平衡。默认值为 `2`。
|
||||
|
||||
- `cluster.routing.allocation.balance.shard`(Floating point):定义每个节点上分配的分片总数的权重因子。默认值为 `0.45`。
|
||||
|
||||
- `cluster.routing.allocation.balance.index`(Floating point):定义节点上分配的每个索引的分片数量的权重因子。默认值为 `0.55`。
|
||||
|
||||
- `cluster.routing.allocation.balance.threshold`(Floating point):应执行的操作的最小优化值。默认值为 `1.0`。
|
||||
|
||||
- `cluster.routing.allocation.balance.prefer_primary`(Boolean):设置为 `true` 时,OpenSearch 会尝试在集群节点之间均匀分配主分片。启用此设置并不总能保证每个节点上的主分片数量相等,尤其是在发生故障转移的情况下。将此设置从 `true` 改为 `false` 不会触发主分片的重新分配。默认值为 `false`。
|
||||
|
||||
- `cluster.routing.allocation.disk.threshold_enabled`(Boolean):设置为 `false` 时,禁用磁盘分配决策器。禁用后还会移除所有现有的 `index.blocks.read_only_allow_delete index blocks`。默认值为 `true`。
|
||||
|
||||
- `cluster.routing.allocation.disk.watermark.low`(String):控制磁盘使用率的低水位线。设置为百分比时,OpenSearch 不会将分片分配给磁盘使用率达到该百分比的节点。也可以输入比率值,例如 `0.85`。此外,还可以设置为字节值,例如 `400mb`。此设置不影响新创建索引的主分片,但会阻止分配其副本。默认值为 `85%`。
|
||||
|
||||
- `cluster.routing.allocation.disk.watermark.high`(String):控制高水位线。OpenSearch 会尝试将分片从磁盘使用率高于所定义百分比的节点上迁移出去。也可以输入比率值,例如 `0.85`。此外,还可以设置为字节值,例如 `400mb`。此设置影响所有分片的分配。默认值为 `90%`。
|
||||
|
||||
- `cluster.routing.allocation.disk.watermark.flood_stage`(String):控制洪水阶段水位线。这是防止节点耗尽磁盘空间的最后手段。对于在该节点上分配了一个或多个分片、并且至少有一个磁盘超过洪水阶段的每个索引,OpenSearch 都会强制施加只读索引块(`index.blocks.read_only_allow_delete`)。一旦磁盘使用率降到高水位线以下,该索引块就会被解除。也可以输入比率值,例如 `0.85`。此外,还可以设置为字节值,例如 `400mb`。默认值为 `95%`。
|
||||
|
||||
- `cluster.info.update.interval`(Time unit):设置 OpenSearch 检查集群中每个节点磁盘使用情况的频率。默认值为 `30s`。
|
||||
|
||||
- `cluster.routing.allocation.include.<attribute>`(Enum):将分片分配给其 `attribute` 至少包含所列逗号分隔值之一的节点。
|
||||
|
||||
- `cluster.routing.allocation.require.<attribute>`(Enum):仅将分片分配给其 `attribute` 包含所列全部逗号分隔值的节点。
|
||||
|
||||
- `cluster.routing.allocation.exclude.<attribute>`(Enum):不将分片分配给其 `attribute` 包含所列任意逗号分隔值的节点。集群分配设置支持以下内置属性。
|
||||
|
||||
有效值为:
|
||||
- `_name` – 按节点名称匹配节点。
|
||||
- `_host_ip` – 按主机 IP 地址匹配节点。
|
||||
- `_publish_ip` – 按发布 IP 地址匹配节点。
|
||||
- `_ip` – 匹配 `_host_ip` 或 `_publish_ip`。
|
||||
- `_host` – 按主机名匹配节点。
|
||||
- `_id` – 按节点 ID 匹配节点。
|
||||
- `_tier` – 按数据层角色匹配节点。
|
||||
|
||||
- `cluster.routing.allocation.shard_movement_strategy`(Enum):决定分片从传出节点迁移到传入节点的顺序。
|
||||
|
||||
此设置支持以下策略:
|
||||
- `PRIMARY_FIRST` – 先迁移主分片,再迁移副本分片。如果迁移中的节点在过程中发生故障,这种优先顺序可能有助于防止集群健康状态变为红色。
|
||||
- `REPLICA_FIRST` – 先迁移副本分片,再迁移主分片。在启用了段复制的混合版本 OpenSearch 集群中进行分片迁移时,这种优先顺序可能有助于防止集群健康状态变为红色。在这种情况下,迁移到较新版本 OpenSearch 节点上的主分片可能会尝试将段文件复制到较旧版本 OpenSearch 上的副本分片,从而导致分片故障。在多版本集群中,先迁移副本分片可能有助于避免这种情况。
|
||||
- `NO_PREFERENCE` – 默认行为,分片迁移的顺序无关紧要。
|
||||
|
||||
## 集群级分片、块和任务设置
|
||||
|
||||
OpenSearch 支持以下集群级分片、块和任务设置:
|
||||
|
||||
- `cluster.blocks.read_only`(Boolean):将整个集群设置为只读。默认值为 `false`。
|
||||
|
||||
- `cluster.blocks.read_only_allow_delete`(Boolean):与 `cluster.blocks.read_only` 类似,但允许删除索引。
|
||||
|
||||
- `cluster.max_shards_per_node`(Integer):限制集群的主分片和副本分片总数。该限制的计算方式为:`cluster.max_shards_per_node` 乘以非冻结数据节点的数量。已关闭索引的分片不计入此限制。默认值为 `1000`。
|
||||
|
||||
- `cluster.persistent_tasks.allocation.enable`(String):为持久任务启用或禁用分配。
|
||||
|
||||
有效值为:
|
||||
- `all` – 允许将持久任务分配给节点。
|
||||
- `none` – 不允许为持久任务分配。这不会影响已在运行的持久任务。
|
||||
|
||||
默认值为 `all`。
|
||||
|
||||
- `cluster.persistent_tasks.allocation.recheck_interval`(Time unit):当集群状态发生重大变化时,集群管理器会自动检查是否需要分配持久任务。还有其他一些因素(例如内存使用量)会影响持久任务是否被分配给节点,但这些因素不会导致集群状态发生变化。此设置定义了针对这些因素执行分配检查的频率。默认值为 `30 seconds`,最小值为 `10 seconds`。
|
||||
|
||||
## 集群级慢日志设置
|
||||
|
||||
有关更多信息,请参阅[搜索请求慢日志](/install-and-configure/configuring-opensearch/logs#search-request-slow-logs)。
|
||||
|
||||
- `cluster.search.request.slowlog.threshold.warn`(Time unit):设置请求级慢日志的 `WARN` 阈值。默认值为 `-1`。
|
||||
|
||||
- `cluster.search.request.slowlog.threshold.info`(Time unit):设置请求级慢日志的 `INFO` 阈值。默认值为 `-1`。
|
||||
|
||||
- `cluster.search.request.slowlog.threshold.debug`(Time unit):设置请求级慢日志的 `DEBUG` 阈值。默认值为 `-1`。
|
||||
|
||||
- `cluster.search.request.slowlog.threshold.trace`(Time unit):设置请求级慢日志的 `TRACE` 阈值。默认值为 `-1`。
|
||||
|
||||
- `cluster.search.request.slowlog.level`(String):设置要记录的最低慢日志级别:`WARN`、`INFO`、`DEBUG` 和 `TRACE`。默认值为 `TRACE`。
|
||||
|
||||
## 集群级索引设置
|
||||
|
||||
有关索引级索引设置的信息,请参阅[集群级索引设置](/install-and-configure/configuring-opensearch/index-settings#cluster-level-index-settings)。
|
||||
|
||||
## 集群级协调设置
|
||||
|
||||
OpenSearch 支持以下集群级协调设置。此列表中的所有设置都是动态的:
|
||||
|
||||
- `cluster.fault_detection.leader_check.timeout`(Time unit):在 leader 检查期间,节点等待已选举的集群管理器响应的时间,超过该时间则认为检查失败。有效值范围为 `1ms` 到 `60s`(含边界值)。默认值为 `10s`。将此设置更改为默认值以外的值可能会导致集群不稳定。
|
||||
|
||||
- `cluster.fault_detection.follower_check.timeout`(Time unit):在 follower 检查期间,已选举的集群管理器等待响应的时间,超过该时间则认为检查失败。有效值范围为 `1ms` 到 `60s`(含边界值)。默认值为 `10s`。将此设置更改为默认值以外的值可能会导致集群不稳定。
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: 配置和系统设置
|
||||
---
|
||||
|
||||
# 配置和系统设置
|
||||
|
||||
有关创建 OpenSearch 集群的概述以及配置设置示例,请参阅[创建集群](/tuning-your-cluster/)。要了解有关静态设置和动态设置的更多信息,请参阅[配置 OpenSearch](/install-and-configure/configuring-opensearch/)。
|
||||
|
||||
OpenSearch 支持以下系统设置:
|
||||
|
||||
- `cluster.name`(静态,string):集群名称。
|
||||
|
||||
- `node.name`(静态,string):节点的描述性名称。
|
||||
|
||||
- `node.roles`(静态,list):为 OpenSearch 节点定义一个或多个角色。有效值为 `cluster_manager`、`data`、`ingest`、`search`、`ml`、`remote_cluster_client` 和 `coordinating_only`。
|
||||
|
||||
- `path.data`(静态,string):存储数据的目录路径。多个位置之间用逗号分隔。
|
||||
|
||||
- `path.logs`(静态,string):日志文件的路径。
|
||||
|
||||
- `bootstrap.memory_lock`(静态,Boolean):在启动时锁定内存。我们建议将堆大小设置为系统可用内存的一半左右,并确保进程的所有者被允许使用此限制。当系统进行内存交换时,OpenSearch 的性能会很差。
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: 发现和网关设置
|
||||
---
|
||||
|
||||
# 发现和网关设置
|
||||
|
||||
以下是与发现和本地网关相关的设置。
|
||||
|
||||
要了解有关静态设置和动态设置的更多信息,请参阅[配置 OpenSearch](/install-and-configure/configuring-opensearch/)。
|
||||
|
||||
## 发现设置
|
||||
|
||||
发现过程在集群组建时使用,包括发现节点和选举集群管理节点(Cluster Manager Node)。OpenSearch 支持以下发现设置:
|
||||
|
||||
- `discovery.seed_hosts`(静态,list):节点启动时执行发现的主机列表。默认主机列表为 `["127.0.0.1", "[::1]"]`。
|
||||
|
||||
- `discovery.seed_providers`(静态,list):指定用于获取种子节点地址以启动发现过程的种子主机提供程序类型。
|
||||
|
||||
- `discovery.type`(静态,string):默认情况下,OpenSearch 会组建多节点集群。将 `discovery.type` 设置为 `single-node` 即可组建单节点集群。
|
||||
|
||||
- `cluster.initial_cluster_manager_nodes`(静态,list):用于引导集群的、有资格成为集群管理器的节点列表。
|
||||
|
||||
## 网关设置
|
||||
|
||||
本地网关存储集群重启时使用的集群状态和分片数据。OpenSearch 支持以下本地网关设置:
|
||||
|
||||
- `gateway.recover_after_nodes`(静态,integer):在整个集群重启后,开始恢复之前必须加入集群的节点数量。
|
||||
|
||||
- `gateway.recover_after_data_nodes`(静态,integer):在整个集群重启后,开始恢复之前必须加入集群的数据节点数量。
|
||||
|
||||
- `gateway.expected_data_nodes`(静态,integer):集群中预期存在的数据节点数量。当预期数量的节点加入集群后,即可开始恢复本地分片。
|
||||
|
||||
- `gateway.recover_after_time`(静态,time value):如果数据节点数量少于预期数量,在开始恢复之前需要等待的时间。
|
||||
@@ -0,0 +1,78 @@
|
||||
---
|
||||
title: 实验性功能标志
|
||||
---
|
||||
|
||||
# 实验性功能标志
|
||||
|
||||
OpenSearch 的版本中可能包含实验性功能,你可以根据需要启用或禁用这些功能。根据安装类型的不同,有多种启用功能标志的方法。
|
||||
|
||||
## 在 opensearch.yml 中启用 {#enable-in-opensearchyml}
|
||||
|
||||
如果你正在运行 OpenSearch 集群,并希望在配置文件中启用功能标志,请将以下行添加到 `opensearch.yml` 中:
|
||||
|
||||
```yaml
|
||||
opensearch.experimental.feature.<feature_name>.enabled: true
|
||||
```
|
||||
|
||||
## 在 Docker 容器中启用
|
||||
|
||||
如果你使用的是 Docker,请将以下行添加到 `docker-compose.yml` 中的 `opensearch-node` > `environment` 部分下:
|
||||
|
||||
```bash
|
||||
OPENSEARCH_JAVA_OPTS="-Dopensearch.experimental.feature.<feature_name>.enabled=true"
|
||||
```
|
||||
|
||||
## 在 tarball 安装中启用
|
||||
|
||||
要在 tarball 安装中启用功能标志,请在 `config/jvm.options` 或 `OPENSEARCH_JAVA_OPTS` 中提供新的 JVM 参数。
|
||||
|
||||
### 选项 1:修改 jvm.options {#option-1-modify-jvmoptions}
|
||||
|
||||
在启动 `opensearch` 进程之前,将以下行添加到 `config/jvm.options` 中,以启用该功能及其依赖项:
|
||||
|
||||
```bash
|
||||
-Dopensearch.experimental.feature.<feature_name>.enabled=true
|
||||
```
|
||||
|
||||
然后运行 OpenSearch:
|
||||
|
||||
```bash
|
||||
./bin/opensearch
|
||||
```
|
||||
|
||||
### 选项 2:使用环境变量启用
|
||||
|
||||
除了直接修改 `config/jvm.options` 之外,你还可以使用环境变量来定义这些属性。你可以在启动 OpenSearch 时通过单条命令完成,也可以使用 `export` 定义该变量。
|
||||
|
||||
要在启动 OpenSearch 时以内联方式添加功能标志,请运行以下命令:
|
||||
|
||||
```bash
|
||||
OPENSEARCH_JAVA_OPTS="-Dopensearch.experimental.feature.<feature_name>.enabled=true" ./opensearch-2.12.0/bin/opensearch
|
||||
```
|
||||
|
||||
如果你想在运行 OpenSearch 之前单独定义环境变量,请运行以下命令:
|
||||
|
||||
```bash
|
||||
export OPENSEARCH_JAVA_OPTS="-Dopensearch.experimental.feature.<feature_name>.enabled=true"
|
||||
```
|
||||
|
||||
```bash
|
||||
./bin/opensearch
|
||||
```
|
||||
|
||||
## 为 OpenSearch 开发启用
|
||||
|
||||
要在开发中启用功能标志,你必须在构建 OpenSearch 之前将正确的属性添加到 `run.gradle` 中。有关如何使用 Gradle 构建 OpenSearch 的信息,请参阅[开发者指南](https://github.com/opensearch-project/OpenSearch/blob/main/DEVELOPER_GUIDE.md)。
|
||||
|
||||
将以下属性添加到 run.gradle 中以启用该功能:
|
||||
|
||||
```gradle
|
||||
testClusters {
|
||||
runTask {
|
||||
testDistribution = 'archive'
|
||||
if (numZones > 1) numberOfZones = numZones
|
||||
if (numNodes > 1) numberOfNodes = numNodes
|
||||
systemProperty 'opensearch.experimental.feature.<feature_name>.enabled', 'true'
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,192 @@
|
||||
---
|
||||
title: 索引设置
|
||||
---
|
||||
|
||||
# 索引设置
|
||||
|
||||
索引设置分为两种类型:影响集群中所有索引的[集群级设置](#cluster-level-index-settings),以及影响单个索引的[索引级设置](#index-level-index-settings)。
|
||||
|
||||
要了解有关静态设置和动态设置的更多信息,请参阅[配置 OpenSearch](/install-and-configure/configuring-opensearch/)。
|
||||
|
||||
## 集群级索引设置
|
||||
|
||||
OpenSearch 支持以下集群级索引设置。此列表中的所有设置都是动态的:
|
||||
|
||||
- `action.auto_create_index`(Boolean):如果索引尚不存在,则自动创建该索引,同时应用已配置的所有索引模板(Index Template)。默认值为 `true`。
|
||||
|
||||
- `action.destructive_requires_name`(Boolean):设置为 `true` 时,删除索引时必须指定索引名称,不能删除所有索引或使用通配符。默认值为 `true`。
|
||||
|
||||
- `cluster.default.index.refresh_interval`(Time unit):设置未提供 `index.refresh_interval` 设置时的刷新间隔。当你希望为集群中的所有索引设置默认刷新间隔并支持 `searchIdle` 设置时,此设置非常有用。该间隔不能低于 `cluster.minimum.index.refresh_interval` 设置的值。
|
||||
|
||||
- `cluster.minimum.index.refresh_interval`(Time unit):设置最小刷新间隔,并将其应用于集群中的所有索引。`cluster.default.index.refresh_interval` 设置应高于此设置的值。如果在创建索引时 `index.refresh_interval` 设置低于所设定的最小值,则索引创建失败。
|
||||
|
||||
- `cluster.indices.close.enable`(Boolean):允许在 OpenSearch 中关闭已打开的索引。默认值为 `true`。
|
||||
|
||||
- `indices.recovery.max_bytes_per_sec`(String):限制每个节点的入站和出站恢复流量总量。此设置适用于对等恢复和快照恢复。默认值为 `40mb`。如果将恢复流量值设置为小于或等于 `0mb`,则会禁用速率限制,恢复数据将以尽可能高的速率传输。
|
||||
|
||||
- `indices.recovery.max_concurrent_file_chunks`(Integer):每个恢复操作并行发送的文件块数量。默认值为 `2`。
|
||||
|
||||
- `indices.recovery.max_concurrent_operations`(Integer):每次恢复并行发送的操作数量。默认值为 `1`。
|
||||
|
||||
- `indices.recovery.max_concurrent_remote_store_streams`(Integer):恢复远程存储索引时,可以并行打开的到远程存储库的流数量。默认值为 `20`。
|
||||
|
||||
- `indices.time_series_index.default_index_merge_policy`(String):此设置用于为时间序列索引(尤其是包含 `@timestamp` 字段的索引,例如数据流)指定默认合并策略。两个可用选项为 `tiered`(默认)和 `log_byte_size`。建议对时间序列索引使用 `log_byte_size`,以提升针对 `@timestamp` 字段的范围查询性能。要按索引覆盖合并策略,可以使用 `index.merge.policy` 索引设置。
|
||||
|
||||
- `indices.fielddata.cache.size`(String):字段数据缓存的最大大小。可以指定为绝对值(例如 `8GB`)或节点堆的百分比(例如 `50%`)。该值是静态的,因此必须在 `opensearch.yml` 文件中指定。如果不指定此设置,则最大大小不受限制。该值应小于 `indices.breaker.fielddata.limit`。有关更多信息,请参阅[字段数据断路器](/install-and-configure/configuring-opensearch/circuit-breaker#field-data-circuit-breaker-settings)。
|
||||
|
||||
## 索引级索引设置
|
||||
|
||||
你可以在创建索引时指定索引设置。索引设置有两种类型:
|
||||
|
||||
- [静态索引级索引设置](#static-index-level-index-settings)是在索引处于打开状态时无法更新的设置。要更新静态设置,必须先关闭索引,更新设置,然后重新打开索引。
|
||||
- [动态索引级索引设置](#dynamic-index-level-index-settings)是可以随时更新的设置。
|
||||
|
||||
### 在创建索引时指定设置
|
||||
|
||||
创建索引时,可以按如下方式指定其静态或动态设置:
|
||||
|
||||
```json
|
||||
PUT /testindex
|
||||
{
|
||||
"settings": {
|
||||
"index.number_of_shards": 1,
|
||||
"index.number_of_replicas": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 静态索引级索引设置
|
||||
|
||||
OpenSearch 支持以下静态索引级索引设置:
|
||||
|
||||
- `index.number_of_shards`(Integer):索引中主分片的数量。默认值为 1。
|
||||
|
||||
- `index.number_of_routing_shards`(Integer):用于拆分索引的路由分片数量。
|
||||
|
||||
- `index.shard.check_on_startup`(Boolean):是否检查索引的分片是否损坏。可用选项为 `false`(不检查损坏)、`checksum`(检查物理损坏)和 `true`(同时检查物理和逻辑损坏)。默认值为 `false`。
|
||||
|
||||
- `index.codec`(String):决定索引的存储字段如何压缩并存储在磁盘上。此设置会影响索引分片的大小和索引操作的性能。
|
||||
|
||||
有效值为:
|
||||
|
||||
- `default`
|
||||
- `best_compression`
|
||||
- `zstd`(OpenSearch 2.9 及更高版本)
|
||||
- `zstd_no_dict`(OpenSearch 2.9 及更高版本)
|
||||
|
||||
对于 `zstd` 和 `zstd_no_dict`,可以在 `index.codec.compression_level` 设置中指定压缩级别。有关更多信息,请参阅[索引编解码器设置](/im-plugin/index-codecs)。可选。默认值为 `default`。
|
||||
|
||||
- `index.codec.compression_level`(Integer):压缩级别设置在压缩率和速度之间进行权衡。较高的压缩级别会带来更高的压缩率(更小的存储空间),但代价是速度下降(压缩和解压缩速度变慢,导致索引和搜索延迟增加)。在 OpenSearch 2.9 及更高版本中,仅当 `index.codec` 设置为 `zstd` 和 `zstd_no_dict` 压缩级别时才能指定。有效值为 [1, 6] 范围内的整数。有关更多信息,请参阅[索引编解码器设置](/im-plugin/index-codecs)。可选。默认值为 3。
|
||||
|
||||
- `index.routing_partition_size`(Integer):自定义路由值可以路由到的分片数量。路由通过将值重新分配到一组分片而不是单个分片,来帮助解决集群不平衡的问题。要启用路由,请将此值设置为大于 1 但小于 `index.number_of_shards`。默认值为 1。
|
||||
|
||||
- `index.soft_deletes.retention_lease.period`(Time unit):保留分片操作历史的最长时间。默认值为 `12h`。
|
||||
|
||||
- `index.load_fixed_bitset_filters_eagerly`(Boolean):OpenSearch 是否应预加载缓存的过滤器。可用选项为 `true` 和 `false`。默认值为 `true`。
|
||||
|
||||
- `index.hidden`(Boolean):是否应隐藏该索引。隐藏索引不会在包含通配符的查询中返回。可用选项为 `true` 和 `false`。默认值为 `false`。
|
||||
|
||||
- `index.merge.policy`(String):此设置控制 Lucene 段的合并策略。可用选项为 `tiered` 和 `log_byte_size`。默认值为 `tiered`,但对于时间序列数据(例如日志事件),我们建议使用 `log_byte_size` 合并策略,它可以提升对 `@timestamp` 字段执行范围查询时的查询性能。我们建议不要更改现有索引的合并策略,而是在创建新索引时配置此设置。
|
||||
|
||||
- `index.merge_on_flush.enabled`(Boolean):此设置控制 Apache Lucene 的 merge-on-refresh 功能,该功能旨在通过 _on refresh_(用 OpenSearch 的术语来说是 _on flush_)执行合并来减少段的数量。默认值为 `true`。
|
||||
|
||||
- `index.merge_on_flush.max_full_flush_merge_wait_time`(Time unit):此设置用于设定启用 `index.merge_on_flush.enabled` 时等待合并的时间。默认值为 `10s`。
|
||||
|
||||
- `index.merge_on_flush.policy`(default | merge-on-flush):此设置控制启用 `index.merge_on_flush.enabled` 时应使用的合并策略。默认值为 `default`。
|
||||
|
||||
### 更新静态索引设置
|
||||
|
||||
只能在已关闭的索引上更新静态索引设置。以下示例演示如何更新索引编解码器设置。
|
||||
|
||||
首先,关闭索引:
|
||||
|
||||
```json
|
||||
POST /testindex/_close
|
||||
```
|
||||
|
||||
然后通过向 `_settings` 端点发送请求来更新设置:
|
||||
|
||||
```json
|
||||
PUT /testindex/_settings
|
||||
{
|
||||
"index": {
|
||||
"codec": "zstd_no_dict",
|
||||
"codec.compression_level": 3
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
最后,重新打开索引以启用读写操作:
|
||||
|
||||
```json
|
||||
POST /testindex/_open
|
||||
```
|
||||
|
||||
有关更新设置的更多信息(包括支持的查询参数),请参阅[更新设置](/api-reference/index-apis/update-settings)。
|
||||
|
||||
### 动态索引级索引设置
|
||||
|
||||
OpenSearch 支持以下动态索引级索引设置:
|
||||
|
||||
- `index.number_of_replicas`(Integer):每个主分片应具有的副本分片数量。例如,如果有 4 个主分片,并将 `index.number_of_replicas` 设置为 3,则索引有 12 个副本分片。默认值为 1。
|
||||
|
||||
- `index.auto_expand_replicas`(String):集群是否应根据数据节点的数量自动添加副本分片。指定下限和上限(例如 0--9),或将上限指定为 `all`。例如,如果有 5 个数据节点,并将 `index.auto_expand_replicas` 设置为 0--3,则集群不会自动添加额外的副本分片。但是,如果将此值设置为 `0-all`,并再添加 2 个节点使总数达到 7 个,集群将扩展为拥有 6 个副本分片。默认为禁用。
|
||||
|
||||
- `index.search.idle.after`(Time unit):分片在没有收到搜索或 get 请求后进入空闲状态之前应等待的时间。默认值为 `30s`。
|
||||
|
||||
- `index.refresh_interval`(Time unit):索引刷新的频率,刷新会发布最近的更改并使其可被搜索。可以设置为 `-1` 以禁用刷新。默认值为 `1s`。
|
||||
|
||||
- `index.max_result_window`(Integer):搜索该索引时 `from` + `size` 的最大值。`from` 是开始搜索的起始位置,`size` 是要返回的结果数量。默认值为 10000。
|
||||
|
||||
- `index.max_inner_result_window`(Integer):`from` + `size` 的最大值,用于指定查询期间返回的嵌套搜索命中和聚合的最相关文档的数量。`from` 是开始搜索的起始位置,`size` 是要返回的最佳命中数量。默认值为 100。
|
||||
|
||||
- `index.max_rescore_window`(Integer):对该索引发出的重新评分请求中 `window_size` 的最大值。重新评分请求会对索引的文档重新排序并返回新的评分,该评分可能更加精确。默认值与 `index.max_inner_result_window` 相同,或默认为 10000。
|
||||
|
||||
- `index.max_docvalue_fields_search`(Integer):查询中允许的 `docvalue_fields` 的最大数量。默认值为 100。
|
||||
|
||||
- `index.max_script_fields`(Integer):查询中允许的 `script_fields` 的最大数量。默认值为 32。
|
||||
|
||||
- `index.max_ngram_diff`(Integer):`NGramTokenizer` 和 `NGramTokenFilter` 的 `min_gram` 与 `max_gram` 值之间的最大差值。默认值为 1。
|
||||
|
||||
- `index.max_shingle_diff`(Integer):传给 `shingle` 词元过滤器(Token Filter)的 `max_shingle_size` 与 `min_shingle_size` 之间的最大差值。默认值为 3。
|
||||
|
||||
- `index.max_refresh_listeners`(Integer):每个分片允许拥有的刷新监听器的最大数量。
|
||||
|
||||
- `index.analyze.max_token_count`(Integer):`_analyze` API 操作可以返回的最大词元数量。默认值为 10000。
|
||||
|
||||
- `index.highlight.max_analyzed_offset`(Integer):高亮请求可以分析的字符数。默认值为 1000000。
|
||||
|
||||
- `index.max_terms_count`(Integer):terms 查询可以接受的最大词项数量。默认值为 65536。
|
||||
|
||||
- `index.max_regex_length`(Integer):regexp 查询中正则表达式的最大字符长度。默认值为 1000。
|
||||
|
||||
- `index.query.default_field`(List):当参数中未指定字段时,OpenSearch 在查询中使用的一个字段或字段列表。
|
||||
|
||||
- `index.routing.allocation.enable`(String):指定索引分片分配的选项。可用选项为 `all`(允许为所有分片分配)、`primaries`(仅允许为主分片分配)、`new_primaries`(仅允许为新的主分片分配)和 `none`(不允许分配)。默认值为 `all`。
|
||||
|
||||
- `index.routing.rebalance.enable`(String):为索引启用分片重新平衡。可用选项为 `all`(允许对所有分片重新平衡)、`primaries`(仅允许对主分片重新平衡)、`replicas`(仅允许对副本重新平衡)和 `none`(不允许重新平衡)。默认值为 `all`。
|
||||
|
||||
- `index.gc_deletes`(Time unit):保留已删除文档版本号的时间。默认值为 `60s`。
|
||||
|
||||
- `index.default_pipeline`(String):索引的默认摄取节点管道。如果设置了默认管道但该管道不存在,则索引请求将失败。管道名称 `_none` 表示该索引没有摄取管道(Ingest Pipeline)。
|
||||
|
||||
- `index.final_pipeline`(String):索引的最终摄取节点管道。如果设置了最终管道但该管道不存在,则索引请求将失败。管道名称 `_none` 表示该索引没有摄取管道。
|
||||
|
||||
- `index.optimize_doc_id_lookup.fuzzy_set.enabled`(Boolean):此设置控制是否启用 `fuzzy_set`,以便通过使用额外的数据结构(在本例中为 Bloom 过滤器数据结构)来优化索引或搜索调用中的文档 ID 查找。启用此设置会创建一个新的数据结构(Bloom 过滤器),从而提升依赖文档 ID 的 upsert 和搜索操作的性能。Bloom 过滤器可以通过更快的堆外查找来处理否定情况(即 ID 不存在于现有索引中)。默认值为 `false`。仅当功能标志 `opensearch.experimental.optimize_doc_id_lookup.fuzzy_set.enabled` 设置为 `true` 时,才能使用此设置。
|
||||
|
||||
- `index.optimize_doc_id_lookup.fuzzy_set.false_positive_probability`(Double):设置底层 `fuzzy_set`(即 Bloom 过滤器)的误报概率。较低的误报概率可以确保 `UPSERT` 和 `GET` 操作获得更高的吞吐量。允许的值范围为 `0.01` 到 `0.50`。默认值为 `0.20`。仅当功能标志 `opensearch.experimental.optimize_doc_id_lookup.fuzzy_set.enabled` 设置为 `true` 时,才能使用此设置。
|
||||
|
||||
### 更新动态索引设置
|
||||
|
||||
你可以随时通过 API 更新动态索引设置。例如,要更新刷新间隔,请使用以下请求:
|
||||
|
||||
```json
|
||||
PUT /testindex/_settings
|
||||
{
|
||||
"index": {
|
||||
"refresh_interval": "2s"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
有关更新设置的更多信息(包括支持的查询参数),请参阅[更新设置](/api-reference/index-apis/update-settings)。
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
title: 配置 OpenSearch
|
||||
---
|
||||
|
||||
# 配置 OpenSearch
|
||||
|
||||
OpenSearch 设置分为两种类型:[动态设置](#dynamic-settings)和[静态设置](#static-settings)。
|
||||
|
||||
## 动态设置
|
||||
|
||||
动态索引设置是可以随时更新的设置。你可以通过 Cluster Settings API 配置 OpenSearch 的动态设置。有关详细信息,请参阅[使用 API 更新集群设置](#updating-cluster-settings-using-the-api)。
|
||||
|
||||
::: tip 提示
|
||||
尽可能使用 Cluster Settings API:`opensearch.yml` 只作用于各自所在的节点,而 API 会将设置应用于集群中的所有节点。
|
||||
:::
|
||||
|
||||
## 静态设置
|
||||
|
||||
某些操作是静态的,需要你修改 `opensearch.yml` [配置文件](#configuration-file)并重启集群。一般来说,这些设置与网络、集群组建和本地文件系统相关。要了解更多信息,请参阅[集群组建](/tuning-your-cluster/)。
|
||||
|
||||
## 以环境变量的形式指定设置
|
||||
|
||||
启动 OpenSearch 时,你可以使用 `-E` 将环境变量指定为参数:
|
||||
|
||||
```bash
|
||||
./opensearch -Ecluster.name=opensearch-cluster -Enode.name=opensearch-node1 -Ehttp.host=0.0.0.0 -Ediscovery.type=single-node
|
||||
```
|
||||
|
||||
## 使用 API 更新集群设置
|
||||
|
||||
更改设置的第一步是发送以下请求,查看当前设置:
|
||||
|
||||
```json
|
||||
GET _cluster/settings?include_defaults=true
|
||||
```
|
||||
|
||||
如需更简洁的非默认设置摘要,请发送以下请求:
|
||||
|
||||
```json
|
||||
GET _cluster/settings
|
||||
```
|
||||
|
||||
Cluster Settings API 中存在三类设置:持久(persistent)设置、临时(transient)设置和默认(default)设置。顾名思义,持久设置在集群重启后仍然保留。重启后,OpenSearch 会清除临时设置。
|
||||
|
||||
如果在多个位置指定了同一个设置,OpenSearch 将按以下优先级使用:
|
||||
|
||||
1. 临时设置
|
||||
2. 持久设置
|
||||
3. `opensearch.yml` 中的设置
|
||||
4. 默认设置
|
||||
|
||||
要更改设置,请使用 [Cluster Settings API](/api-reference/cluster-api/cluster-settings),并将新值指定为持久或临时设置。以下示例展示了扁平设置格式:
|
||||
|
||||
```json
|
||||
PUT _cluster/settings
|
||||
{
|
||||
"persistent" : {
|
||||
"action.auto_create_index" : false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
你也可以使用展开格式,这样可以直接从 GET 响应中复制粘贴并修改现有值:
|
||||
|
||||
```json
|
||||
PUT _cluster/settings
|
||||
{
|
||||
"persistent": {
|
||||
"action": {
|
||||
"auto_create_index": false
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 配置文件
|
||||
|
||||
在每个节点上,你可以在 `/usr/share/opensearch/config/opensearch.yml`(Docker)或 `/etc/opensearch/opensearch.yml`(大多数 Linux 发行版)中找到 `opensearch.yml`。
|
||||
|
||||
你可以编辑 `OPENSEARCH_PATH_CONF=/etc/opensearch` 来更改配置目录的位置。该变量来源于 `/etc/default/opensearch`(Debian 软件包)和 `/etc/sysconfig/opensearch`(RPM 软件包)。
|
||||
|
||||
如果你设置了自定义的 `OPENSEARCH_PATH_CONF` 变量,请注意其他默认环境变量将不会被加载。
|
||||
|
||||
在 `opensearch.yml` 中无需将设置标记为持久或临时,并且设置使用扁平格式:
|
||||
|
||||
```yml
|
||||
cluster.name: my-application
|
||||
action.auto_create_index: true
|
||||
compatibility.override_main_response_version: true
|
||||
```
|
||||
|
||||
演示配置中包含许多 [Security 插件设置](/install-and-configure/configuring-opensearch/security-settings),在将 OpenSearch 用于生产工作负载之前,你应该修改这些设置。要了解更多信息,请参阅[安全](/security/)。
|
||||
|
||||
### (可选)CORS 标头配置
|
||||
|
||||
如果你正在开发的客户端应用程序要访问位于不同域上的 OpenSearch 集群,可以在 `opensearch.yml` 中配置标头,以便在同一台机器上开发本地应用程序。使用[跨源资源共享(Cross Origin Resource Sharing)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS),使你的应用程序能够调用本地运行的 OpenSearch API。在 `custom-opensearch.yml` 文件中添加以下行(注意每行的第一个字符必须是 "-")。
|
||||
```yml
|
||||
- http.host:0.0.0.0
|
||||
- http.port:9200
|
||||
- http.cors.allow-origin:"http://localhost"
|
||||
- http.cors.enabled:true
|
||||
- http.cors.allow-headers:X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization
|
||||
- http.cors.allow-credentials:true
|
||||
```
|
||||
@@ -0,0 +1,235 @@
|
||||
---
|
||||
title: 日志
|
||||
---
|
||||
|
||||
# 日志
|
||||
|
||||
OpenSearch 日志包含了监控集群运行和排查问题的宝贵信息。日志的位置因安装类型而异:
|
||||
|
||||
- 在 Docker 上,OpenSearch 将大部分日志写入控制台,其余日志存储在 `opensearch/logs/` 中。tarball 安装也使用 `opensearch/logs/`。
|
||||
- 在大多数 Linux 安装中,OpenSearch 将日志写入 `/var/log/opensearch/`。
|
||||
|
||||
日志以 `.log`(纯文本)和 `.json` 文件的形式提供。OpenSearch 日志的权限默认为 `-rw-r--r--`,这意味着节点上的任何用户账户都可以读取它们。你可以在 `log4j2.properties` 中使用 `filePermissions` 选项_针对每种日志类型_更改此行为。例如,你可以添加 `appender.rolling.filePermissions = rw-r-----` 来更改 JSON 服务器日志的权限。有关详细信息,请参阅 [Log4j 2 文档](https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender)。
|
||||
|
||||
## 应用程序日志
|
||||
|
||||
对于应用程序日志,OpenSearch 使用 [Apache Log4j 2](https://logging.apache.org/log4j/2.x/) 及其内置日志级别(按严重程度从低到高排列)。下表介绍了日志设置。
|
||||
|
||||
| 设置 | 数据类型 | 描述 |
|
||||
| :--- | :--- | :--- |
|
||||
| `logger.org.opensearch.discovery` | String | 日志记录器接受 Log4j2 的内置日志级别:`OFF`、`FATAL`、`ERROR`、`WARN`、`INFO`、`DEBUG` 和 `TRACE`。默认值为 `INFO`。 |
|
||||
|
||||
与其更改默认日志级别(`logger.level`),不如更改单个 OpenSearch 模块的日志级别:
|
||||
|
||||
```json
|
||||
PUT /_cluster/settings
|
||||
{
|
||||
"persistent" : {
|
||||
"logger.org.opensearch.index.reindex" : "DEBUG"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
::: tip 提示
|
||||
识别模块最简单的方法不是查看日志(日志会缩写路径,例如 `o.o.i.r`),而是查看 [OpenSearch 源代码](https://github.com/opensearch-project/opensearch/tree/master/server/src/main/java/org/opensearch)。
|
||||
:::
|
||||
|
||||
完成上述示例更改后,OpenSearch 会在重新索引操作期间输出更为详细的日志:
|
||||
|
||||
```plaintext
|
||||
[2019-10-18T16:52:51,184][DEBUG][o.o.i.r.TransportReindexAction] [node1] [1626]: starting
|
||||
[2019-10-18T16:52:51,186][DEBUG][o.o.i.r.TransportReindexAction] [node1] executing initial scroll against [some-index]
|
||||
[2019-10-18T16:52:51,291][DEBUG][o.o.i.r.TransportReindexAction] [node1] scroll returned [3] documents with a scroll id of [DXF1Z==]
|
||||
[2019-10-18T16:52:51,292][DEBUG][o.o.i.r.TransportReindexAction] [node1] [1626]: got scroll response with [3] hits
|
||||
[2019-10-18T16:52:51,294][DEBUG][o.o.i.r.WorkerBulkByScrollTaskState] [node1] [1626]: preparing bulk request for [0s]
|
||||
[2019-10-18T16:52:51,297][DEBUG][o.o.i.r.TransportReindexAction] [node1] [1626]: preparing bulk request
|
||||
[2019-10-18T16:52:51,299][DEBUG][o.o.i.r.TransportReindexAction] [node1] [1626]: sending [3] entry, [222b] bulk request
|
||||
[2019-10-18T16:52:51,310][INFO ][o.e.c.m.MetaDataMappingService] [node1] [some-new-index/R-j3adc6QTmEAEb-eAie9g] create_mapping [_doc]
|
||||
[2019-10-18T16:52:51,383][DEBUG][o.o.i.r.TransportReindexAction] [node1] [1626]: got scroll response with [0] hits
|
||||
[2019-10-18T16:52:51,384][DEBUG][o.o.i.r.WorkerBulkByScrollTaskState] [node1] [1626]: preparing bulk request for [0s]
|
||||
[2019-10-18T16:52:51,385][DEBUG][o.o.i.r.TransportReindexAction] [node1] [1626]: preparing bulk request
|
||||
[2019-10-18T16:52:51,386][DEBUG][o.o.i.r.TransportReindexAction] [node1] [1626]: finishing without any catastrophic failures
|
||||
[2019-10-18T16:52:51,395][DEBUG][o.o.i.r.TransportReindexAction] [node1] Freed [1] contexts
|
||||
```
|
||||
|
||||
DEBUG 和 TRACE 级别的日志极其冗长。如果你为了排查问题而启用了其中任何一个级别,请在完成后将其禁用。
|
||||
|
||||
还有其他方法可以更改日志级别:
|
||||
|
||||
1. 在 `opensearch.yml` 中添加以下行:
|
||||
|
||||
```yml
|
||||
logger.org.opensearch.index.reindex: debug
|
||||
```
|
||||
|
||||
如果你想在多个集群之间复用日志配置,或者调试单个节点的启动问题,修改 `opensearch.yml` 是最合适的做法。
|
||||
|
||||
2. 修改 `log4j2.properties`:
|
||||
|
||||
```properties
|
||||
# 定义一个唯一 ID 为 reindex 的新日志记录器
|
||||
logger.reindex.name = org.opensearch.index.reindex
|
||||
# 为该 ID 设置日志级别
|
||||
logger.reindex.level = debug
|
||||
```
|
||||
|
||||
这种方法非常灵活,但需要熟悉 [Log4j 2 属性文件语法](https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties)。一般来说,其他选项提供的配置体验更为简单。
|
||||
|
||||
如果你查看配置目录中默认的 `log4j2.properties` 文件,可以看到一些 OpenSearch 特有的变量:
|
||||
|
||||
```properties
|
||||
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
|
||||
appender.rolling_old.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}.log
|
||||
```
|
||||
|
||||
- `${sys:opensearch.logs.base_path}` 是日志目录(例如 `/var/log/opensearch/`)。
|
||||
- `${sys:opensearch.logs.cluster_name}` 是集群的名称。
|
||||
- `[%node_name]` 是节点的名称。
|
||||
|
||||
## 搜索请求慢日志
|
||||
|
||||
从 2.12 版本开始,OpenSearch 提供了请求级别的搜索慢日志。这些日志依靠阈值来定义什么算作「慢」。所有超过阈值的请求都会被记录。
|
||||
|
||||
搜索请求慢日志可以通过 [Cluster Settings API](/api-reference/cluster-api/cluster-settings) 动态启用。与分片慢日志不同,搜索请求慢日志的阈值是针对请求的总耗时配置的。默认情况下,日志处于禁用状态(所有阈值都设置为 `-1`)。
|
||||
|
||||
```json
|
||||
PUT /_cluster/settings
|
||||
{
|
||||
"persistent" : {
|
||||
"cluster.search.request.slowlog.level" : "TRACE",
|
||||
"cluster.search.request.slowlog.threshold.warn": "10s",
|
||||
"cluster.search.request.slowlog.threshold.info": "5s",
|
||||
"cluster.search.request.slowlog.threshold.debug": "2s",
|
||||
"cluster.search.request.slowlog.threshold.trace": "10ms"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`opensearch_index_search_slowlog.log` 中的一行可能如下所示:
|
||||
|
||||
```plaintext
|
||||
[2023-10-30T15:47:42,630][TRACE][c.s.r.slowlog] [runTask-0] took[80.8ms], took_millis[80], phase_took_millis[{expand=0, query=39, fetch=22}], total_hits[4 hits], search_type[QUERY_THEN_FETCH], shards[{total: 10, successful: 10, skipped: 0, failed: 0}], source[{"query":{"match_all":{"boost":1.0}}}], id[]
|
||||
```
|
||||
|
||||
::: warning 重要
|
||||
如果设置的阈值较低,搜索请求慢日志可能会占用大量磁盘空间并影响性能。建议仅在排查问题或进行性能调优时临时启用。要禁用搜索请求慢日志,请将所有阈值恢复为 `-1`。
|
||||
:::
|
||||
|
||||
## 分片慢日志
|
||||
|
||||
OpenSearch 有两种*分片慢日志*,用于帮助你识别性能问题:搜索慢日志和索引慢日志。
|
||||
|
||||
这些日志依靠阈值来定义什么算作「慢」搜索或「慢」索引操作。例如,你可以规定一个查询如果需要超过 15 秒才能完成,就算是慢查询。与针对模块配置的应用程序日志不同,慢日志是针对索引配置的。默认情况下,两种日志都处于禁用状态(所有阈值都设置为 `-1`)。
|
||||
|
||||
与搜索请求慢日志不同,分片慢日志的阈值是针对单个分片的耗时配置的。
|
||||
|
||||
```json
|
||||
GET <some-index>/_settings?include_defaults=true
|
||||
{
|
||||
"indexing": {
|
||||
"slowlog": {
|
||||
"reformat": "true",
|
||||
"threshold": {
|
||||
"index": {
|
||||
"warn": "-1",
|
||||
"trace": "-1",
|
||||
"debug": "-1",
|
||||
"info": "-1"
|
||||
}
|
||||
},
|
||||
"source": "1000",
|
||||
"level": "TRACE"
|
||||
}
|
||||
},
|
||||
"search": {
|
||||
"slowlog": {
|
||||
"level": "TRACE",
|
||||
"threshold": {
|
||||
"fetch": {
|
||||
"warn": "-1",
|
||||
"trace": "-1",
|
||||
"debug": "-1",
|
||||
"info": "-1"
|
||||
},
|
||||
"query": {
|
||||
"warn": "-1",
|
||||
"trace": "-1",
|
||||
"debug": "-1",
|
||||
"info": "-1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
要启用这些日志,请提高一个或多个阈值:
|
||||
|
||||
```json
|
||||
PUT <some-index>/_settings
|
||||
{
|
||||
"indexing": {
|
||||
"slowlog": {
|
||||
"threshold": {
|
||||
"index": {
|
||||
"warn": "15s",
|
||||
"trace": "750ms",
|
||||
"debug": "3s",
|
||||
"info": "10s"
|
||||
}
|
||||
},
|
||||
"source": "500",
|
||||
"level": "INFO"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在此示例中,OpenSearch 会以 WARN 级别记录耗时 15 秒或更长时间的索引操作,以 INFO 级别记录耗时 10 到 14.*x* 秒的操作。如果将阈值设置为 0 秒,OpenSearch 会记录所有操作,这对于测试慢日志是否确实已启用非常有用。
|
||||
|
||||
- `reformat` 指定是将文档的 `_source` 字段记录为单行(`true`),还是允许其跨越多行(`false`)。
|
||||
- `source` 是要记录的文档 `_source` 字段的字符数。
|
||||
- `level` 是要包含的最低日志级别。
|
||||
|
||||
`opensearch_index_indexing_slowlog.log` 中的一行可能如下所示:
|
||||
|
||||
```plaintext
|
||||
node1 | [2019-10-24T19:48:51,012][WARN][i.i.s.index] [node1] [some-index/i86iF5kyTyy-PS8zrdDeAA] took[3.4ms], took_millis[3], type[_doc], id[1], routing[], source[{"title":"Your Name", "Director":"Makoto Shinkai"}]
|
||||
```
|
||||
|
||||
如果设置的阈值较低,分片慢日志可能会占用大量磁盘空间并影响性能。建议仅在排查问题或进行性能调优时临时启用。要禁用分片慢日志,请将所有阈值恢复为 `-1`。
|
||||
|
||||
## 任务日志
|
||||
|
||||
启用任务资源消费者(task resource consumers)后,OpenSearch 可以记录内存开销最大的前 N 个搜索任务的 CPU 时间和内存使用情况。默认情况下,任务资源消费者会每隔 60 秒记录前 10 个搜索任务。这些值可以在 `opensearch.yml` 中配置。
|
||||
|
||||
任务日志可以通过 [Cluster Settings API](/api-reference/cluster-api/cluster-settings) 动态启用:
|
||||
|
||||
```json
|
||||
PUT _cluster/settings
|
||||
{
|
||||
"persistent" : {
|
||||
"task_resource_consumers.enabled" : "true"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
::: tip 提示
|
||||
启用任务资源消费者可能会影响搜索延迟。
|
||||
:::
|
||||
|
||||
启用后,日志将写入 `logs/opensearch_task_detailslog.json` 和 `logs/opensearch_task_detailslog.log`。
|
||||
|
||||
要配置日志记录间隔和记录的搜索任务数量,请在 `opensearch.yml` 中添加以下行:
|
||||
|
||||
```yaml
|
||||
# 要记录的高开销搜索任务数量
|
||||
cluster.task.consumers.top_n.size:100
|
||||
|
||||
# 日志记录间隔
|
||||
cluster.task.consumers.top_n.frequency:30s
|
||||
```
|
||||
|
||||
## 弃用日志
|
||||
|
||||
弃用日志记录客户端何时对集群发出了已弃用的 API 调用。这些日志可以帮助你在升级到新的主版本之前发现并修复问题。默认情况下,OpenSearch 以 WARN 级别记录已弃用的 API 调用,这几乎适用于所有用例。如有需要,可以使用 `_cluster/settings`、`opensearch.yml` 或 `log4j2.properties` 配置 `logger.deprecation.level`。
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
title: 网络设置
|
||||
---
|
||||
|
||||
# 网络设置
|
||||
|
||||
OpenSearch 使用 HTTP 设置来配置通过 REST API 与外部客户端的通信,并使用传输(transport)设置来配置 OpenSearch 内部节点之间的通信。
|
||||
|
||||
要了解有关静态设置和动态设置的更多信息,请参阅[配置 OpenSearch](/install-and-configure/configuring-opensearch/)。
|
||||
|
||||
OpenSearch 支持以下常用网络设置:
|
||||
|
||||
- `network.host`(静态,list):将 OpenSearch 节点绑定到一个地址。使用 `0.0.0.0` 可包含所有可用的网络接口,也可以指定分配给特定接口的 IP 地址。如果 `network.bind_host` 和 `network.publish_host` 的值相同,`network.host` 设置就是这两者的组合。作为 `network.host` 的替代方案,你可以根据需要分别配置 `network.bind_host` 和 `network.publish_host`。请参阅[高级网络设置](#advanced-network-settings)。
|
||||
|
||||
- `http.port`(静态,single value or range):将 OpenSearch 节点绑定到用于 HTTP 通信的自定义端口或端口范围。你可以指定一个地址或地址范围。默认值为 `9200-9300`。
|
||||
|
||||
- `transport.port`(静态,single value or range):将 OpenSearch 节点绑定到用于节点间通信的自定义端口。你可以指定一个地址或地址范围。默认值为 `9300-9400`。
|
||||
|
||||
## 高级网络设置
|
||||
|
||||
OpenSearch 支持以下高级网络设置:
|
||||
|
||||
- `network.bind_host`(静态,list):将 OpenSearch 节点绑定到一个或多个地址,用于接收传入连接。默认值为 `network.host` 中的值。
|
||||
|
||||
- `network.publish_host`(静态,list):指定 OpenSearch 节点向集群中其他节点发布的一个或多个地址,以便其他节点可以连接到该节点。
|
||||
|
||||
## 高级 HTTP 设置
|
||||
|
||||
OpenSearch 支持以下用于 HTTP 通信的高级网络设置:
|
||||
|
||||
- `http.host`(静态,list):设置 OpenSearch 节点用于 HTTP 通信的地址。如果 `http.bind_host` 和 `http.publish_host` 的值相同,`http.host` 设置就是这两者的组合。作为 `http.host` 的替代方案,你可以根据需要分别配置 `http.bind_host` 和 `http.publish_host`。
|
||||
|
||||
- `http.bind_host`(静态,list):指定 OpenSearch 节点绑定以监听传入 HTTP 连接的一个或多个地址。
|
||||
|
||||
- `http.publish_host`(静态,list):指定 OpenSearch 节点向其他节点发布的、用于 HTTP 通信的一个或多个地址。
|
||||
|
||||
- `http.compression`(静态,Boolean):在适用时启用使用 `Accept-Encoding` 的压缩支持。启用 `HTTPS` 时,默认值为 `false`,否则默认值为 `true`。为 HTTPS 禁用压缩有助于降低潜在的安全风险,例如 `BREACH` 攻击。要为 HTTPS 流量启用压缩,请将 `http.compression` 显式设置为 `true`。
|
||||
|
||||
## 高级传输设置
|
||||
|
||||
OpenSearch 支持以下用于传输通信的高级网络设置:
|
||||
|
||||
- `transport.host`(静态,list):设置 OpenSearch 节点用于传输通信的地址。如果 `transport.bind_host` 和 `transport.publish_host` 的值相同,`transport.host` 设置就是这两者的组合。作为 `transport.host` 的替代方案,你可以根据需要分别配置 `transport.bind_host` 和 `transport.publish_host`。
|
||||
|
||||
- `transport.bind_host`(静态,list):指定 OpenSearch 节点绑定以监听传入传输连接的一个或多个地址。
|
||||
|
||||
- `transport.publish_host`(静态,list):指定 OpenSearch 节点向其他节点发布的、用于传输通信的一个或多个地址。
|
||||
|
||||
## 选择传输模块
|
||||
|
||||
OpenSearch 的默认传输由 `transport-netty4` 模块提供,它使用 [Netty 4](https://netty.io/) 引擎来处理集群中节点之间基于 TCP 的内部通信,以及与客户端之间基于 HTTP 的外部通信。这种通信是完全异步且非阻塞的。不过,还有其他可互换使用的传输插件:
|
||||
|
||||
插件 | 描述
|
||||
:---------- | :--------
|
||||
`transport-nio` | 基于 Java NIO 的 OpenSearch 传输。<br> 安装:`./bin/opensearch-plugin install transport-nio` <br> 配置(使用 `opensearch.yml`):<br> `transport.type: nio-transport` <br> `http.type: nio-http-transport`
|
||||
`transport-reactor-netty4` | 基于 [Project Reactor](https://github.com/reactor/reactor-netty) 和 Netty 4 的 OpenSearch HTTP 传输(**实验性**)<br> 安装:`./bin/opensearch-plugin install transport-reactor-netty4` <br> 配置(使用 `opensearch.yml`):<br> `http.type: reactor-netty4`
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
title: 插件设置
|
||||
---
|
||||
|
||||
# 插件设置
|
||||
|
||||
以下设置与 OpenSearch 插件(plugin)相关。
|
||||
|
||||
## Alerting 插件设置
|
||||
|
||||
有关告警设置的信息,请参阅[告警设置](/observing-your-data/alerting/settings#alerting-settings)。
|
||||
|
||||
## Anomaly Detection 插件设置
|
||||
|
||||
有关异常检测设置的信息,请参阅[异常检测设置](/observing-your-data/ad/settings)。
|
||||
|
||||
## Asynchronous Search 插件设置
|
||||
|
||||
有关异步搜索设置的信息,请参阅[异步搜索设置](/search-plugins/async/settings)。
|
||||
|
||||
## Cross-Cluster Replication 插件设置
|
||||
|
||||
有关跨集群复制设置的信息,请参阅[复制设置](/tuning-your-cluster/replication-plugin/settings)。
|
||||
|
||||
## Flow Framework 插件设置
|
||||
|
||||
有关自动化工作流设置的信息,请参阅[工作流设置](/automating-configurations/workflow-settings)。
|
||||
|
||||
## Geospatial 插件设置
|
||||
|
||||
有关 Geospatial 插件的 IP2Geo 处理器设置的信息,请参阅[集群设置](/ingest-pipelines/processors/ip2geo#cluster-settings)。
|
||||
|
||||
## Index Management 插件设置
|
||||
|
||||
有关索引状态管理(Index State Management,ISM)设置的信息,请参阅 [ISM 设置](/im-plugin/ism/settings)。
|
||||
|
||||
### 索引汇总设置
|
||||
|
||||
有关索引汇总(rollup)设置的信息,请参阅[索引汇总设置](/im-plugin/index-rollups/settings)。
|
||||
|
||||
## Job Scheduler 插件设置
|
||||
|
||||
有关 Job Scheduler 插件设置的信息,请参阅 [Job Scheduler 集群设置](/monitoring-your-cluster/job-scheduler/#job-scheduler-cluster-settings)。
|
||||
|
||||
## k-NN 插件设置
|
||||
|
||||
有关 k-NN 设置的信息,请参阅 [k-NN 设置](/search-plugins/knn/settings)。
|
||||
|
||||
## ML Commons 插件设置
|
||||
|
||||
有关机器学习设置的信息,请参阅 [ML Commons 集群设置](/ml-commons-plugin/cluster-settings)。
|
||||
|
||||
## Neural Search 插件设置
|
||||
|
||||
Security Analytics 插件支持以下设置:
|
||||
|
||||
- `plugins.neural_search.hybrid_search_disabled`(动态,Boolean):禁用混合搜索(Hybrid Search)。默认值为 `false`。
|
||||
|
||||
## Notifications 插件设置
|
||||
|
||||
Notifications 插件支持以下设置。此列表中的所有设置都是动态的:
|
||||
|
||||
- `opensearch.notifications.core.allowed_config_types`(List):Notifications 插件允许的配置类型。使用 `GET /_plugins/_notifications/features` API 获取此设置的值。配置类型包括 `slack`、`chime`、`microsoft_teams`、`webhook`、`email`、`sns`、`ses_account`、`smtp_account` 和 `email_group`。
|
||||
|
||||
- `opensearch.notifications.core.email.minimum_header_length`(Integer):最小电子邮件标头长度。用于验证电子邮件消息的总长度。默认值为 `160`。
|
||||
|
||||
- `opensearch.notifications.core.email.size_limit`(Integer):电子邮件大小限制。用于验证电子邮件消息的总长度。默认值为 `10000000`。
|
||||
|
||||
- `opensearch.notifications.core.http.connection_timeout`(Integer):内部 HTTP 客户端的连接超时时间。该客户端用于基于 webhook 的通知渠道。默认值为 `5000`。
|
||||
|
||||
- `opensearch.notifications.core.http.host_deny_list`(List):被拒绝的主机列表。HTTP 客户端不会向此列表中的 webhook URL 发送通知。
|
||||
|
||||
- `opensearch.notifications.core.http.max_connection_per_route`(Integer):内部 HTTP 客户端每个路由的最大 HTTP 连接数。该客户端用于基于 webhook 的通知渠道。默认值为 `20`。
|
||||
|
||||
- `opensearch.notifications.core.http.max_connections`(Integer):内部 HTTP 客户端的最大 HTTP 连接数。该客户端用于基于 webhook 的通知渠道。默认值为 `60`。
|
||||
|
||||
- `opensearch.notifications.core.http.socket_timeout`(Integer):内部 HTTP 客户端的套接字超时配置。该客户端用于基于 webhook 的通知渠道。默认值为 `50000`。
|
||||
|
||||
- `opensearch.notifications.core.tooltip_support`(Boolean):为 Notifications 插件启用工具提示支持。使用 `GET /_plugins/_notifications/features` API 获取此设置的值。默认值为 `true`。
|
||||
|
||||
- `opensearch.notifications.general.filter_by_backend_roles`(Boolean):启用按后端角色过滤(通知渠道的基于角色的访问控制)。默认值为 `false`。
|
||||
|
||||
## Query Insights 插件设置
|
||||
|
||||
有关 Query Insights 插件设置的信息,请参阅[查询洞察设置](/observing-your-data/query-insights/#query-insights-settings)。
|
||||
|
||||
## Security 插件设置
|
||||
|
||||
有关 Security 插件设置的信息,请参阅[安全设置](/install-and-configure/configuring-opensearch/security-settings)。
|
||||
|
||||
## Security Analytics 插件设置
|
||||
|
||||
有关安全分析设置的信息,请参阅 [Security Analytics 设置](/security-analytics/settings)。
|
||||
|
||||
## SQL 插件设置
|
||||
|
||||
有关 SQL 和 PPL 相关设置的信息,请参阅 [SQL 设置](/search-plugins/sql/settings)。
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: 搜索设置
|
||||
---
|
||||
|
||||
# 搜索设置
|
||||
|
||||
OpenSearch 支持以下搜索设置:
|
||||
|
||||
- `search.max_buckets`(动态,integer):单个响应中允许的最大聚合桶数量。默认值为 `65535`。
|
||||
|
||||
- `search.phase_took_enabled`(动态,Boolean):允许在搜索响应中返回阶段级别的 `took` 耗时值。默认值为 `false`。
|
||||
|
||||
- `search.allow_expensive_queries`(动态,Boolean):允许或禁止开销大的查询。有关更多信息,请参阅[开销大的查询](/query-dsl/#expensive-queries)。
|
||||
|
||||
- `search.default_allow_partial_results`(动态,Boolean):一个集群级设置,允许在请求超时或分片失败时返回部分搜索结果。如果搜索请求包含 `allow_partial_search_results` 参数,则该参数优先于此设置。默认值为 `true`。
|
||||
|
||||
- `search.cancel_after_time_interval`(动态,time unit):一个集群级设置,指定搜索请求在分片级别被取消之前可以运行的最长时间。达到该时间后,请求将被停止,所有相关任务都会被取消。默认值为 `-1`。
|
||||
|
||||
- `search.default_search_timeout`(动态,time unit):一个集群级设置,在协调节点级别为所有搜索请求设置默认超时时间。如果搜索请求中指定了 `timeout`,则其优先于此设置。默认值为 `-1`(不超时)。
|
||||
|
||||
- `search.default_keep_alive`(动态,time unit):指定 scroll 和时间点(Point in Time,PIT)搜索的默认保活值。由于一个请求可能会多次到达同一个分片(例如在查询阶段和获取阶段),OpenSearch 会打开一个在请求整个持续期间都存在的_请求上下文_,以确保每个分片请求的分片状态一致。在标准搜索中,获取阶段完成后,请求上下文就会关闭。对于 scroll 或 PIT 搜索,OpenSearch 会保持请求上下文处于打开状态,直到显式关闭(或达到保活时间)。一个后台线程会定期检查所有打开的 scroll 和 PIT 上下文,并删除超过保活超时时间的上下文。`search.keep_alive_interval` 设置指定检查上下文是否过期的频率。`search.default_keep_alive` 设置是默认的过期期限。scroll 或 PIT 请求可以显式指定保活时间,其优先于此设置。默认值为 `5m`。
|
||||
|
||||
- `search.keep_alive_interval`(静态,time unit):决定 OpenSearch 检查超过保活限制的请求上下文的时间间隔。默认值为 `1m`。
|
||||
|
||||
- `search.max_keep_alive`(动态,time unit):指定最大保活值。`max_keep_alive` 设置用作对其他 `keep_alive` 设置(例如 `default_keep_alive`)以及请求级保活设置(针对 scroll 和 PIT 上下文)的安全检查。无论哪种情况,如果请求超过 `max_keep_alive` 值,操作都将失败。默认值为 `24h`。
|
||||
|
||||
- `search.low_level_cancellation`(动态,Boolean):启用低级别请求取消。Lucene 的经典超时机制只在收集搜索结果时检查时间。然而,开销大的查询(例如 wildcard 或 prefix 查询)在开始收集结果之前可能需要很长时间进行扩展。在这种情况下,查询的运行时间可能超过超时值。低级别取消机制解决了这一问题:它不仅在收集搜索结果时会超时,在查询扩展阶段或执行任何 Lucene 操作之前也会超时。默认值为 `true`。
|
||||
|
||||
- `search.max_open_scroll_context`(动态,integer):一个节点级设置,指定节点打开的 scroll 上下文的最大数量。默认值为 `500`。
|
||||
|
||||
- `search.request_stats_enabled`(动态,Boolean):从协调节点的角度开启节点级阶段耗时统计信息的收集。请求级统计信息会记录搜索请求在各个搜索阶段中(总共)花费的时间。你可以使用 [Nodes Stats API](/api-reference/nodes-apis/nodes-stats) 获取这些计数器。默认值为 `false`。
|
||||
|
||||
- `search.highlight.term_vector_multi_value`(静态,Boolean):指定跨多值字段的各个值高亮片段。默认值为 `true`。
|
||||
|
||||
## 时间点设置
|
||||
|
||||
有关 PIT 设置的信息,请参阅 [PIT 设置](/search-plugins/searching-data/point-in-time-api#pit-settings)。
|
||||
|
||||
要了解有关静态设置和动态设置的更多信息,请参阅[配置 OpenSearch](/install-and-configure/configuring-opensearch/)。
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: 安装和升级 OpenSearch
|
||||
---
|
||||
|
||||
# 安装和升级 OpenSearch
|
||||
|
||||
OpenSearch 和 OpenSearch Dashboards 可以在任何支持 Docker 的兼容主机(例如 Linux、MacOS 或 Windows)上运行。此外,你还可以在多种 Linux 发行版和 Windows 上安装这两个产品。
|
||||
|
||||
针对你的平台[下载 OpenSearch](https://opensearch.org/downloads.html),然后选择以下任一安装指南。
|
||||
|
||||
| OpenSearch | OpenSearch Dashboards |
|
||||
| :--- | :--- |
|
||||
| [Docker](/install-and-configure/install-opensearch/docker) | [Docker](/install-and-configure/install-dashboards/docker) |
|
||||
| [Helm](/install-and-configure/install-opensearch/helm) | [Helm](/install-and-configure/install-dashboards/helm) |
|
||||
| [Tarball](/install-and-configure/install-opensearch/tar) | [Tarball](/install-and-configure/install-dashboards/tar) |
|
||||
| [RPM](/install-and-configure/install-opensearch/rpm) | [RPM](/install-and-configure/install-dashboards/rpm) |
|
||||
| [Debian](/install-and-configure/install-opensearch/debian) | [Debian](/install-and-configure/install-dashboards/debian) |
|
||||
| [Ansible playbook](/install-and-configure/install-opensearch/ansible) | |
|
||||
| [Windows](/install-and-configure/install-opensearch/windows) | [Windows](/install-and-configure/install-dashboards/windows) |
|
||||
|
||||
安装 OpenSearch 后,请了解如何针对你的部署[配置](/install-and-configure/configuring-opensearch/) OpenSearch。
|
||||
|
||||
有关升级 OpenSearch 集群(Cluster)的更多信息,请参阅[升级指南](/install-and-configure/upgrade-opensearch/)。
|
||||
|
||||
有关升级工具的信息,请参阅 [OpenSearch 升级、迁移和比较工具](/tools/#opensearch-upgrade-migration-and-comparison-tools)。
|
||||
|
||||
有关插件安装,请参阅[安装插件](/install-and-configure/plugins)。
|
||||
@@ -0,0 +1,132 @@
|
||||
---
|
||||
title: Debian
|
||||
---
|
||||
|
||||
# 安装 OpenSearch Dashboards(Debian)
|
||||
|
||||
与 [Tarball](/install-and-configure/install-dashboards/tar) 方式相比,使用高级包管理工具(Advanced Packaging Tool,APT)安装 OpenSearch Dashboards 会大大简化安装过程。例如,包管理器会处理多项技术细节,如安装路径、配置文件位置,以及创建由 `systemd` 管理的服务。
|
||||
|
||||
::: warning 重要
|
||||
在安装 OpenSearch Dashboards 之前,你必须先配置一个 OpenSearch 集群(Cluster)。具体步骤请参阅 OpenSearch 的 [Debian](/install-and-configure/install-opensearch/debian) 安装指南。
|
||||
:::
|
||||
|
||||
::: info 注意
|
||||
本指南假定你熟悉 Linux 命令行界面(CLI)的使用。你应当了解如何输入命令、在目录之间切换以及编辑文本文件。部分示例命令使用 `vi` 文本编辑器,但你可以使用任何可用的文本编辑器。
|
||||
:::
|
||||
|
||||
## 从安装包安装 OpenSearch Dashboards
|
||||
|
||||
1. 直接从 [OpenSearch 下载页面](https://opensearch.org/downloads.html)下载所需版本的 Debian 包。Debian 包提供 **x64** 和 **arm64** 两种架构的版本。
|
||||
1. 在 CLI 中使用 `dpkg` 安装。
|
||||
```bash
|
||||
# x64
|
||||
sudo dpkg -i opensearch-dashboards-2.12.0-linux-x64.deb
|
||||
# arm64
|
||||
sudo dpkg -i opensearch-dashboards-2.12.0-linux-arm64.deb
|
||||
```
|
||||
1. 安装完成后,重新加载 systemd 管理器配置。
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
1. 将 OpenSearch 启用为服务。
|
||||
```bash
|
||||
sudo systemctl enable opensearch-dashboards
|
||||
```
|
||||
1. 启动 OpenSearch 服务。
|
||||
```bash
|
||||
sudo systemctl start opensearch-dashboards
|
||||
```
|
||||
1. 验证 OpenSearch 是否正确启动。
|
||||
```bash
|
||||
sudo systemctl status opensearch-dashboards
|
||||
```
|
||||
|
||||
### 指纹验证
|
||||
|
||||
Debian 包未签名。如果你希望验证指纹,OpenSearch 项目除了 `.deb` 包之外还提供了 `.sig` 文件,可配合 GNU Privacy Guard(GPG)使用。
|
||||
|
||||
1. 下载所需的 Debian 包。
|
||||
```bash
|
||||
curl -SLO https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.12.0/opensearch-dashboards-2.12.0-linux-x64.deb
|
||||
```
|
||||
1. 下载对应的签名文件。
|
||||
```bash
|
||||
curl -SLO https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.12.0/opensearch-dashboards-2.12.0-linux-x64.deb.sig
|
||||
```
|
||||
1. 下载并导入 GPG 密钥。
|
||||
```bash
|
||||
curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | gpg --import -
|
||||
```
|
||||
1. 验证签名。
|
||||
```bash
|
||||
gpg --verify opensearch-dashboards-2.12.0-linux-x64.deb.sig opensearch-dashboards-2.12.0-linux-x64.deb
|
||||
```
|
||||
|
||||
## 从 APT 仓库安装 OpenSearch Dashboards
|
||||
|
||||
APT 是基于 Debian 的操作系统的主要包管理工具,可以从 APT 仓库下载并安装 Debian 包。
|
||||
|
||||
1. 安装必要的软件包。
|
||||
```bash
|
||||
sudo apt-get update && sudo apt-get -y install lsb-release ca-certificates curl gnupg2
|
||||
```
|
||||
1. 导入公共 GPG 密钥。该密钥用于验证 APT 仓库已签名。
|
||||
```bash
|
||||
curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring
|
||||
```
|
||||
1. 为 OpenSearch 创建 APT 仓库。
|
||||
```bash
|
||||
echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-dashboards-2.x.list
|
||||
```
|
||||
1. 验证仓库是否创建成功。
|
||||
```bash
|
||||
sudo apt-get update
|
||||
```
|
||||
1. 添加仓库信息后,列出 OpenSearch 的所有可用版本:
|
||||
```bash
|
||||
sudo apt list -a opensearch-dashboards
|
||||
```
|
||||
1. 选择要安装的 OpenSearch 版本:
|
||||
- 除非另行指定,否则会安装 OpenSearch 的最新可用版本。
|
||||
```bash
|
||||
sudo apt-get install opensearch-dashboards
|
||||
```
|
||||
- 要安装特定版本的 OpenSearch Dashboards,请在包名后传入版本号。
|
||||
```bash
|
||||
# 使用 opensearch=<version> 手动指定版本
|
||||
sudo apt-get install opensearch-dashboards=2.12.0
|
||||
```
|
||||
1. 完成后,启用 OpenSearch。
|
||||
```bash
|
||||
sudo systemctl enable opensearch-dashboards
|
||||
```
|
||||
1. 启动 OpenSearch。
|
||||
```bash
|
||||
sudo systemctl start opensearch-dashboards
|
||||
```
|
||||
1. 验证 OpenSearch 是否正确启动。
|
||||
```bash
|
||||
sudo systemctl status opensearch-dashboards
|
||||
```
|
||||
|
||||
## 探索 OpenSearch Dashboards
|
||||
|
||||
默认情况下,与 OpenSearch 一样,OpenSearch Dashboards 在初次安装时会绑定到 `localhost`。因此,除非更新配置,否则无法从远程主机访问 OpenSearch Dashboards。
|
||||
|
||||
1. 打开 `opensearch_dashboards.yml`。
|
||||
```bash
|
||||
sudo vi /etc/opensearch-dashboards/opensearch_dashboards.yml
|
||||
```
|
||||
1. 指定 OpenSearch Dashboards 应绑定的网络接口。
|
||||
```bash
|
||||
# 使用 0.0.0.0 绑定到任意可用接口。
|
||||
server.host: 0.0.0.0
|
||||
```
|
||||
1. 保存并退出。
|
||||
1. 重启 OpenSearch Dashboards 以应用配置更改。
|
||||
```bash
|
||||
sudo systemctl restart opensearch-dashboards
|
||||
```
|
||||
1. 在 Web 浏览器中访问 OpenSearch Dashboards。默认端口为 5601。
|
||||
1. 使用默认用户名 `admin` 和默认密码 `admin` 登录。(对于 OpenSearch 2.12 及更高版本,密码应为自定义的 admin 密码)
|
||||
1. 访问 [OpenSearch Dashboards 入门](/dashboards/)以了解更多信息。
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Docker
|
||||
---
|
||||
|
||||
# 使用 Docker 运行 OpenSearch Dashboards
|
||||
|
||||
你*可以*在[创建 Docker 网络](https://docs.docker.com/engine/reference/commandline/network_create/)并启动 OpenSearch 之后,使用 `docker run` 启动 OpenSearch Dashboards,但使用 Docker Compose 文件将 OpenSearch Dashboards 连接到 OpenSearch 要容易得多。
|
||||
|
||||
1. 运行 `docker pull opensearchproject/opensearch-dashboards:2`。
|
||||
|
||||
1. 创建适合你环境的 [`docker-compose.yml`](https://docs.docker.com/compose/compose-file/) 文件。OpenSearch 的 [Docker 安装页面](/install-and-configure/install-opensearch/docker#sample-docker-composeyml)提供了一个包含 OpenSearch Dashboards 的示例文件。
|
||||
|
||||
::: tip 提示
|
||||
与 `opensearch.yml` 一样,你也可以在 Docker Compose 文件中将自定义的 `opensearch_dashboards.yml` 传递给容器。
|
||||
:::
|
||||
|
||||
1. 运行 `docker-compose up`。
|
||||
|
||||
等待容器启动,然后参阅 [OpenSearch Dashboards 文档](/dashboards/)。
|
||||
|
||||
1. 完成后,运行 `docker-compose down`。
|
||||
@@ -0,0 +1,132 @@
|
||||
---
|
||||
title: Helm
|
||||
---
|
||||
|
||||
# 使用 Helm 运行 OpenSearch Dashboards
|
||||
|
||||
Helm 是一个包管理器,可以让你在 Kubernetes 集群(Cluster)中轻松安装和管理 OpenSearch Dashboards。你可以在 YAML 文件中定义 OpenSearch 配置,并使用 Helm 以版本可控、可重现的方式部署应用程序。
|
||||
|
||||
Helm chart 包含下表所述的资源。
|
||||
|
||||
资源 | 描述
|
||||
:--- | :---
|
||||
`Chart.yaml` | chart 的相关信息。
|
||||
`values.yaml` | chart 的默认配置值。
|
||||
`templates` | 与配置值组合以生成 Kubernetes 清单文件的模板。
|
||||
|
||||
默认 Helm chart 中的规范支持许多标准用例和部署方式。你可以修改默认 chart 以配置所需的规范,并设置传输层安全(Transport Layer Security,TLS)和基于角色的访问控制(Role-based Access Control,RBAC)。
|
||||
|
||||
有关默认配置、安全配置步骤和可配置参数的信息,请参阅
|
||||
[README](https://github.com/opensearch-project/helm-charts/tree/main/charts)。
|
||||
|
||||
::: info 注意
|
||||
此处的说明假定你已有一个预装了 Helm 的 Kubernetes 集群。有关配置 Kubernetes 集群的步骤,请参阅 [Kubernetes 文档](https://kubernetes.io/docs/setup/);有关安装 Helm 的步骤,请参阅 [Helm 文档](https://helm.sh/docs/intro/install/)。
|
||||
:::
|
||||
|
||||
## 前提条件
|
||||
|
||||
开始之前,你必须先[使用 Helm 安装 OpenSearch](/install-and-configure/install-opensearch/helm)。
|
||||
|
||||
确保你可以向 OpenSearch pod 发送请求:
|
||||
|
||||
```json
|
||||
$ curl -XGET https://localhost:9200 -u 'admin:<custom-admin-password>' --insecure
|
||||
{
|
||||
"name" : "opensearch-cluster-master-1",
|
||||
"cluster_name" : "opensearch-cluster",
|
||||
"cluster_uuid" : "hP2gq5bPS3SLp8Z7wXm8YQ",
|
||||
"version" : {
|
||||
"distribution" : "opensearch",
|
||||
"number" : "1.0.0",
|
||||
"build_type" : "tar",
|
||||
"build_hash" : "34550c5b17124ddc59458ef774f6b43a086522e3",
|
||||
"build_date" : "2021-07-02T23:22:21.383695Z",
|
||||
"build_snapshot" : false,
|
||||
"lucene_version" : "8.8.2",
|
||||
"minimum_wire_compatibility_version" : "6.8.0",
|
||||
"minimum_index_compatibility_version" : "6.0.0-beta1"
|
||||
},
|
||||
"tagline" : "The OpenSearch Project: https://opensearch.org/"
|
||||
}
|
||||
```
|
||||
|
||||
## 使用 Helm 安装 OpenSearch Dashboards
|
||||
|
||||
1. 切换到 `opensearch-dashboards` 目录:
|
||||
|
||||
```bash
|
||||
cd opensearch-dashboards
|
||||
```
|
||||
|
||||
1. 打包 Helm chart:
|
||||
|
||||
```bash
|
||||
helm package .
|
||||
```
|
||||
|
||||
1. 部署 OpenSearch Dashboards:
|
||||
|
||||
```bash
|
||||
helm install --generate-name opensearch-dashboards-1.0.0.tgz
|
||||
```
|
||||
输出会显示本次安装实例化的规范。
|
||||
要自定义部署,请通过自定义 YAML 文件传入要覆盖的值:
|
||||
|
||||
```bash
|
||||
helm install --values=customvalues.yaml opensearch-dashboards-1.0.0.tgz
|
||||
```
|
||||
|
||||
#### 示例输出
|
||||
|
||||
```yaml
|
||||
NAME: opensearch-dashboards-1-1629223356
|
||||
LAST DEPLOYED: Tue Aug 17 18:02:37 2021
|
||||
NAMESPACE: default
|
||||
STATUS: deployed
|
||||
REVISION: 1
|
||||
TEST SUITE: None
|
||||
NOTES:
|
||||
1. Get the application URL by running these commands:
|
||||
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=opensearch-dashboards,app.kubernetes.io/instance=op
|
||||
ensearch-dashboards-1-1629223356" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
```
|
||||
|
||||
要确认 OpenSearch Dashboards pod 已启动并正常运行,请运行以下命令:
|
||||
|
||||
```bash
|
||||
$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
opensearch-cluster-master-0 1/1 Running 0 4m35s
|
||||
opensearch-cluster-master-1 1/1 Running 0 4m35s
|
||||
opensearch-cluster-master-2 1/1 Running 0 4m35s
|
||||
opensearch-dashboards-1-1629223356-758bd8747f-8www5 1/1 Running 0 66s
|
||||
```
|
||||
|
||||
要设置端口转发以访问 OpenSearch Dashboards,请退出 OpenSearch shell 并运行以下命令:
|
||||
|
||||
```bash
|
||||
$ kubectl port-forward deployment/opensearch-dashboards-1-1629223356 5601
|
||||
```
|
||||
|
||||
现在,你可以在浏览器中通过 http://localhost:5601 访问 OpenSearch Dashboards。
|
||||
|
||||
## 使用 Helm 卸载
|
||||
|
||||
确定要删除的 OpenSearch Dashboards 部署:
|
||||
|
||||
```bash
|
||||
$ helm list
|
||||
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
|
||||
opensearch-1-1629223146 default 1 2021-08-17 17:59:07.664498239 +0000 UTCdeployedopensearch-1.0.0 1.0.0
|
||||
opensearch-dashboards-1-1629223356 default 1 2021-08-17 18:02:37.600796946 +0000 UTCdepl
|
||||
oyedopensearch-dashboards-1.0.0 1.0.0
|
||||
```
|
||||
|
||||
要删除或卸载某个部署,请运行以下命令:
|
||||
|
||||
```bash
|
||||
helm delete opensearch-dashboards-1-1629223356
|
||||
```
|
||||
@@ -0,0 +1,64 @@
|
||||
---
|
||||
title: 安装 OpenSearch Dashboards
|
||||
---
|
||||
|
||||
# 安装 OpenSearch Dashboards
|
||||
|
||||
OpenSearch Dashboards 提供了一个完全集成的解决方案,用于以可视化方式探索、发现和查询可观测性(Observability)数据。你可以通过以下任一方式安装 OpenSearch Dashboards:
|
||||
|
||||
- [Docker](/install-and-configure/install-dashboards/docker)
|
||||
- [Tarball](/install-and-configure/install-dashboards/tar)
|
||||
- [RPM](/install-and-configure/install-dashboards/rpm)
|
||||
- [Debian](/install-and-configure/install-dashboards/debian)
|
||||
- [Helm](/install-and-configure/install-dashboards/helm)
|
||||
- [Windows](/install-and-configure/install-dashboards/windows)
|
||||
|
||||
## 浏览器兼容性
|
||||
|
||||
OpenSearch Dashboards 支持以下 Web 浏览器:
|
||||
|
||||
- Chrome
|
||||
- Firefox
|
||||
- Safari
|
||||
- Edge (Chromium)
|
||||
|
||||
其他基于 Chromium 的浏览器也可能可以使用。**不**支持 Internet Explorer 和 Microsoft Edge Legacy。
|
||||
|
||||
## Node.js 兼容性 {#nodejs-compatibility}
|
||||
|
||||
OpenSearch Dashboards 需要 Node.js 运行时二进制文件才能运行。[OpenSearch 下载页面](https://opensearch.org/downloads.html)提供的发行包中已包含该文件。
|
||||
|
||||
OpenSearch Dashboards 2.8.0 及更高版本可以使用 Node.js 14、16 和 18 版本。OpenSearch Dashboards 2.10.0 及更高版本的发行包包含 Node.js 18 和 14(用于向后兼容)。
|
||||
|
||||
要使用发行包自带版本以外的 Node.js 运行时二进制文件,请按照以下步骤操作:
|
||||
|
||||
1. 下载并安装 [Node.js](https://nodejs.org/en/download);兼容的版本为 `>=14.20.1 <19`。
|
||||
2. 将安装路径设置到 `NODE_HOME` 或 `NODE_OSD_HOME` 环境变量。
|
||||
|
||||
- 在 UNIX 上,如果 Node.js 安装在 `/usr/local/nodejs`,且运行时二进制文件为 `/usr/local/nodejs/bin/node`:
|
||||
```bash
|
||||
export NODE_HOME=/usr/local/nodejs
|
||||
```
|
||||
|
||||
- 如果 Node.js 是通过 NVM 安装的,且运行时二进制文件为 `/Users/user/.nvm/versions/node/v18.19.0/bin/node`:
|
||||
```bash
|
||||
export NODE_HOME=/Users/user/.nvm/versions/node/v18.19.0
|
||||
# 或者,如果 NODE_HOME 已用于其他用途:
|
||||
export NODE_OSD_HOME=/Users/user/.nvm/versions/node/v18.19.0
|
||||
```
|
||||
|
||||
- 在 Windows 上,如果 Node.js 安装在 `C:\Program Files\nodejs`,且运行时二进制文件为 `C:\Program Files\nodejs\node.exe`:
|
||||
```powershell
|
||||
set "NODE_HOME=C:\Program Files\nodejs"
|
||||
# 或者使用 PowerShell:
|
||||
$Env:NODE_HOME = 'C:\Program Files\nodejs'
|
||||
```
|
||||
|
||||
请查阅操作系统文档,了解如何持久化地修改环境变量。
|
||||
|
||||
OpenSearch Dashboards 启动脚本 `bin/opensearch-dashboards` 会先使用 `NODE_OSD_HOME`,
|
||||
然后使用 `NODE_HOME` 查找 Node.js 运行时二进制文件,找不到时才使用发行包自带的二进制文件。如果找不到可用的 Node.js 运行时二进制文件,启动脚本会尝试在系统级 `PATH` 中查找,仍然找不到则启动失败。
|
||||
|
||||
## 配置
|
||||
|
||||
要了解如何为 OpenSearch Dashboards 配置 TLS,请参阅[配置 TLS](/install-and-configure/install-dashboards/tls)。
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
title: 管理 OpenSearch Dashboards 插件
|
||||
---
|
||||
|
||||
# 管理 OpenSearch Dashboards 插件
|
||||
|
||||
OpenSearch Dashboards 提供了一个名为 `opensearch-dashboards-plugin` 的命令行工具,用于管理插件(plugin)。使用该工具,你可以:
|
||||
|
||||
- 列出已安装的插件。
|
||||
- 安装插件。
|
||||
- 删除已安装的插件。
|
||||
|
||||
## 插件兼容性
|
||||
|
||||
::: danger 警告
|
||||
插件的主版本号、次版本号和补丁版本号必须与 OpenSearch 的主版本号、次版本号和补丁版本号一致,才能兼容。例如,2.3.0.x 版本的插件只能与 OpenSearch 2.3.0 配合使用。
|
||||
:::
|
||||
|
||||
## 前提条件
|
||||
|
||||
- 一个兼容的 OpenSearch 集群(Cluster)
|
||||
- [已在该集群上安装](/install-and-configure/plugins)对应的 OpenSearch 插件
|
||||
- 对应版本的 [OpenSearch Dashboards](/)(例如,OpenSearch Dashboards 2.3.0 与 OpenSearch 2.3.0 配合使用)
|
||||
|
||||
## 可用插件
|
||||
|
||||
下表列出了可用的 OpenSearch Dashboards 插件。
|
||||
|
||||
| 插件名称 | 仓库 | 最早可用版本 |
|
||||
| :--- | :--- | :--- |
|
||||
| Alerting Dashboards | [alerting-dashboards-plugin](https://github.com/opensearch-project/alerting-dashboards-plugin) | 1.0.0 |
|
||||
| Anomaly Detection Dashboards | [anomaly-detection-dashboards-plugin](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin) | 1.0.0 |
|
||||
| Custom Import Maps Dashboards | [dashboards-maps](https://github.com/opensearch-project/dashboards-maps) | 2.2.0 |
|
||||
| Search Relevance Dashboards | [dashboards-search-relevance](https://github.com/opensearch-project/dashboards-search-relevance) | 2.4.0 |
|
||||
| Gantt Chart Dashboards | [gantt-chart](https://github.com/opensearch-project/dashboards-visualizations) | 1.0.0 |
|
||||
| Index Management Dashboards | [index-management-dashboards-plugin](https://github.com/opensearch-project/index-management-dashboards-plugin) | 1.0.0 |
|
||||
| Notebooks Dashboards | [dashboards-notebooks](https://github.com/opensearch-project/dashboards-notebooks) | 1.0.0 |
|
||||
| Notifications Dashboards | [dashboards-notifications](https://github.com/opensearch-project/dashboards-notifications) | 2.0.0 |
|
||||
| Observability Dashboards | [dashboards-observability](https://github.com/opensearch-project/dashboards-observability) | 2.0.0 |
|
||||
| Query Workbench Dashboards | [query-workbench](https://github.com/opensearch-project/dashboards-query-workbench) | 1.0.0 |
|
||||
| Reports Dashboards | [dashboards-reporting](https://github.com/opensearch-project/dashboards-reporting) | 1.0.0 |
|
||||
| Security Analytics Dashboards | [security-analytics-dashboards-plugin](https://github.com/opensearch-project/security-analytics-dashboards-plugin)| 2.4.0 |
|
||||
| Security Dashboards | [security-dashboards-plugin](https://github.com/opensearch-project/security-dashboards-plugin) | 1.0.0 |
|
||||
|
||||
## 安装
|
||||
|
||||
进入 OpenSearch Dashboards 主目录(例如 `/usr/share/opensearch-dashboards`),然后为每个插件运行安装命令。
|
||||
|
||||
## 查看已安装插件列表
|
||||
|
||||
要在命令行中查看已安装插件列表,请使用以下命令:
|
||||
|
||||
```bash
|
||||
sudo bin/opensearch-dashboards-plugin list
|
||||
```
|
||||
|
||||
## 删除插件
|
||||
|
||||
要删除插件:
|
||||
|
||||
```bash
|
||||
sudo bin/opensearch-dashboards-plugin remove <plugin-name>
|
||||
```
|
||||
|
||||
然后从 `opensearch_dashboards.yml` 中删除所有相关条目。
|
||||
|
||||
对于某些插件,你还必须删除「optimize」bundle。以下是 Anomaly Detection 插件的示例命令:
|
||||
|
||||
```bash
|
||||
sudo rm /usr/share/opensearch-dashboards/optimize/bundles/opensearch-anomaly-detection-opensearch-dashboards.*
|
||||
```
|
||||
|
||||
然后重启 OpenSearch Dashboards。删除任何插件后,OpenSearch Dashboards 会在下次启动时执行一次 optimize 操作。即使在性能很好的机器上,该操作也需要几分钟,请耐心等待。
|
||||
|
||||
## 更新插件
|
||||
|
||||
OpenSearch Dashboards 不会更新插件。你需要删除旧版本及其 optimize bundle,重新安装,然后重启 OpenSearch Dashboards:
|
||||
|
||||
1. 删除旧版本:
|
||||
|
||||
```bash
|
||||
sudo bin/opensearch-dashboards-plugin remove <plugin-name>
|
||||
```
|
||||
|
||||
1. 删除 optimize bundle:
|
||||
|
||||
```bash
|
||||
sudo rm /usr/share/opensearch-dashboards/optimize/bundles/<bundle-name>
|
||||
```
|
||||
|
||||
1. 重新安装新版本:
|
||||
|
||||
```bash
|
||||
sudo bin/opensearch-dashboards-plugin install <plugin-name>
|
||||
```
|
||||
|
||||
1. 重启 OpenSearch Dashboards。
|
||||
|
||||
例如,要删除并重新安装 Anomaly Detection 插件:
|
||||
|
||||
```bash
|
||||
sudo bin/opensearch-dashboards-plugin remove anomalyDetectionDashboards
|
||||
sudo rm /usr/share/opensearch-dashboards/optimize/bundles/opensearch-anomaly-detection-opensearch-dashboards.*
|
||||
sudo bin/opensearch-dashboards-plugin install <AD OpenSearch Dashboards plugin artifact URL>
|
||||
```
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
title: RPM
|
||||
---
|
||||
|
||||
# 使用 RPM 包管理器(RPM)运行 OpenSearch Dashboards
|
||||
|
||||
OpenSearch Dashboards 是 OpenSearch 数据的默认可视化工具。它还是许多 OpenSearch 插件(plugin)的用户界面,包括安全、告警(alerting)、索引状态管理(Index State Management,ISM)、SQL 等。
|
||||
|
||||
## 从安装包安装 OpenSearch Dashboards
|
||||
|
||||
1. 直接从 [OpenSearch 下载页面](https://opensearch.org/downloads.html)下载所需版本的 RPM 包。RPM 包提供 **x64** 和 **arm64** 两种架构的版本。
|
||||
1. 导入公共 GPG 密钥。该密钥用于验证你的 OpenSearch 实例已签名。
|
||||
```bash
|
||||
sudo rpm --import https://artifacts.opensearch.org/publickeys/opensearch.pgp
|
||||
```
|
||||
1. 在命令行界面(CLI)中,你可以使用 `rpm` 或 `yum` 安装该软件包。
|
||||
**x64**
|
||||
```bash
|
||||
# 使用 yum 安装 x64 软件包。
|
||||
sudo yum install opensearch-dashboards-2.12.0-linux-x64.rpm
|
||||
# 使用 rpm 安装 x64 软件包。
|
||||
sudo rpm -ivh opensearch-dashboards-2.12.0-linux-x64.rpm
|
||||
```
|
||||
**arm64**
|
||||
```bash
|
||||
# 使用 yum 安装 arm64 软件包。
|
||||
sudo yum install opensearch-dashboards-2.12.0-linux-arm64.rpm
|
||||
# 使用 rpm 安装 arm64 软件包。
|
||||
sudo rpm -ivh opensearch-dashboards-2.12.0-linux-arm64.rpm
|
||||
```
|
||||
1. 安装成功后,将 OpenSearch Dashboards 启用为服务。
|
||||
```bash
|
||||
sudo systemctl enable opensearch-dashboards
|
||||
```
|
||||
1. 启动 OpenSearch Dashboards。
|
||||
```bash
|
||||
sudo systemctl start opensearch-dashboards
|
||||
```
|
||||
1. 验证 OpenSearch Dashboards 是否正确启动。
|
||||
```bash
|
||||
sudo systemctl status opensearch-dashboards
|
||||
```
|
||||
|
||||
## 从本地 YUM 仓库安装 OpenSearch Dashboards
|
||||
|
||||
YUM 是基于 Red Hat 的操作系统的主要包管理工具,可以从 YUM 仓库库中下载并安装 RPM 包。
|
||||
|
||||
1. 为 OpenSearch Dashboards 创建本地仓库文件:
|
||||
```bash
|
||||
sudo curl -SL https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.x/opensearch-dashboards-2.x.repo -o /etc/yum.repos.d/opensearch-dashboards-2.x.repo
|
||||
```
|
||||
1. 验证仓库是否创建成功。
|
||||
```bash
|
||||
sudo yum repolist
|
||||
```
|
||||
1. 清理 YUM 缓存,以确保顺利安装:
|
||||
```bash
|
||||
sudo yum clean all
|
||||
```
|
||||
1. 下载仓库文件后,列出 OpenSearch Dashboards 的所有可用版本:
|
||||
```bash
|
||||
sudo yum list opensearch-dashboards --showduplicates
|
||||
```
|
||||
1. 选择要安装的 OpenSearch Dashboards 版本:
|
||||
- 除非另行指定,否则会安装 OpenSearch 的最高次要版本。
|
||||
```bash
|
||||
sudo yum install opensearch-dashboards
|
||||
```
|
||||
- 要安装特定版本的 OpenSearch Dashboards:
|
||||
```bash
|
||||
sudo yum install 'opensearch-dashboards-2.12.0'
|
||||
```
|
||||
1. 安装过程中,安装程序会显示 GPG 密钥指纹。请验证其与以下信息一致:
|
||||
```bash
|
||||
Fingerprint: c5b7 4989 65ef d1c2 924b a9d5 39d3 1987 9310 d3fc
|
||||
```
|
||||
- 如果一致,输入 `yes` 或 `y`,OpenSearch 安装将继续进行。
|
||||
1. 完成后,即可运行 OpenSearch Dashboards。
|
||||
```bash
|
||||
sudo systemctl start opensearch-dashboards
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: Tarball
|
||||
---
|
||||
|
||||
# 使用 tarball 运行 OpenSearch Dashboards
|
||||
|
||||
1. 从 [OpenSearch 下载页面](https://opensearch.org/downloads.html)下载 tarball。
|
||||
|
||||
1. 将 TAR 文件解压到一个目录,并切换到该目录:
|
||||
|
||||
```bash
|
||||
# x64
|
||||
tar -zxf opensearch-dashboards-2.12.0-linux-x64.tar.gz
|
||||
cd opensearch-dashboards
|
||||
# ARM64
|
||||
tar -zxf opensearch-dashboards-2.12.0-linux-arm64.tar.gz
|
||||
cd opensearch-dashboards
|
||||
```
|
||||
|
||||
1. 如有需要,修改 `config/opensearch_dashboards.yml`。
|
||||
|
||||
1. 运行 OpenSearch Dashboards:
|
||||
|
||||
```bash
|
||||
./bin/opensearch-dashboards
|
||||
```
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
title: 配置 TLS
|
||||
---
|
||||
|
||||
# 为 OpenSearch Dashboards 配置 TLS
|
||||
|
||||
默认情况下,为了便于测试和入门,OpenSearch Dashboards 通过 HTTP 运行。要为 HTTPS 启用 TLS,请在 `opensearch_dashboards.yml` 中更新以下设置。
|
||||
|
||||
设置 | 描述
|
||||
:--- | :---
|
||||
`server.ssl.enabled` | 启用 OpenSearch Dashboards 服务器与用户 Web 浏览器之间的 SSL 通信。设置为 `true` 表示使用 HTTPS,设置为 `false` 表示使用 HTTP。
|
||||
`server.ssl.supportedProtocols` | 指定支持的 TLS 协议数组。可选值为 `TLSv1`、`TLSv1.1`、`TLSv1.2` 和 `TLSv1.3`。默认值为 `['TLSv1.1', 'TLSv1.2', and 'TLSv1.3']`。
|
||||
`server.ssl.cipherSuites` | 指定 TLS 密码套件数组。可选。
|
||||
`server.ssl.certificate` | 如果 `server.ssl.enabled` 设置为 `true`,则指定 OpenSearch Dashboards 有效的 Privacy Enhanced Mail(PEM)服务器证书的完整路径。你可以[生成自己的证书](/security/configuration/generate-certificates),也可以从证书颁发机构(CA)获取证书。
|
||||
`server.ssl.key` | 如果 `server.ssl.enabled` 设置为 `true`,则指定服务器证书密钥的完整路径,例如 `/usr/share/opensearch-dashboards-1.0.0/config/my-client-cert-key.pem`。你可以[生成自己的证书](/security/configuration/generate-certificates),也可以从 CA 获取证书。
|
||||
`server.ssl.keyPassphrase` | 设置密钥的密码。如果密钥没有密码,请省略此设置。可选。
|
||||
`server.ssl.keystore.path` | 使用 JKS(Java KeyStore)或 PKCS12/PFX(Public-Key Cryptography Standards)文件代替 PEM 证书和密钥。
|
||||
`server.ssl.keystore.password` | 设置密钥库的密码。必需。
|
||||
`server.ssl.clientAuthentication` | 指定要使用的 TLS 客户端认证模式。可以是以下值之一:`none`、`optional` 或 `required`。如果设置为 `required`,Web 浏览器需要发送由 `server.ssl.certificateAuthorities` 中配置的 CA 签名的有效客户端证书。默认值为 `none`。
|
||||
`server.ssl.certificateAuthorities` | 以数组形式指定一个或多个 CA 证书的完整路径,这些 CA 签发了用于客户端认证的证书。如果 `server.ssl.clientAuthentication` 设置为 `optional` 或 `required`,则此项必需。
|
||||
`server.ssl.truststore.path` | 使用 JKS 或 PKCS12/PFX 信任库文件代替 PEM CA 证书。
|
||||
`server.ssl.truststore.password` | 设置信任库的密码。必需。
|
||||
`opensearch.ssl.verificationMode` | 建立 OpenSearch 与 OpenSearch Dashboards 之间的通信。有效值为 `full`、`certificate` 或 `none`。如果启用了 TLS,建议使用 `full`,它会启用主机名验证。`certificate` 会检查证书,但不检查主机名。`none` 不执行任何检查(适用于 HTTP)。默认值为 `full`。
|
||||
`opensearch.ssl.certificateAuthorities` | 如果 `opensearch.ssl.verificationMode` 设置为 `full` 或 `certificate`,则以数组形式指定一个或多个 CA 证书的完整路径,这些证书构成 OpenSearch 集群(Cluster)的可信证书链。例如,如果你使用中间 CA 签发了 admin 证书、客户端证书和节点证书,则可能需要同时包含根 CA *和*中间 CA。
|
||||
`opensearch.ssl.truststore.path` | 使用 JKS 或 PKCS12/PFX 信任库文件代替 PEM CA 证书。
|
||||
`opensearch.ssl.truststore.password` | 设置信任库的密码。必需。
|
||||
`opensearch.ssl.alwaysPresentCertificate` | 如果设置为 `true`,则向 OpenSearch 集群发送客户端证书;在 OpenSearch 中启用 mTLS 时必须如此设置。默认值为 `false`。
|
||||
`opensearch.ssl.certificate` | 如果 `opensearch.ssl.alwaysPresentCertificate` 设置为 `true`,则指定用于 OpenSearch 集群的有效客户端证书的完整路径。你可以[生成自己的证书](/security/configuration/generate-certificates),也可以从 CA 获取证书。
|
||||
`opensearch.ssl.key` | 如果 `opensearch.ssl.alwaysPresentCertificate` 设置为 `true`,则指定客户端证书密钥的完整路径。你可以[生成自己的证书](/security/configuration/generate-certificates),也可以从 CA 获取证书。
|
||||
`opensearch.ssl.keyPassphrase` | 设置密钥的密码。如果密钥没有密码,请省略此设置。可选。
|
||||
`opensearch.ssl.keystore.path` | 使用 JKS 或 PKCS12/PFX 密钥库文件代替 PEM 证书和密钥。
|
||||
`opensearch.ssl.keystore.password` | 设置密钥库的密码。必需。
|
||||
`opensearch_security.cookie.secure` | 如果为 OpenSearch Dashboards 启用了 TLS,请将此设置改为 `true`。对于 HTTP,请设置为 `false`。
|
||||
|
||||
以下 `opensearch_dashboards.yml` 配置展示了 OpenSearch 和 OpenSearch Dashboards 使用演示配置在同一台机器上运行的情形:
|
||||
|
||||
```yml
|
||||
server.ssl.enabled: true
|
||||
server.ssl.certificate: /usr/share/opensearch-dashboards/config/client-cert.pem
|
||||
server.ssl.key: /usr/share/opensearch-dashboards/config/client-cert-key.pem
|
||||
opensearch.hosts: ["https://localhost:9200"]
|
||||
opensearch.ssl.verificationMode: full
|
||||
opensearch.ssl.certificateAuthorities: [ "/usr/share/opensearch-dashboards/config/root-ca.pem", "/usr/share/opensearch-dashboards/config/intermediate-ca.pem" ]
|
||||
opensearch.username: "kibanaserver"
|
||||
opensearch.password: "kibanaserver"
|
||||
opensearch.requestHeadersAllowlist: [ authorization,securitytenant ]
|
||||
opensearch_security.multitenancy.enabled: true
|
||||
opensearch_security.multitenancy.tenants.preferred: ["Private", "Global"]
|
||||
opensearch_security.readonly_mode.roles: ["kibana_read_only"]
|
||||
opensearch_security.cookie.secure: true
|
||||
```
|
||||
|
||||
如果你使用 Docker 安装方式,可以将自定义的 `opensearch_dashboards.yml` 文件传递给容器。要了解更多信息,请参阅 [Docker 安装页面](/install-and-configure/install-opensearch/docker)。
|
||||
|
||||
启用这些设置并启动应用程序后,你可以通过 `https://localhost:5601` 连接到 OpenSearch Dashboards。如果你的证书是自签名的,可能需要确认浏览器警告。为了避免此类警告(或浏览器完全不兼容),最佳实践是使用来自受信任 CA 的证书。
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
title: Windows
|
||||
---
|
||||
|
||||
# 在 Windows 上运行 OpenSearch Dashboards
|
||||
|
||||
按照以下步骤在 Windows 上安装 OpenSearch Dashboards。
|
||||
|
||||
::: info 注意
|
||||
确保已安装 zip 解压工具。
|
||||
:::
|
||||
|
||||
1. 下载 [`opensearch-dashboards-2.12.0-windows-x64.zip`](https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.12.0/opensearch-dashboards-2.12.0-windows-x64.zip) 压缩包。
|
||||
|
||||
1. 要解压压缩包内容,请右键单击并选择 **Extract All**(全部解压缩)。
|
||||
|
||||
**注意**:某些版本的 Windows 操作系统会限制文件路径长度。如果解压时遇到与路径长度相关的错误,请执行以下步骤启用长路径支持:
|
||||
|
||||
1. 在任务栏 **Start**(开始)旁的搜索框中输入 `powershell`,打开 Powershell。
|
||||
1. 在 Powershell 中运行以下命令:
|
||||
```bat
|
||||
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled -Type DWORD -Value 1 -Force
|
||||
```
|
||||
1. 重启计算机。
|
||||
|
||||
1. 运行 OpenSearch Dashboards。
|
||||
|
||||
有两种方式可以运行 OpenSearch Dashboards:
|
||||
|
||||
1. 使用 Windows 图形界面运行批处理脚本:
|
||||
|
||||
1. 进入 OpenSearch Dashboards 安装的顶层目录,打开 `opensearch-dashboards-2.12.0` 文件夹。
|
||||
1. 如有需要,修改 `config` 文件夹中的 `opensearch_dashboards.yml`,以更改 OpenSearch Dashboards 的默认设置。
|
||||
1. 打开 `bin` 文件夹,双击 `opensearch-dashboards.bat` 文件运行批处理脚本。这会打开一个命令提示符窗口,其中运行着一个 OpenSearch Dashboards 实例。
|
||||
|
||||
1. 从命令提示符或 Powershell 运行批处理脚本:
|
||||
|
||||
1. 在任务栏 **Start**(开始)旁的搜索框中输入 `cmd` 打开命令提示符,或输入 `powershell` 打开 Powershell。
|
||||
1. 切换到 OpenSearch Dashboards 安装的顶层目录。
|
||||
```bat
|
||||
cd \path\to\opensearch-dashboards-2.12.0
|
||||
```
|
||||
1. 如有需要,修改 `config\opensearch_dashboards.yml`。
|
||||
1. 运行批处理脚本以启动 OpenSearch Dashboards。
|
||||
```bat
|
||||
.\bin\opensearch-dashboards.bat
|
||||
```
|
||||
|
||||
::: tip 提示
|
||||
要停止 OpenSearch Dashboards,请在命令提示符或 Powershell 中按 `Ctrl+C`,或者直接关闭命令提示符或 Powershell 窗口。
|
||||
:::
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title: Ansible playbook
|
||||
---
|
||||
|
||||
# Ansible playbook
|
||||
|
||||
你可以使用 Ansible playbook 安装和配置可用于生产环境的 OpenSearch 集群(Cluster)以及 OpenSearch Dashboards。
|
||||
|
||||
::: info 注意
|
||||
Ansible playbook 仅支持将 OpenSearch 和 OpenSearch Dashboards 部署到 CentOS7 主机。
|
||||
:::
|
||||
|
||||
## 前提条件
|
||||
|
||||
确保已安装 [Ansible](https://www.ansible.com/) 和 [Java 8](https://www.java.com/en/download/manual.jsp)。
|
||||
|
||||
## 配置
|
||||
|
||||
1. 克隆 OpenSearch 的 [ansible-playbook](https://github.com/opensearch-project/ansible-playbook) 仓库:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/opensearch-project/ansible-playbook
|
||||
```
|
||||
|
||||
2. 在 `inventories/opensearch/hosts` 文件中配置节点(Node)属性:
|
||||
|
||||
```bash
|
||||
ansible_host=<Public IP address> ansible_user=root ip=<Private IP address / 0.0.0.0>
|
||||
```
|
||||
|
||||
其中:
|
||||
|
||||
- `ansible_host` 是你希望 Ansible playbook 在其上安装 OpenSearch 和 OpenSearch Dashboards 的目标节点的 IP 地址。
|
||||
- `ip` 是你希望 OpenSearch 和 OpenSearch Dashboards 绑定的 IP 地址。你可以指定目标节点的私有 IP、localhost 或 0.0.0.0。
|
||||
|
||||
3. 你可以在 `inventories/opensearch/group_vars/all/all.yml` 文件中修改默认配置值。例如,你可以增大 Java 堆内存大小:
|
||||
|
||||
```bash
|
||||
xms_value: 8
|
||||
xmx_value: 8
|
||||
```
|
||||
|
||||
::: info 注意
|
||||
确保你可以通过 SSH 直接以 root 用户访问目标节点。
|
||||
:::
|
||||
|
||||
## 使用 Ansible playbook 运行 OpenSearch 和 OpenSearch Dashboards
|
||||
|
||||
1. 以 root 权限运行 Ansible playbook:
|
||||
|
||||
```bash
|
||||
ansible-playbook -i inventories/opensearch/hosts opensearch.yml --extra-vars "admin_password=Test@123 kibanaserver_password=Test@6789 logstash_password=Test@456"
|
||||
```
|
||||
|
||||
你可以使用 `admin_password`、`kibanaserver_password` 和 `logstash_password` 变量为保留用户(`admin`、`kibanaserver` 和 `logstash`)设置密码。
|
||||
|
||||
2. 部署完成后,你可以使用用户名 `admin` 和为 `admin_password` 变量设置的密码访问 OpenSearch 和 OpenSearch Dashboards。
|
||||
|
||||
如果将 `ip` 绑定到私有 IP 或 localhost,请确保已登录到部署 playbook 的服务器,以访问 OpenSearch 和 OpenSearch Dashboards:
|
||||
|
||||
```bash
|
||||
curl https://localhost:9200 -u 'admin:Test@123' --insecure
|
||||
```
|
||||
|
||||
如果将 `ip` 绑定到 0.0.0.0,则将 `localhost` 替换为公有 IP 或私有 IP(如果位于同一网络中)。
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user