Java Zookeeper 的真实使用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1479442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 12:42:15  来源:igfitidea点击:

Real World Use of Zookeeper

javaconfigurationapache-zookeeperdistributed

提问by Jon

I've been looking at Zookeeperrecently and wondered whether anybody was using it currently and what they were specifically using it for storing.

我最近一直在看Zookeeper,想知道目前是否有人在使用它,以及他们专门使用它来存储什么。

The most common use case is for configuration information, but what kind of data and how much data are you storing?

最常见的用例是配置信息,但是您存储了哪些类型的数据以及多少数据?

采纳答案by John Ellinwood

The Apache CXF implementationof DOSGi uses zookeeper for its service registration repository. Individual containers have a distributed software (dsw) bundle that listens for all service events and when a service status changes that has a property indicating distribution. The dsw talks to the discovery bundle which, in the reference implementation case, uses zookeeper to store service as ephemeral nodes. Other instances will look for changes to the node structure and register proxies on their local systems. The end result is you can code to plain OSGi and end up with transparent distribution.

DOSGi的Apache CXF 实现使用 zookeeper 作为其服务注册存储库。单个容器具有一个分布式软件 (dsw) 包,用于侦听所有服务事件,并在服务状态更改时具有指示分布的属性。dsw 与发现包通信,在参考实现案例中,发现包使用 zookeeper 将服务存储为临时节点。其他实例将查找节点结构的更改并在其本地系统上注册代理。最终结果是您可以编码为纯 OSGi 并最终实现透明分发。

回答by SquareCog

HBase uses Zookeeper for coordinating activities its "head node" was responsible for prior to the current version. The move to using Zookeeper means the central control is no longer a single point of failure.

HBase 使用 Zookeeper 来协调其“头节点”在当前版本之前负责的活动。转向使用 Zookeeper 意味着中央控制不再是单点故障。

Zookeeper is very versatile; here is an example of using it to build a distributed concurrent queue:

Zookeeper 用途广泛;这是使用它构建分布式并发队列的示例:

http://blog.cloudera.com/blog/2009/05/building-a-distributed-concurrent-queue-with-apache-zookeeper/

http://blog.cloudera.com/blog/2009/05/building-a-distributed-concurrent-queue-with-apache-zookeeper/

You can of course also use it to create resource locks, etc, in a distributed system.

您当然也可以使用它在分布式系统中创建资源锁等。

回答by phunt

Here's some detail on how HBase uses ZooKeeper, including information on how they intend to use it in future. Generally they use it for eliminating SPOF on the region servers via Leader election implemented using ZooKeeper.

这里有一些关于 HBase 如何使用 ZooKeeper 的细节,包括他们打算如何在未来使用它的信息。通常他们通过使用 ZooKeeper 实现的 Leader 选举来消除区域服务器上的 SPOF。

回答by phunt

Solr is also working to integrate ZooKeeper. Here you can see they are using for dynamic config, sharding, SPOF elimination (master/slave election), rebalancing, etc.

Solr 还致力于集成 ZooKeeper。在这里您可以看到它们用于动态配置、分片、SPOF 消除(主/从选举)、重新平衡等。

回答by ndolgov

Norbertis a good example from a scalable production system. I general, it integrates Netty, Protocol Buffers and Zookeeper into a lightweight framework for running clustered services. Protocol Buffers are used to specify your service API, Netty implements transport-layer abstractions and Zookeeper is essentially a fault-tolerant discovery service.

Norbert是可扩展生产系统的一个很好的例子。总的来说,它将 Netty、Protocol Buffers 和 Zookeeper 集成到一个轻量级的框架中,用于运行集群服务。Protocol Buffers 用于指定您的服务 API,Netty 实现传输层抽象,而 Zookeeper 本质上是一个容错发现服务。

Every time a service instance is started Norbert registers it as available instance of a particular service type. From implementation perspective, it creates two Zookeeper trees:

每次启动服务实例时,Norbert 都会将其注册为特定服务类型的可用实例。从实现的角度来看,它创建了两个 Zookeeper 树:

  • "/ServiceName/members" which lists all known instances of the service
  • "/ServiceName/available" which lists currently available instances of the service
  • "/ServiceName/members" 列出服务的所有已知实例
  • “/ServiceName/available”列出了当前可用的服务实例

The most important property for each node is the url to use to connect to the corresponding service instance. It enables client-side load balancing - a Norbert client finds the list of urls for a given service name and attempt to connect to one of them is some order (e.g. round-robin or random).

每个节点最重要的属性是用于连接到相应服务实例的 url。它启用客户端负载平衡 - Norbert 客户端找到给定服务名称的 url 列表,并尝试按照某种顺序(例如循环或随机)连接到其中之一。

回答by manku

Old question, but since this page comes up first on a google search for zookeeper use cases, I figured it would be best to give an updated listing

老问题,但由于这个页面首先出现在谷歌搜索动物园管理员用例中,我认为最好提供更新的列表

  1. wikipedia
  2. zookeeper wiki
  3. real users
  1. 维基百科
  2. 动物园管理员维基
  3. 真实用户

回答by liheyuan

Zookeeper was used for many things other than configuration. Here is a official list of implement distributed primitives using zookeeper.

除了配置之外,Zookeeper 还用于许多其他事情。这是使用 zookeeper 实现分布式原语的官方列表。

https://zookeeper.apache.org/doc/current/recipes.html

https://zookeeper.apache.org/doc/current/recipes.html

回答by John Russell

Neo4j uses Zookeeper their High Availability enterprise server! http://docs.neo4j.org/chunked/milestone/ha.html

Neo4j 使用 Zookeeper 的高可用性企业服务器! http://docs.neo4j.org/chunked/milestone/ha.html

回答by Thomas Bratt

  • Stormis used by a number of companies(Twitter and Groupon being two of the better known) and relies on Zookeeper.
  • Kafkais used by Linkedin and relies on Zookeeper.
  • 许多公司都在使用Storm(Twitter 和 Groupon 是两个比较知名的公司)并依赖于 Zookeeper。
  • Kafka由 Linkedin 使用,并依赖于 Zookeeper。

Stormuses Zookeeper to store all state so that it can recover from an outage in any of its (distributed) component services.

Storm使用 Zookeeper 存储所有状态,以便它可以从其任何(分布式)组件服务的中断中恢复。

This allows the component services to be stateless and simply download or sync with the Zookeeper servers when configuration data is needed. If you have ever had to recover a production server you will know what a headache this can be!

这允许组件服务是无状态的,并且在需要配置数据时只需下载或与 Zookeeper 服务器同步。如果您曾经不得不恢复生产服务器,您就会知道这是多么令人头疼的事情!

Kafkaqueue consumers can use Zookeeper to store information (high water mark) on what has been consumed from the queue.

Kafka队列消费者可以使用 Zookeeper 来存储有关从队列中消费的内容的信息(高水位线)。

回答by mavbozo

datomicuses apache zookeeper to manage riak based data storage.

datomic使用 apache zookeeper 来管理基于riak的数据存储。

Because Riak supports only eventual consistency at this time, a Datomic system running on Riak also utilizes Apache ZooKeeper, a highly-available coordination service. Datomic uses ZooKeeper for transactor failover coordination, and for the handful of keys per database that need to be updated with CAS. source: http://blog.datomic.com/2012/11/riak-and-couchbase-support.html

由于 Riak 目前仅支持最终一致性,因此在 Riak 上运行的 Datomic 系统还使用了 Apache ZooKeeper,这是一种高可用的协调服务。Datomic 使用 ZooKeeper 进行事务器故障转移协调,以及每个数据库需要使用 CAS 更新的少量密钥。来源:http: //blog.datomic.com/2012/11/riak-and-couchbase-support.html