Service Discovery

最近随着 DC/OS 和 k8s 的流行,很多基础服务都不需要我们开发管理了 (例如服务发现),这样大家可以把更多精力放在业务上。下面我们列举一下常用的服务发现方案

  • k8s 自带的 Kube-DNS

    Kube-DNS 可以用 CoreDNS 替代

  • mesos-DNS

    Service iscovery through DNS, however, has some limitations that include:

    • DNS does not identify service ports, unless you use an SRV query; most apps are not able to use SRV records “out of the box.”
    • DNS does not have fast failover.
    • DNS records have a TTL (time to live) and Mesos-DNS uses polling to create the DNS records; this can result in stale records.
    • DNS records do not provide any service health data.
    • Some applications and libraries do not correctly handle multiple A records; in some cases the query might be cached and not correctly reloaded as required.
  • marathon-lb

    To address mesos-dns's known problem, mesosphere provide a tool for Marathon called Marathon Load Balancer, or marathon-lb. 可以参考 https://mesosphere.com/blog/dcos-marathon-lb/https://mesosphere.com/blog/service-discovery-and-load-balancing-with-dcos-and-marathon-lb-part-2/

  • 基于zk/consul/etcd 开发的服务发现

    这种方式需要开发人员自己实现服务发现的功能,目前大多数公司使用 consul 作为服务发现的比较多,以为它使用简单,功能齐全。

现在开发一套系统不需要自己写服务发现的代码了, 可以直接使用 k8s or mesos/marathon 和 marathon-lb 来实现, 节省了很多时间, 而且这也是主流。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,991评论 19 139
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 2,936评论 0 0
  • 概述 杏仁的容器化平台基于Mesos和Marathon构建,使用Calico提供容器的多主机网络,并通过Consu...
    真徐小白阅读 1,893评论 4 6
  • 喜欢: 1.切西瓜的时候,一刀下去,西瓜皮会轻轻崩开的感觉,很棒,声音也很迷人 2.香烟在嘴里的微微发涩的味道,还...
    Nicole词不达意阅读 292评论 0 0
  • 距离去年5月来创业型公司做一名产品人员,已经有半年有余,借着这两天比较特殊的时间,来整理一下这一年对创业公司产品岗...
    吾本天生少年狂阅读 341评论 0 1