Skip to content

Commit ebf9b79

Browse files
committed
add cluster_apis
1 parent f86e4e3 commit ebf9b79

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ npm run docs:dev
882882
- cat thread pool
883883
- cat trained model
884884
- cat transforms
885-
- Cluster APIs
885+
- :heavy_check_mark: 集群API [:link:](https://elasticsearch.bookhub.tech/rest_apis/rest_apis/cluster_apis)
886886
- Cluster allocation explain
887887
- Cluster get settings
888888
- Cluster health
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# 集群 API
2+
3+
:::info 新 API 参考
4+
有关最新 API 的详细信息,参阅[集群 API](https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-cluster)
5+
:::
6+
7+
## 节点规范
8+
9+
某些集群级 API 可在节点子集上运行,这些节点子集可通过*节点过滤器*指定。例如,[任务管理](./task_management)[节点统计](./cluster_stats)[节点信息](./nodes_info) API 都可以报告经过筛选的节点集而非全部节点的结果。
10+
11+
*节点过滤器*是以逗号分隔的单个过滤器列表形式编写的,每个过滤器都可从所选子集中添加或删除节点。每个过滤器可以是以下其中之一:
12+
13+
- `_all`,将所有节点添加到子集中。
14+
- `_local`,将本地节点添加到子集中。
15+
- `_master`,将当前选中的主节点加入子集。
16+
- 节点 ID 或名称,将该节点添加到子集中。
17+
- IP 地址或主机名,将所有匹配的节点添加到子集中。
18+
- 模式,使用 `*` 通配符,将名称、地址或主机名与该模式匹配的所有节点添加到子集中。
19+
- `master:true``data:true``ingest:true``voting_only:true``ml:true``coordinating_only:true`,分别将所有符合主节点资格的节点、所有数据节点、所有摄取节点、所有仅投票节点、所有机器学习节点和所有仅协调节点添加到子集中。
20+
- `master:false``data:false``ingest:false``voting_only:false``ml:false``coordinating_only:false`,分别从子集中移除所有符合主节点资格的节点、所有数据节点、所有摄取节点、所有仅投票节点、所有机器学习节点和所有仅协调节点。
21+
- 模式对,使用 `*` 通配符,其形式为 `attrname:attrvalue`,用于将名称和值符合相应模式的自定义节点属性添加到子集中。[自定义节点属性](/set_up_elasticsearch/configuring_elasticsearch/node_settings#自定义节点属性)是通过在配置文件中设置形式为 `node.attr.attrname:attrvalue` 的属性来配置的。
22+
23+
:::note 提示
24+
节点过滤器的运行顺序,这一点在使用从节点集中移除节点的过滤器时非常重要。例如,`_all,master:false` 表示除符合主节点条件的节点外的所有节点,但 `master:false,_all` 的意思与 `_all` 相同,因为 `_all` 过滤器在 `master:false` 过滤器之后运行。
25+
:::
26+
27+
:::note 提示
28+
如果没有给出筛选条件,默认情况下会选择所有节点。但是,如果给定了任何筛选器,它们就会从一个空的所选子集开始运行。这意味着,`master:false` 等从所选子集中移除节点的筛选器只有在其他筛选器之后才有用。单独使用时,`master:false` 不会选择任何节点。
29+
:::
30+
31+
下面是节点过滤器与节点信息 API 配合使用的一些示例。
32+
33+
```bash
34+
# If no filters are given, the default is to select all nodes
35+
GET /_nodes
36+
# Explicitly select all nodes
37+
GET /_nodes/_all
38+
# Select just the local node
39+
GET /_nodes/_local
40+
# Select the elected master node
41+
GET /_nodes/_master
42+
# Select nodes by name, which can include wildcards
43+
GET /_nodes/node_name_goes_here
44+
GET /_nodes/node_name_goes_*
45+
# Select nodes by address, which can include wildcards
46+
GET /_nodes/10.0.0.3,10.0.0.4
47+
GET /_nodes/10.0.0.*
48+
# Select nodes by role
49+
GET /_nodes/_all,master:false
50+
GET /_nodes/data:true,ingest:true
51+
GET /_nodes/coordinating_only:true
52+
GET /_nodes/master:true,voting_only:false
53+
# Select nodes by custom attribute (e.g. with something like `node.attr.rack: 2` in the configuration file)
54+
GET /_nodes/rack:2
55+
GET /_nodes/ra*:2
56+
GET /_nodes/ra*:2*
57+
```
58+
59+
60+
61+
> [原文链接](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html)

sidebars.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ const sidebars = {
151151
'rest_apis/behavioral_analytics_apis/post_analytics_collection_event'
152152
]
153153
},
154+
{
155+
type: 'category',
156+
label: '集群 API',
157+
link: { type: 'doc', id: "rest_apis/cluster_apis/cluster_apis" },
158+
items: [
159+
]
160+
},
154161
{
155162
type: 'category',
156163
label: '数据流 API',

0 commit comments

Comments
 (0)