zoukankan      html  css  js  c++  java
  • elasticearch corss cluster search

    STEP 1: 设定三个Cluster,一个主机一个cluster
    bin/elasticsearch -E node.name=win88 -E cluster.name=cluster0 -E discovery.type=single-node -E path.data=cluster0-data -E http.port=9200 -E transport.port=9300 -E network.host=0.0.0.0
    bin/elasticsearch -E node.name=win89 -E cluster.name=cluster1 -E discovery.type=single-node -E path.data=cluster1-data -E http.port=9200 -E transport.port=9300 -E network.host=0.0.0.0
    bin/elasticsearch -E node.name=win90 -E cluster.name=cluster2 -E path.data=cluster2-data -E discovery.type=single-node -E http.port=9200 -E transport.port=9300 -E network.host=0.0.0.0

    STEP2 cluster 设定

    点击查看代码 `curl -XPUT "http://win88.inno.com:9200/_cluster/settings" -H 'Content-Type:application/json' -d' > {"persistent": {"cluster": {"remote": {"cluster0": {"seeds": ["win88:9300"],"transport.ping_schedule":"30s"}, "cluster1": {"seeds": ["win89:9300"],"transport.compress":true,"skip_unavailable":true}, "cluster2": {"seeds": ["win90:9300"] } } } } }'`

    设置成功后有以下显示
    {"acknowledged":true,"persistent":{"cluster":{"remote":{"cluster1":{"skip_unavailable":"true","seeds":["win89:9300"],"transport":{"compress":"true"}},"cluster0":{"seeds":["win88:9300"],"transport":{"ping_schedule":"30s"}},"cluster2":{"seeds":["win90:9300"]}}}},"transient":{}}

    SETP3 创建三个Cluster上创建相同的索引
    `curl -XPOST "http://win88:9200/users/_doc" -H 'Content-Type: application/json' -d'

    {"name":"user1","age":10}'`

    ` curl -XPOST "http://win89:9200/users/_doc" -H 'Content-Type: application/json' -d'

    {"name":"user2","age":20}'`

    curl -XPOST "http://win90:9200/users/_doc" -H 'Content-Type: application/json' -d'

    {"name":"user3","age":30}'

    SETP4. cross client search

    点击查看代码
    curl -XGET "http://win88.inno.com:9200/users,cluster1:users,cluster2:users/_search" 
    curl -XGET "http://win89.inno.com:9200/users,cluster0:users,cluster2:users/_search" 
    curl -XGET "http://win90.inno.com:9200/users,cluster0:users,cluster1:users/_search" 
    

    每天进步一点点,多思考,多总结 版权声明:本文为CNblog博主「zaituzhong」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
  • 相关阅读:
    二分查找
    转:归并排序
    C++ STL stack和queue
    spring-第十九篇AOP面向切面编程之增强处理的优先级
    spring-第十八篇之spring AOP基于XML配置文件的管理方式
    spring-第十七篇之spring AOP基于注解的零配置方式
    spring-第十一篇之SpEL表达式
    spring-第八篇之容器中的bean的生命周期
    spring-第七篇之深入理解容器中的bean
    spring-第二篇ApplicationContext国际化及事件机制
  • 原文地址:https://www.cnblogs.com/tingxin/p/15552492.html
Copyright © 2011-2022 走看看