• ES的Java Rest client---jest


    Elasticsearch的入门非常简单易学。

    由于有丰富的原生的Restful API,创建索引,上传数据,搜索都可以在很短时间内学会使用。官网上也有很多语言的client API与ES集群交互,有丰富的插件比如head,marvel等等。

    那如果用ES这个开源项目做SAAS(software as a service),比如搜索服务,是否可以直接用它原生的API呢?

    jest是一款java Rest client,它支持SSL、proxy等等,而原生的transport client是TCP连接,用户认证授权要自己想办法实现,并且封装接口控制用户的操作。

    从jest的文档中我找到了一部分答案:

    ElasticSearch does not have Java rest client. It has only native client comes built in. That is the gap. You can add security layer to HTTP but native API. That is why none of SAAS offerings can be used with native api. -- Searchly

    原生的API没有任何安全保护层,而对于HTTP来说加一层安全认证是比较简单的。

    jest client和原生的client的比较还有:

    So if you have several ES clusters running different versions, then using the native (or transport) client will be a problem, and you will need to go HTTP (and Jest is the main option I think). If versioning is not an issue, the native client will be your best option as it is cluster aware (thus knows how to route your queries and does not need another hop), and also moves some computation away from your ES cluster (like merging search results that will be done locally instead of on the data node). -- Rotem Hermon

    如果ES集群的版本不同,用HTTP client会好些。如果版本不是问题,原生的client是最好的选择。因为它是culster-aware的,并且可以从ES集群分担一部分计算,比如合并搜索结果是在本地client执行的而不是data node。

    There are several alternative clients available when working with ElasticSearch from Java, like Jest that provides a POJO marshalling mechanism on indexing and for the search results. In this example we are using the Client that is included in ElasticSearch. By default the client doesn't use the REST API but connects to the cluster as a normal node that just doesn't store any data. It knows about the state of the cluster and can route requests to the correct node but supposedly consumes more memory. For our application this doesn't make a huge difference but for production systems that's something to think about. -- Florian Hopf

    原生的client像一个单纯的节点连接集群,它知道集群的状态和路由请求,这样会消耗多一些内存,在生产环境是值得考虑的影响。

    开源的东西到底要不要经常用呢?感觉初级开发人员还是少用为好。

  • 相关阅读:
    新浪微博千万级规模高性能、高并发的网络架构经验分享
    PHP- 如何在终端输出带颜色的字体?
    淘宝大秒杀系统是如何设计的?
    如何打造千万级Feed流系统
    Redis实现分布式锁 php
    Ubuntu16.04 安装PHP7 的 imagick 扩展
    nginx配置http访问自动跳转到https
    使用Redis来实现LBS的应用
    PHP多进程编程初步
    选redis还是memcache,源码怎么说
  • 原文地址:https://www.cnblogs.com/flyingbee6/p/5118964.html
Copyright © 2020-2023  润新知