ElasticSearch之跨集群搜索cross cluster search

写在前面

本文看下跨集群搜索相关内容。

1:实战

1.1:创建集群

复制代码
bin/elasticsearch -E node.name=cluster0node -E cluster.name=cluster0 -E path.data=cluster0_data -E discovery.type=single-node -E http.port=9200 -E transport.port=9300
bin/elasticsearch -E node.name=cluster1node -E cluster.name=cluster1 -E path.data=cluster1_data -E discovery.type=single-node -E http.port=9201 -E transport.port=9301
bin/elasticsearch -E node.name=cluster2node -E cluster.name=cluster2 -E path.data=cluster2_data -E discovery.type=single-node -E http.port=9202 -E transport.port=9302

1.2:设置各个集群支持跨集群搜索

复制代码
curl -XPUT "http://localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d'
{"persistent":{"cluster":{"remote":{"cluster0":{"seeds":["127.0.0.1:9300"],"transport.ping_schedule":"30s"},"cluster1":{"seeds":["127.0.0.1:9301"],"transport.compress":true,"skip_unavailable":true},"cluster2":{"seeds":["127.0.0.1:9302"]}}}}}'

curl -XPUT "http://localhost:9201/_cluster/settings" -H 'Content-Type: application/json' -d'
{"persistent":{"cluster":{"remote":{"cluster0":{"seeds":["127.0.0.1:9300"],"transport.ping_schedule":"30s"},"cluster1":{"seeds":["127.0.0.1:9301"],"transport.compress":true,"skip_unavailable":true},"cluster2":{"seeds":["127.0.0.1:9302"]}}}}}'

curl -XPUT "http://localhost:9202/_cluster/settings" -H 'Content-Type: application/json' -d'
{"persistent":{"cluster":{"remote":{"cluster0":{"seeds":["127.0.0.1:9300"],"transport.ping_schedule":"30s"},"cluster1":{"seeds":["127.0.0.1:9301"],"transport.compress":true,"skip_unavailable":true},"cluster2":{"seeds":["127.0.0.1:9302"]}}}}}'

1.3:创建测试数据

复制代码
curl -XPOST "http://localhost:9200/users/_doc" -H 'Content-Type: application/json' -d'
{"name":"user1","age":10}'

curl -XPOST "http://localhost:9201/users/_doc" -H 'Content-Type: application/json' -d'
{"name":"user2","age":20}'

curl -XPOST "http://localhost:9202/users/_doc" -H 'Content-Type: application/json' -d'
{"name":"user3","age":30}'

1.4:搜索测试

http://192.168.10.96:9201/users,cluster1:users,cluster2:users/_search:

写在后面

参考文章列表

相关推荐
岳涛_daemon12 小时前
数值照旧填、请求没报错,ES 9.3 把 max_size 换成按主分片算,索引要更大才滚动
elasticsearch
csdn2015_15 小时前
git 只显示最近一个月活跃的分支
git·elasticsearch·策略模式
岳涛_daemon17 小时前
检索|同一个字段,TSDB 默认开 skippers、普通索引默认关,ES 不建 BKD 也能过滤
elasticsearch
岳涛_daemon20 小时前
考古|string 在 ES 5.0 拆成 text 和 keyword,分不分词从此写进类型名
elasticsearch
岳涛_daemon2 天前
什么都没配,ES 的 HNSW 早停在 9.3 前后创建的索引默认值不一样,按创建版本算
elasticsearch
Elastic 中国社区官方博客2 天前
从 137,306 行日志定位到一个故障副本:在 Kibana 中排查错误激增
大数据·运维·人工智能·安全·elasticsearch·搜索引擎
Elasticsearch2 天前
无需改动一行代码:在 Java 应用中使用 OpenTelemetry 的四种方式
elasticsearch
Elasticsearch2 天前
Kibana Enhance:一键检查并调整现有仪表板的样式
elasticsearch
岳涛_daemon2 天前
考古|ES 2.0 禁的元字段只有 10 个,_source 和 _version 不在里面
elasticsearch
岳涛_daemon2 天前
考古|ES 2.0 先整体解码再切分路径,文档 id 里的 %2F 被切开,个别 id 查不到
elasticsearch