首先就一些常见的服务发现产品进行下对比:
对比项 | [Consul](https://www.consul.io/) [GitHub](https://github.com/hashicorp/consul) | [Zookeeper](https://zookeeper.apache.org/) [GitHub](https://github.com/apache/zookeeper) | [Etcd](https://coreos.com/etcd/) [GitHub](https://github.com/coreos/etcd) | Euerka [GitHub](https://github.com/Netflix/eureka) | [Kubernetes](https://kubernetes.io/) [GitHub](https://github.com/kubernetes/kubernetes) |
---|---|---|---|---|---|
**服务健康检查** | [客户端可绑定 任意多个服务或 节点健康检查 (内存、磁盘)](https://www.consul.io/intro/index.html) | [CS之间长连接 +连接心跳](http://zookeeper.apache.org/doc/current/zookeeperOver.html); [SS之间TCP KeepAlive](http://zookeeper.apache.org/doc/current/zookeeperAdmin.html) | [连接心跳](https://coreos.com/etcd/docs/latest/tuning.html) | [连接心跳注册、 其他可配支持](http://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#_eureka_s_health_checks) | |
**多数据中心** | [内置WAN方案支持](https://www.consul.io/docs/internals/architecture.html) | [中央Zookeeper集群, 通过Observer有限支持](https://zookeeper.apache.org/doc/current/zookeeperObservers.html) | —— | —— | |
**KV存储限制** | 上百MB | 上百MB (有时支持上GB) | 上GB | —— | |
**线性化读取 原子读取** | [是](https://www.consul.io/docs/agent/http.html#consistency) | 否 | [是](https://coreos.com/etcd/docs/latest/learning/api_guarantees.html#linearizability) | —— | |
**事务** | [字段比较、 锁、读、写](https://www.consul.io/api/txn.html) | [版本审查、 写](https://zookeeper.apache.org/doc/current/api/org/apache/zookeeper/ZooKeeper.html#multi-java.lang.Iterable-) | [字段比较、 读、写](https://coreos.com/etcd/docs/latest/learning/api.html#transaction) | —— | |
**多版本并发控制 MVCC** | —— | —— | [支持](https://coreos.com/etcd/docs/latest/learning/data_model.html) | —— | |
**watch支持/ 变化通知** | [针对KV对、键前缀、 服务成员、服务实例、 节点列表、健康检查、 自定义用户事件等](https://www.consul.io/docs/agent/watches.html) | [针对当前KV或目录; 单次](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ch_zkWatches) | [针对过去或当前的键区间](https://coreos.com/etcd/docs/latest/learning/api.html#watch-streams) | [针对app、 vipAddress 或实例](https://github.com/Netflix/eureka/wiki/Eureka-2.0-Client-Configuration-And-Use#using-the-interest-client) | |
**一致性协议** | [Raft](https://www.consul.io/docs/internals/consensus.html) | [Zab(≈Paxos)](https://cwiki.apache.org/confluence/display/ZOOKEEPER/Zab+vs.+Paxos) | [Raft](https://github.com/coreos/etcd) | —— | |
**CAP** | [CP](https://www.consul.io/intro/vs/serf.html) | [CP](https://www.elastic.co/blog/found-zookeeper-king-of-coordination) | CP | [AP](https://github.com/Netflix/eureka/wiki/Eureka-2.0-Architecture-Overview#cap-theorem) | |
**成员动态更新** | [支持](https://www.consul.io/docs/guides/servers.html) | [>3.5.0](https://cwiki.apache.org/confluence/display/ZOOKEEPER/ClusterMembership) | [支持](https://coreos.com/etcd/docs/latest/op-guide/runtime-configuration.html) | [支持](https://github.com/Netflix/eureka/wiki/Eureka-at-a-glance#configurability) | |
**支持接口** | [HTTP](https://www.consul.io/api/index.html)和[DNS](https://www.consul.io/docs/agent/dns.html) | [客户端](https://cwiki.apache.org/confluence/display/ZOOKEEPER/ZKClientBindings) | [HTTP](https://coreos.com/etcd/docs/latest/dev-guide/api_grpc_gateway.html)和gRPC | [HTTP](https://github.com/Netflix/eureka/wiki/Eureka-REST-operations) ([Sidecar](https://cloud.spring.io/spring-cloud-netflix/multi/multi__polyglot_support_with_sidecar.html)) | |
**性能指标监控** | [Metrics](https://www.consul.io/docs/agent/telemetry.html) | —— (可通过[命令行](http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_zkCommands) 或[JMX](http://zookeeper.apache.org/doc/current/zookeeperJMX.html)监控, 但没有Metrics) | [Metrics](https://coreos.com/etcd/docs/latest/metrics.html) | [Metrics](https://github.com/Netflix/eureka/blob/master/eureka-core/src/main/java/com/netflix/eureka/util/EurekaMonitors.java) | |
**用户权限** | [ACLs](https://www.consul.io/docs/guides/acl.html) | [ACLs](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl) | [基于Role](https://coreos.com/etcd/docs/latest/op-guide/authentication.html) | —— | |
**安全** | [TLS](https://www.consul.io/docs/agent/encryption.html) / [HTTPS](https://www.consul.io/docs/agent/encryption.html) | [SSL](https://cwiki.apache.org/confluence/display/ZOOKEEPER/ZooKeeper+SSL+User+Guide) | [TLS](https://coreos.com/etcd/docs/latest/op-guide/security.html) / [HTTPS](https://coreos.com/etcd/docs/latest/etcd-live-http-to-https-migration.html) | [HTTPS](http://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/2.0.0.RC2/single/spring-cloud-netflix.html#_registering_a_secure_application) | |
**Web管理界面** | [支持](https://www.consul.io/intro/getting-started/ui.html) | 支持 | —— (有第三方支持, 例如soyking/e3w) | [支持](https://github.com/Netflix/eureka-ui) | |
**Spring Cloud集成** | [Spring Cloud Consul](https://cloud.spring.io/spring-cloud-consul/) | [Spring Cloud Zookeeper](https://cloud.spring.io/spring-cloud-zookeeper/) | [Spring Cloud Etcd](https://github.com/spring-cloud-incubator/spring-cloud-etcd) (孵化状态) | [Spring Cloud Netflix](https://cloud.spring.io/spring-cloud-netflix/) | [Spring Cloud Kubernetes](https://github.com/spring-cloud-incubator/spring-cloud-kubernetes) (孵化状态) |
**实现语言** | [Go](https://github.com/hashicorp/consul) | [Java](https://github.com/apache/zookeeper) | [Go](https://github.com/coreos/etcd) | [Java](https://github.com/Netflix/eureka) | [Go](https://github.com/kubernetes/kubernetes) |
**用户** | 未提及 | [用户列表](https://cwiki.apache.org/confluence/display/ZOOKEEPER/PoweredBy) | [用户列表](https://github.com/coreos/etcd/blob/master/Documentation/production-users.md) | 除了Netflix自用 未提及其他用户 | [合作方列表](https://kubernetes.io/partners/) |
此外,Airbnb开源了由Ruby语言实现的自动服务发现和注册框架SmartStack,它由nerve、 synapse、Zookeeper和HAProxy组成。ZooKeeper负责维护集群状态;nerve负责针对服务进行健康检查及向Zookeeper注册;synapse负责为服务提供者查询Zookeeper并动态配置HAProxy。客户端与HAProxy交互,HAProxy负责健康检查及在针对服务提供者进行负载均衡。 注:对Kubernetes的对比在后继学习之后再补上。
参考
Consul vs. ZooKeeper, doozerd, etcd
Consul vs. SmartStack
Consul vs. Eureka
etcd versus other key-value stores
服务发现比较:Consul vs Zookeeper vs Etcd vs Eureka
SmartStack: Airbnb的自动服务发现和注册框架
课程:使用Kubernetes进行可扩展微服务
Consul实践指导-DNS接口
Please stop calling databases CP or AP