Cross Cluster Search简介

cross-cluster search功能允许任何节点作为跨多个群集的federated client(联合客户端),与tribe node不同的是cross-cluster search节点并不会加入remote cluster(远程集群),而是用轻量的方法连接到remote cluster,以便执行federated search(联合搜索)

Remote cluster

要使用cross-cluster search之前需要先了解remote cluster

一个remote cluster中有"name"和seed nodes(种子节点)列表以供引用,注册remote cluster时,会从其中一个seed node来检查其集群状态,以便在默认情况下选择最多三个有资格的节点作为gateway nodes(网关节点), 集群中配置了remote cluster的每个节点都连接到一个或多个gateway nodes,并使用它们将federated search到remote cluster。

可以使用集群设置(可以动态更新)在全局指定remote cluster,也可以在各个节点中的elasticsearch.yml指定remote cluster 。

如果节点通过elasticsearch.yml文件配置remote cluster,则可以通过该节点连接到remote cluster。换句话说,federated search只有发送到该节点才能连接到remote cluster。通过cluster settings API 设置的remote cluster集群中的每个节点(设置了cluster.remote.connect: true的节点)都可以连接。

通过elasticsearch.yml设置

cluster:
remote:
cluster_one:
seeds: 127.0.0.1:
cluster_two:
seeds: 127.0.0.1:

cluster_one和cluster_two表示与每个群集连接的任意群集别名。这些名称之后用于区分本地和远程索引

使用cluster settings API设置:

PUT _cluster/settings
{
"persistent": {
"cluster": {
"remote": {
"cluster_one": {
"seeds": [
"127.0.0.1:9300"
]
},
"cluster_two": {
"seeds": [
"127.0.0.1:9301"
]
},
"cluster_three": {
"seeds": [
"127.0.0.1:9302"
]
}
}
}
}
}

删除远程群集:

PUT _cluster/settings
{
"persistent": {
"cluster": {
"remote": {
"cluster_three": {
"seeds": null
}
}
}
}
}

删除cluster_three保留cluster_one和cluster_tow

Remote cluster的设置:

cluster.remote.connections_per_cluster

gateway nodes数量,默认是3

cluster.remote.initial_connect_timeout

节点启动时等待远程节点的超时时间,默认是30s

cluster.remote.node.attr

一个节点属性,用于过滤掉remote cluster中 符合gateway nodes的节点,比如设置cluster.remote.node.attr=gateway,那么将匹配节点属性node.attr.gateway: true

cluster.remote.connect

默认情况下,群集中的任意节点都可以充当federated client并连接到remote cluster,cluster.remote.connect可以设置为 false(默认为true)以防止某些节点连接到remote cluster

cluster.remote.${cluster_alias}.skip_unavailable

在节点中跳过特定的群集别名,默认是false

使用cross-cluster search查询

要搜索远程集群cluster_one上的twitter索引,index名和集群别用冒号分开:

GET /cluster_one:twitter/_search
{
"query": {
"match": {
"user": "kimchy"
}
}
}

与tribe特征相反,cross-cluster search还可以在不同群集上搜索相同名称的index:

GET /cluster_one:twitter,twitter/_search
{
"query": {
"match": {
"user": "kimchy"
}
}
}

搜索结果的歧义与索引在请求中消除歧义的方式相同。即使index名称相同,这些index也会在合并结果时被视为不同的index。从远程index检索的所有结果都将以remote cluster的name为前缀:

{
"took": ,
"timed_out": false,
"_shards": {
"total": ,
"successful": ,
"failed": ,
"skipped":
},
"_clusters": {
"total": ,
"successful": ,
"skipped":
},
"hits": {
"total": ,
"max_score": ,
"hits": [
{
"_index": "cluster_one:twitter",
"_type": "_doc",
"_id": "",
"_score": ,
"_source": {
"user": "kimchy",
"date": "2009-11-15T14:12:12",
"message": "trying out Elasticsearch",
"likes":
}
},
{
"_index": "twitter",
"_type": "_doc",
"_id": "",
"_score": ,
"_source": {
"user": "kimchy",
"date": "2009-11-15T14:12:12",
"message": "trying out Elasticsearch",
"likes":
}
}
]
}
}

跳过已经断开连接的集群:

默认情况下,在执行搜索请求时,通过cross-cluster search搜索的所有remote cluster都必须可用,否则整个请求将失败,并且尽管某些群集可用,但不会返回搜索结果。可以通过skip_unavailable设置使remote cluster可选,默认设置为false。

PUT _cluster/settings
{
"persistent": {
"cluster.remote.cluster_two.skip_unavailable": true
}
}

cluster_two就变成可选的了

GET /cluster_one:twitter,cluster_two:twitter,twitter/_search
{
"query": {
"match": {
"user": "kimchy"
}
}
}

在本地、cluster_onecluster_two中搜索索引twitter

{
"took": ,
"timed_out": false,
"_shards": {
"total": ,
"successful": ,
"failed": ,
"skipped":
},
"_clusters": { #clusters部分表示一个群集不可用并被跳过
"total": ,
"successful": ,
"skipped":
},
"hits": {
"total": ,
"max_score": ,
"hits": [
{
"_index": "cluster_one:twitter",
"_type": "_doc",
"_id": "",
"_score": ,
"_source": {
"user": "kimchy",
"date": "2009-11-15T14:12:12",
"message": "trying out Elasticsearch",
"likes":
}
},
{
"_index": "twitter",
"_type": "_doc",
"_id": "",
"_score": ,
"_source": {
"user": "kimchy",
"date": "2009-11-15T14:12:12",
"message": "trying out Elasticsearch",
"likes":
}
}
]
}
}

Elasticsearch 搜索模块之Cross Cluster Search(跨集群搜索)的更多相关文章

  1. ES cross cluster search跨集群查询

    ES 5.3以后出的新功能.测试demo如下: 下载ES 5.5版本,然后分别本机创建2个实例,配置如下: cluster.name: xx1 network.host: 127.0.0.1 http ...

  2. Elasticsearch跨集群搜索(Cross Cluster Search)

    1.简介 Elasticsearch在5.3版本中引入了Cross Cluster Search(CCS 跨集群搜索)功能,用来替换掉要被废弃的Tribe Node.类似Tribe Node,Cros ...

  3. Elasticsearch:跨集群搜索 Cross-cluster search (CCS)

    转载自:https://blog.csdn.net/UbuntuTouch/article/details/104588232 跨集群搜索(cross-cluster search)使您可以针对一个或 ...

  4. Elasticsearch:跨集群搜索 Cross-cluster search(CCS)及安全

    文章转载自:https://elasticstack.blog.csdn.net/article/details/116569527

  5. Elasticsearch 主从同步之跨集群复制

    文章转载自:https://mp.weixin.qq.com/s/alHHxXont6XFm_m9PfsGfw 1.什么是跨集群复制? 跨集群复制(Cross-cluster replication, ...

  6. elasticsearch跨集群数据迁移

    写这篇文章,主要是目前公司要把ES从2.4.1升级到最新版本7.8,不过现在是7.9了,官方的文档:https://www.elastic.co/guide/en/elasticsearch/refe ...

  7. 实现Kubernetes跨集群服务应用的高可用

    在Kubernetes 1.3版本,我们希望降低跨集群跨地区服务部署相关的管理和运营难度.本文介绍如何实现此目标. 注意:虽然本文示例使用谷歌容器引擎(GKE)来提供Kubernetes集群,您可以在 ...

  8. ProxySQL Cluster 高可用集群环境部署记录

    ProxySQL在早期版本若需要做高可用,需要搭建两个实例,进行冗余.但两个ProxySQL实例之间的数据并不能共通,在主实例上配置后,仍需要在备用节点上进行配置,对管理来说非常不方便.但是Proxy ...

  9. mysql innodb cluster 无感知集群

    MySQL 8.0.12 innodb cluster 高可用集群部署运维管理手册 Innodb cluster 原理介绍 Innodb cluster  利用组复制的 pxos 协议,保障数据一致性 ...

随机推荐

  1. 洛谷P1316 丢瓶盖【二分】【贪心】

    题目:https://www.luogu.org/problemnew/show/P1316 题意: 给定a个点的坐标(在一条直线上),现在要选b个点,问这b个点的最近距离的最大值是多少. 思路: 感 ...

  2. 基于LSD的直线提取算法

    https://blog.csdn.net/tianwaifeimao/article/details/17678669 文献翻译:https://blog.csdn.net/YuYunTan/art ...

  3. sql语句 isnull(列名,'')='' /STUFF的意思

    (1) SELECT  SYXH,ZYHM,YEXH,ISNULL(YETZ,'') AS YETZ ,RYKSMC,RYBQMC,HZXM FROM YG_BRSYK 如果列名数据等于NULL,那么 ...

  4. Navicat工具、pymysql模块 sql注入

    cls超 Navicat工具.pymysql模块 阅读目录 一 IDE工具介绍 二 pymysql模块 一 IDE工具介绍(Navicat) 生产环境还是推荐使用mysql命令行,但为了方便我们测试, ...

  5. Vue 数据响应式原理

    Vue 数据响应式原理 Vue.js 的核心包括一套“响应式系统”.“响应式”,是指当数据改变后,Vue 会通知到使用该数据的代码.例如,视图渲染中使用了数据,数据改变后,视图也会自动更新. 举个简单 ...

  6. Flume 在有赞大数据的实践

    https://mp.weixin.qq.com/s/gd0KMAt7z0WbrJL0RkMEtA 原创: 有赞技术 有赞coder 今天 文 | hujiahua on 大数据 一.前言 Flume ...

  7. 【软件测试】Junit入门

    写在前面:本博客为本人原创,严禁任何形式的转载!本博客只允许放在博客园(.cnblogs.com),如果您在其他网站看到这篇博文,请通过下面这个唯一的合法链接转到原文! 本博客全网唯一合法URL:ht ...

  8. [dpdk] TSC , HPET, Timer, Event Timer,RDTSCP

    关于dpdk timer跨越CPU core调度的准确性问题 首先dpdk的timer接口里边使用 cpu cycle来比较时间.根据之前的内容 [dpdk] dpdk --lcores参数 当一个E ...

  9. SortedMap与TreeMap的一个典型应用

    一下是在项目中的应用. msg.getContent()共有四种类型. public SortedMap<String, List<ActivityMsg>> queryTri ...

  10. .2 Git 分支 - 分支的新建与合并

    分支的新建与合并 https://git-scm.com/book/zh/v1/Git-%E5%88%86%E6%94%AF-%E5%88%86%E6%94%AF%E7%9A%84%E6%96%B0% ...