aws-elasticsearch - AWS ElasticSearch 收缩 API 节点名称
问题描述
AWS ElasticSearch 的 AWS Docs 有一个关于收缩 API 的部分:
该示例显示了如何缩小:
{
"settings": {
"index.routing.allocation.require._name": "name-of-the-node-to-shrink-to",
"index.blocks.read_only": true
}
}
PUT https://domain.region.es.amazonaws.com/source-index/_settings
{
"settings": {
"index.routing.allocation.require._name": null,
"index.blocks.read_only": false
}
}
PUT https://domain.region.es.amazonaws.com/shrunken-index/_settings
{
"settings": {
"index.routing.allocation.require._name": null,
"index.blocks.read_only": false
}
}
我在哪里得到name-of-the-node-to-shrink-to
,source-index
和shrunken-index
?
解决方案
对于收缩操作:
索引的所有主分片必须驻留在同一节点上。 https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html
“ name-of-the-node-to-shrink-to ”参数将索引的分片重新定位到此特定节点。
您可以使用cat 节点 API获取集群的节点名称:
GET /_cat/nodes?v&h=name
接下来,您要对其执行收缩操作的索引中的源索引。这个过程会创建一个新的目标索引,这将是你的shrunken-index
您将进行以下 API 调用来执行收缩操作:
POST /my_source_index/_shrink/my_target_index
{
"settings": {
"index.routing.allocation.require._name": null,
"index.blocks.write": null
}
}
您在 AWS 文档中看到的另外两个调用用于清除source-index和shrunken-index的分配要求
您也可以按照Elastic 的指南进行操作。
推荐阅读
- python - Python:使用多个标题行写入 CSV
- angular - Angular 6 导入 Karma 测试中使用的 3rd 方 JS 文件的正确方法
- php - 如何在 EC2 实例上的 Docker 容器(Nginx、PHP7-fpm)中运行 Laravel
- java - 仅映射作业的默认分隔符
- react-native - 带有本机反应的过滤器按钮
- php - 无法在 php 中连接到 mysql 8
- cypress - 赛普拉斯如何选择包含文本的选项
- php - 使用 codeigniter 的简单示例 php 无法访问错误消息
- sql - 在 SQL Server 中的组内传输特定信息
- node.js - 无法在 Ubuntu 上启动 Angular 6 应用程序 - 详细堆栈退出状态 137