From 869996705759ae620c7ec22861bfcd570c5cbf3d Mon Sep 17 00:00:00 2001 From: bicijinlian Date: Thu, 13 Apr 2023 22:31:12 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Docs/使用RestClient管理ES集群.http | 54 ++++++++++++++++++++- Docs/使用RestSharp库管理ES集群.ipynb | 44 +++++++++++++++-- 2 files changed, 93 insertions(+), 5 deletions(-) diff --git a/Docs/使用RestClient管理ES集群.http b/Docs/使用RestClient管理ES集群.http index 5ba47c3..03d9494 100644 --- a/Docs/使用RestClient管理ES集群.http +++ b/Docs/使用RestClient管理ES集群.http @@ -1,9 +1,13 @@ -## 全局变量 +# 说明:ES是通过提供WEBAPI的方式进行交互的。 +# url参数v是显示更多(标题);对于json结果,参数pretty是人类友好json(未压缩便于阅读) +# 全局变量 //ES服务管理WebApi地址 @baseUrl = https://127.0.0.1:9201 //帐号认证信息:除了用户名:密码形式外,也可使用使用其它base64字符串 @accounts = elastic:es-461400 + + ### 请求ES首页 GET {{baseUrl}}?pretty Content-Type: application/json @@ -18,3 +22,51 @@ Authorization: Basic {{accounts}} GET {{baseUrl}}/_cat/health?v Content-Type: application/json Authorization: Basic {{accounts}} + +# 集群故障诊断,主要有到_cat和_cluster +### 集群中的节点 +GET {{baseUrl}}/_cat/nodes?v +Content-Type: application/json +Authorization: Basic {{accounts}} + +### 节点属性 +GET {{baseUrl}}/_cat/nodeattrs?v +Content-Type: application/json +Authorization: Basic {{accounts}} + +### 健康状态 +GET {{baseUrl}}/_cat/health?v +Content-Type: application/json +Authorization: Basic {{accounts}} + +### 所有索引 +GET {{baseUrl}}/_cat/indices?v +Content-Type: application/json +Authorization: Basic {{accounts}} + +### 指定状态索引 +GET {{baseUrl}}/_cat/indices?health=green&v=true +Content-Type: application/json +Authorization: Basic {{accounts}} + +### 分片 +GET {{baseUrl}}/_cat/shards?v +Content-Type: application/json +Authorization: Basic {{accounts}} + +### 检查集群状态 +GET {{baseUrl}}/_cluster/health?pretty +Content-Type: application/json +Authorization: Basic {{accounts}} + +### 诊断分片:没有异常分片时会报错 +GET {{baseUrl}}/_cluster/allocation/explain +Content-Type: application/json +Authorization: Basic {{accounts}} + + +### 搜索 +GET {{baseUrl}}/_search?pretty +Content-Type: application/json +Authorization: Basic {{accounts}} + diff --git a/Docs/使用RestSharp库管理ES集群.ipynb b/Docs/使用RestSharp库管理ES集群.ipynb index 4f21d06..fb4ceda 100644 --- a/Docs/使用RestSharp库管理ES集群.ipynb +++ b/Docs/使用RestSharp库管理ES集群.ipynb @@ -19,7 +19,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -28,7 +28,17 @@ "kernelName": "csharp" } }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
Restore sources
  • https://api.nuget.org/v3/index.json
Installed Packages
  • RestSharp, 110.2.0
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "//引入 RestSharp 类库\n", "#i \"nuget:https://api.nuget.org/v3/index.json\"\n", @@ -59,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "dotnet_interactive": { "language": "csharp" @@ -68,7 +78,33 @@ "kernelName": "csharp" } }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{\n", + " \"name\" : \"study-es-cluster-master\",\n", + " \"cluster_name\" : \"study-es-cluster\",\n", + " \"cluster_uuid\" : \"x9tU46-NSLiRUQJb_aXCCQ\",\n", + " \"version\" : {\n", + " \"number\" : \"8.7.0\",\n", + " \"build_flavor\" : \"default\",\n", + " \"build_type\" : \"zip\",\n", + " \"build_hash\" : \"09520b59b6bc1057340b55750186466ea715e30e\",\n", + " \"build_date\" : \"2023-03-27T16:31:09.816451435Z\",\n", + " \"build_snapshot\" : false,\n", + " \"lucene_version\" : \"9.5.0\",\n", + " \"minimum_wire_compatibility_version\" : \"7.17.0\",\n", + " \"minimum_index_compatibility_version\" : \"7.0.0\"\n", + " },\n", + " \"tagline\" : \"You Know, for Search\"\n", + "}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "//集群主页\n", "{\n",