简体   繁体   English

Elasticsearch - 从 2.x 升级到 7.x - 使用 TransportClient 和 Jest 进行双重写入

[英]Elasticsearch - Upgrading from 2.x to 7.x - Dual write using TransportClient and Jest

We are in process of migrating from elasticsearch 2.x to 7.x, the approach is to dual write to both the clusters.我们正在从 elasticsearch 2.x 迁移到 7.x,方法是对两个集群进行双重写入。 Later in time, restore the snapshot from 2.x to 7.x in multiple hops of 2.x to 5.x then 5.x to 6.x and finally 6.x to 7.x.稍后,在 2.x 到 5.x、5.x 到 6.x 和最后 6.x 到 7.x 的多个跃点中将快照从 2.x 恢复到 7.x。

Now, the issue is enabling dual write to old and new clusters, we are using TransportClient (tcp connection) and Jest (http connection) to index documents, is there any client which can handle this?现在,问题是启用对新旧集群的双重写入,我们使用 TransportClient(tcp 连接)和 Jest(http 连接)来索引文档,有没有客户端可以处理这个问题? As far as I know, Jest doesn't have support for 7.x, what are our choices here?据我所知,Jest 不支持 7.x,我们在这里有什么选择?

EDIT编辑

We are using Kafka connect to ship the same updates to 7.x elasticsearch.我们正在使用 Kafka connect 将相同的更新发送到 7.x elasticsearch。 This question is still open for people looking for non-kafka solutions.对于寻找非 kafka 解决方案的人来说,这个问题仍然是开放的。

You are right JEST doesn't support the 7.X and Elasticsearch official clients are not available for 2.X :) and till now there is no client which can write to both the versions, even Elasticsearch clients are released with its server version and are not compatible when there is a change in the major version.你说得对,JEST 不支持 7.X 并且 Elasticsearch 官方客户端不适用于 2.X :) 到目前为止,还没有可以写入这两个版本的客户端,即使 Elasticsearch 客户端随其服务器版本一起发布,并且当主要版本发生变化时不兼容。

Also, As you are using Java, I would highly recommend using the high-level client , instead of transport the client.另外,当您使用 Java 时,我强烈建议使用高级客户端,而不是传输客户端。 As mentioned in official ES blog , soon transport clients would be deprecated in favor of the high-level clients.正如官方 ES 博客中提到的,很快传输客户端将被高级别客户端所取代。 text from the same blog:来自同一博客的文字:

The high-level client will eventually replace the transport client in the future, hence we invite all our Java users to try it out and migrate to it if possible.高级客户端最终将在未来取代传输客户端,因此我们邀请所有 Java 用户尝试并尽可能迁移到它。 The current release supports the following Elasticsearch APIs:当前版本支持以下 Elasticsearch API:

Solution:解决方案:

You need to use maven shade plugin to relocate the class exist in either of your jest or Elasticsearch client as they have conflicting classes and this way you can use both the clients and using them you can index and query their Elasticsearch servers.您需要使用 maven shade 插件来重新定位您的jestElasticsearch 客户端中存在的类,因为它们具有冲突的类,这样您就可以同时使用这两个客户端,并使用它们可以索引和查询它们的 Elasticsearch 服务器。

More info on shade plugins can be found here and here .可以在此处此处找到有关阴影插件的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM