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

最后要记得启动

相关推荐
2501_91600747几秒前
在 CICD 中实践 Fastlane + Appuploader 命令行,构建可复制的 iOS 自动化发布流程
android·运维·ios·小程序·uni-app·自动化·iphone
煤球王子21 分钟前
简单了解:Android14中的Input event
android
2501_9159214330 分钟前
从 HBuilder 到 App Store,uni-app 与 HBuilder 项目的 iOS 上架流程实战解析
android·ios·小程序·https·uni-app·iphone·webview
天向上1 小时前
ubuntu系统adb shell报错 ADB server didn‘t ACK
android·linux·ubuntu·adb
小猪佩奇TONY1 小时前
OpenGL-ES 学习(18) ---- 实例化渲染
学习·elasticsearch·信息可视化
xiaoyan20151 小时前
自研2025版flutter3.38实战抖音app短视频+聊天+直播商城系统
android·flutter·dart
愤怒的代码2 小时前
深入解析 SystemUI 依赖注入:Dagger2 实践剖析
android·dagger
半夏知半秋2 小时前
MongoDB 与 Elasticsearch 数据同步方案整理
大数据·数据库·mongodb·elasticsearch·搜索引擎
游戏开发爱好者82 小时前
以 uni-app 为核心的 iOS 上架流程实践, 从构建到最终提交的完整路径
android·ios·小程序·https·uni-app·iphone·webview
hashiqimiya2 小时前
在hbuidex的项目导入androidstudio离线生成apk
android