(针对分布式应用的分布式调度服务)
(设计目标)
(数据模型和命名空间层级)
(节点和临时节点)
(条件更新和观察)
(保证)
(简单API)
(实现)
(使用)
(性能)
(可靠性)
(ZooKeeper项目)
ZooKeeper: A Distributed Coordination Service for Distributed ApplicationsZooKeeper is a distributed, open-source coordination service for distributed applications. It exposes a simple set of primitives that distributed applications can build upon to implement higher level services for synchronization, configuration maintenance, and groups and naming. It is designed to be easy to program to, and uses a data model styled after the familiar directory tree structure of file systems. It runs in Java and has bindings for both Java and C.
Coordination services are notoriously hard to get right. They are especially prone to errors such as race conditions and deadlock. The motivation behind ZooKeeper is to relieve distributed applications the responsibility of implementing coordination services from scratch.
Zookeeper是一个为分布式应用提供分布式、开源的调度服务。它暴露一组简单的基本架构,分布式应用可以在其上面来实现高层次服务用于同步、维护配置、分组和命名。它被设计得容易编程,在相似的文件系统树结构目录下使用一个数据模型。它运行在java环境上和绑定Java和C。
调度服务是出了名的难。它们特别容易出错例如竞态条件和死锁。ZooKeeper的动机是减轻分布式应用从零开始实现调度服务的责任。
Design Goals (设计目的)ZooKeeper is simple. ZooKeeper allows distributed processes to coordinate with each other through a shared hierarchal namespace which is organized similarly to a standard file system. The name space consists of data registers - called znodes, in ZooKeeper parlance - and these are similar to files and directories. Unlike a typical file system, which is designed for storage, ZooKeeper data is kept in-memory, which means ZooKeeper can acheive high throughput and low latency numbers.
The ZooKeeper implementation puts a premium on high performance, highly available, strictly ordered access. The performance aspects of ZooKeeper means it can be used in large, distributed systems. The reliability aspects keep it from being a single point of failure. The strict ordering means that sophisticated synchronization primitives can be implemented at the client.
ZooKeeper是简单的。ZooKeeper允许分布式进程通过一个共享的跟标准文件系统相似的架构的层级命名空间来互相调度。命名空间包含称为znodes的数据寄存器(在ZooKeeper的说法中),这些类似于文件和目录。不像传统的文件系统被设计用于存储,ZooKeeper数据是保存在内存中,那就意味着ZooKeeper能够获得高吞吐量和低延迟。
ZooKeeper实现高性能、高可能性和严格的访问命令。性能方面意味着它可以用在大型分布式系统。可靠性方面使它避免了单点故障。严格的访问命令意味着复杂的同步原语可以在客户端实现。
ZooKeeper is replicated. Like the distributed processes it coordinates, ZooKeeper itself is intended to be replicated over a sets of hosts called an ensemble.
ZooKeeper是可复制的。像它所调度的分布式进程,ZooKeeper他本身也是可以被复制来构成一组集合。
The servers that make up the ZooKeeper service must all know about each other. They maintain an in-memory image of state, along with a transaction logs and snapshots in a persistent store. As long as a majority of the servers are available, the ZooKeeper service will be available.
Clients connect to a single ZooKeeper server. The client maintains a TCP connection through which it sends requests, gets responses, gets watch events, and sends heart beats. If the TCP connection to the server breaks, the client will connect to a different server.
构成ZooKeeper服务的所有服务器都必须知道彼此。它们维持着一个状态相关的内存图像,和事务日志和快照保存在一个持久化的仓库。只要大多数服务器是可用的,那么ZooKeeper服务就可用。
客户端与一个单独的服务器建立连接。它们之间通过发送请求、获得回复,获得观察事件和发送心跳来维持一个TCP连接。如果客户端与服务器的TCP连接断开了,那么客户端会去连接另一个服务器。
ZooKeeper is ordered. ZooKeeper stamps each update with a number that reflects the order of all ZooKeeper transactions. Subsequent operations can use the order to implement higher-level abstractions, such as synchronization primitives.