从github中了解到ectd能做什么,以及etcd在分布式系统中的关键作用。
主要参考:
https://github.com/etcd-io/etcd/blob/master/Documentation/learning/why.md
从上面的文章中我总结出的关键内容如下:
zookeeper和etcd的区别,优缺点,为什么?
代码语言:javascript复制ZooKeeper solves the same problem as etcd: distributed system coordination and metadata storage. However, etcd has the luxury of hindsight taken from engineering and operational experience with ZooKeeper’s design and implementation. The lessons learned from Zookeeper certainly informed etcd’s design, helping it support large scale systems like Kubernetes. The improvements etcd made over Zookeeper include:
Dynamic cluster membership reconfiguration
Stable read/write under high load
A multi-version concurrency control data model
Reliable key monitoring which never silently drop events
Lease primitives decoupling connections from sessions
APIs for safe distributed shared locks
Furthermore, etcd supports a wide range of languages and frameworks out of the box. Whereas Zookeeper has its own custom Jute RPC protocol, which is totally unique to Zookeeper and limits its supported language bindings, etcd’s client protocol is built from gRPC, a popular RPC framework with language bindings for go, C , Java, and more. Likewise, gRPC can be serialized into JSON over HTTP, so even general command line utilities like curl can talk to it. Since systems can select from a variety of choices, they are built on etcd with native tooling rather than around etcd with a single fixed set of technologies.
When considering features, support, and stability, new applications planning to use Zookeeper for a consistent key value store would do well to choose etcd instead.
简单的翻译过来就是说:
zookeeper和etc同样是为了解决分布式系统协调和元数据存储问题的。然而,etcd从工程和实现经验上比zookeeper更有前瞻性。etcd从zookeeper中吸取经验,从而支持大规模可扩展的kubernetes。etcd相比zookeeper主要有以下的改善:
- 动态集群成员重配置
- 高负载下的稳定读写能力
- 数据的多版本控制
- 可靠的事件监控,不会悄悄的丢失事件
- 租赁原语将连接与会话分离
- 安全的分布式锁
而且,etcd对外部的语言支持性更好。相反,zookeeper使用的是自定义的Jute RPC协议,这样限制了外部语言的绑定。etcd使用的是gRPC协议,能够支持现有的主流语言,比如:go C java等等。而且,gRPC可以序列化成Json,通过http传输,所以Curl等命令行的命令也可以访问。因为系统的选型是多样的,它们是使用本地工具在etcd上构建的,而不是使用一组固定的技术围绕etcd构建的。
考虑到以上的特性、支持和稳定性,计划使用zookeeper的新应用使用etcd代替zookeeper也是一个明智的选择。
最后总结一下就是说,能够使用zookeer的场景下,使用etcd是可以直接代替的,同时etcd还提供的更稳定的高负载稳定读写能力。
本文来源0day__,由javajgs_com转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处