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

写在后面

参考文章列表

相关推荐
Elasticsearch1 天前
Elasticsearch:你是说,用于混合搜索(hybrid search)
elasticsearch
一个很帅的帅哥1 天前
git命令大全
大数据·git·elasticsearch
Energet!c1 天前
Nginx access 日志通过 Filebeat 8.15.5 写入 Elasticsearch 8 实战指南
nginx·elasticsearch·filebeat·openresty
又是努力搬砖的一年1 天前
elasticsearch修改字段类型
android·大数据·elasticsearch
Elasticsearch1 天前
在 Kibana 中可视化你的 Bosch Smart Home 数据
elasticsearch
管理大亨1 天前
企业级ELK:从日志收集到业务驱动
java·大数据·网络·数据库·elk·elasticsearch
小马爱打代码1 天前
架构设计:ElasticSearch+HBase 海量存储架构设计与实现
大数据·elasticsearch·hbase
破烂pan1 天前
Elasticsearch 8.x + Python 官方客户端实战教程
python·elasticsearch
·云扬·1 天前
【Bug】 Elasticsearch启动失败(exit code 78):2个bootstrap检查问题排查与解决
elasticsearch·bootstrap·bug
五阿哥永琪2 天前
Git 开发常用命令速查手册
大数据·git·elasticsearch