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

写在后面

参考文章列表

相关推荐
{⌐■_■}9 小时前
【git】提交修改、回撤、回滚、Tag 操作讲解,与reset (--soft、--mixed、--hard) 的区别
大数据·git·elasticsearch
screamn11 小时前
ElasticSearch详解
大数据·elasticsearch·jenkins
不是乖小孩11 小时前
elasticsearch在windows上的配置
大数据·elasticsearch·jenkins
罗技12311 小时前
推荐给 Easysearch 新用户的几个 Elasticsearch 可视化工具
大数据·elasticsearch·jenkins
光仔December1 天前
【Elasticsearch入门到落地】8、RestClient操作索引库-基础介绍及导入demo
elasticsearch·搜索引擎·全文检索·索引·映射
risc1234561 天前
【Elasticsearch】Retrieve inner hits获取嵌套查询的具体的嵌套文档来源,以及父子文档的来源
elasticsearch
铭毅天下1 天前
极限网关可视化——Elasticsearch 请求流量分析实战
大数据·elasticsearch·搜索引擎·全文检索·jenkins
宇智波云1 天前
ubuntu22.4搭建单节点es8.1
运维·elasticsearch
risc1234561 天前
【Elasticsearch】搜索时排序规则
elasticsearch
铭毅天下1 天前
Elasticsearch 中如何限制和指定 IP 地址的访问?
大数据·tcp/ip·elasticsearch·搜索引擎·全文检索