Elasticsearch 认证模拟题 - 17

这两道题目非常具有代表性,分别是跨集群复制和跨集群检索,需要相应的 许可 这里在虚拟机上搭建集群完成这两道题目,这里补充一下 elasticsearch 和 kibana 的配置文件

rust 复制代码
# elasticsearch.yml
cluster.name: cluster2
node.name: cluster2-node
path.data: /home/jie/es8/cluster2/data
path.logs: /home/jie/es8/cluster2/logs
bootstrap.memory_lock: true
network.host: 192.168.78.10
http.port: 9202
transport.port: 9302
discovery.seed_hosts: ["cluster2-node"]
cluster.initial_master_nodes: ["cluster2-node"]
xpack.security.enabled: false

# jvm.options
-Xms1g
-Xmx1g

# kibana.yml
server.port: 5603
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://192.168.78.10:9202"]

一、题目

跨集群查询

rust 复制代码
# 向 cluster_one 写入数据
POST test/_bulk
{"index": {}}
{"cluster_name": "cluster_one"}

# 向 cluster_two写入数据
POST test/_bulk
{"index": {}}
{"cluster_name": "cluster_two"}
1.1 考点
  1. 跨集群查询配置
  2. 跨集群查询检索
  3. 节点角色

这里需要注意的是节点角色需要有 remote_cluster_client 角色

1.2 答案
rust 复制代码
# 建立远程连接
PUT _cluster/settings
{
  "persistent": {
    "cluster": {
      "remote": {
        "cluster_one": {
          "seeds": [
            "192.168.78.10:9301"
          ]
        },
        "cluster_two": {
          "seeds": [
            "192.168.78.10:9302"
          ]
        }
      }
    }
  }
}

# 查看远程连接信息
GET _remote/info

# 搜索 cluster_one 和 cluster_two 集群的 test 索引
POST cluster_one:test,cluster_two:test/_search

二、题目

跨集群复制

2.1 考点
  1. 许可证适用:Stack Management -> License Management -> Start a 30-day trial
  2. 跨集群复制
2.2 答案

创建远程连接集群

rust 复制代码
PUT _cluster/settings
{
  "persistent": {
    "cluster": {
      "remote": {
        "cluster_one": {
          "seeds": [
            "192.168.78.10:9301"
          ]
        },
        "cluster_two": {
          "seeds": [
            "192.168.78.10:9302"
          ]
        }
      }
    }
  }
}

创建主从索引的过程整体是通过 kibana 操作完成的
Stack Management -> Cross-Cluster Replication -> Create a follower index

最后要记得启动

相关推荐
独自破碎E4 小时前
【BISHI15】小红的夹吃棋
android·java·开发语言
Dxy12393102167 小时前
Elasticsearch 索引与映射:为你的数据打造一个“智能仓库”
大数据·elasticsearch·搜索引擎
李堇7 小时前
android滚动列表VerticalRollingTextView
android·java
lxysbly8 小时前
n64模拟器安卓版带金手指2026
android
游戏开发爱好者811 小时前
日常开发与测试的 App 测试方法、查看设备状态、实时日志、应用数据
android·ios·小程序·https·uni-app·iphone·webview
王码码203511 小时前
Flutter for OpenHarmony 实战之基础组件:第三十一篇 Chip 系列组件 — 灵活的标签化交互
android·flutter·交互·harmonyos
黑码哥11 小时前
ViewHolder设计模式深度剖析:iOS开发者掌握Android列表性能优化的实战指南
android·ios·性能优化·跨平台开发·viewholder
倒流时光三十年12 小时前
SpringBoot 数据库同步 Elasticsearch 性能优化
数据库·spring boot·elasticsearch
亓才孓12 小时前
[JDBC]元数据
android
独行soc12 小时前
2026年渗透测试面试题总结-17(题目+回答)
android·网络·安全·web安全·渗透测试·安全狮