
{"code":1,"message":"","data":{"id":53995,"article":{"id":12119,"publicAccount":{"id":336,"name":"Docker","weixin":"dockerone","intro":"最专业的Docker文章,最权威的Docker新闻.关注容器生态圈的发展.","body":"最专业的Docker文章,最权威的Docker新闻。关注容器生态圈的发展。","image":"http://ss.csdn.net/p?http://wx.qlogo.cn/mmhead/Q3auHgzwzM63ejuAalev6jafwfCbiariczJFmkk9gxEt68uXniaTe1TvA/0","href":null,"biz":"MzA5OTAyNzQ2OA==","category":{"id":4,"keyName":"cc","displayName":"云计算","createdAt":1484123010000,"updatedAt":1487578358000,"status":1},"createdAt":1488453311000,"updatedAt":1496223274000,"status":1,"recommend":0,"qrcode":"http://mp.weixin.qq.com/mp/qrcode?scene=10000001&size=120&__biz=MzA5OTAyNzQ2OA==&mid=2649693456&idx=1&sn=b36ed8057c23113da2396b77208689f1","articleCount":0,"viewCount":0},"category":{"id":4,"keyName":"cc","displayName":"云计算","createdAt":1484123010000,"updatedAt":1487578358000,"status":1},"biz":"MzA5OTAyNzQ2OA==","mid":"2649690569","idx":1,"sn":null,"author":"高洪涛 译","content":"","contentUrl":"http://mp.weixin.qq.com/s?__biz=MzA5OTAyNzQ2OA==&mid=2649690569&idx=1&sn=7e806888a44ffedd45af3a1126df9886&scene=27#wechat_redirect","cover":"http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNnv4wW6icpvGHHhAn2ztNVqAlJmIUj7rFCur9weliaVC7rpYe04ibicVsrCYmsR7oibO1Dw9cC9q8UEJQQ/0?wx_fmt=png","digest":"etcd 3正式发布。","isMulti":0,"sourceUrl":"http://www.cnutcon.com/","title":"新一代etcd:etcd3","description":"etcd 3正式发布。","datetime":1467420404000,"status":1,"viewCount":42,"praiseCount":0,"commentCount":0,"createdAt":1488453405000,"updatedAt":1488453405000,"origin":"proxy","recommend":0},"url":"http://mp.weixin.qq.com/s?__biz=MzA5OTAyNzQ2OA==&mid=2649690569&idx=1&sn=7e806888a44ffedd45af3a1126df9886&scene=27#wechat_redirect","title":"新一代etcd:etcd3","source":"<div id=\"js_article\" class=\"rich_media\"> \n <div class=\"rich_media_inner\"> \n <div id=\"page-content\"> \n <div id=\"img-content\" class=\"rich_media_area_primary\"> \n <div class=\"rich_media_content \" id=\"js_content\"> \n <p style=\"text-align: center;\"><img data-s=\"300,640\" data-type=\"jpeg\" data-src=\"http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNnv4wW6icpvGHHhAn2ztNVqAa25x9vsWic0sibIibqz9Ur5sxGuMzv5q8Ej1RCTYD6PvDUkiajicC7Pg2iaA/0?wx_fmt=jpeg\" data-ratio=\"0.3669064748201439\" data-w=\"\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNnv4wW6icpvGHHhAn2ztNVqAa25x9vsWic0sibIibqz9Ur5sxGuMzv5q8Ej1RCTYD6PvDUkiajicC7Pg2iaA/640?wx_fmt=jpeg\"><br></p> \n <p style=\"margin-right: 5px; margin-bottom: 32px; margin-left: 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">本文作者之一:李响,CoreOS工程师。负责CoreOS分布式系统相关项目开发,对分布式一致协议、存储、调度等有很多研究。他是分布式一致性存储系统etcd的作者和开发者。他对容器生态系统也有较多的贡献,目前主要关注提升Kubeternetes的集群规模和调度系统。另外,他也是开源倡导者和go语言的推广者。以下内容为译文。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">在过去的几个月中,CoreOS致力于完善etcd3 API的beta版,经过对系统的严格测试并且在一些用户的共同协作下,etcd得到了长足的进步。今天etcd v3.0.0(https://github.com/coreos/etcd/releases/tag/v3.0.0),这个由CoreOS开发的分布式键值对存储引擎,正式发布了。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">在工程实践中,etcd3已经被集成到大型分布式系统Kubernetes之中。并且我们已经实现了分布式协作原语,包括:分布式锁、选举和软件事务内存(software transactional memory),以保证etcd3的API对广大的应用是足够灵活的。现在我们可以很骄傲地宣布etcd3已经准备好推广给大众了。</p> \n <section style=\"margin: 30px 15px 30px 5px; max-width: 100%; color: rgb(51, 51, 51); line-height: 25.6px; text-align: justify; white-space: normal; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <section style=\"margin-top: 4px; margin-right: 15px; margin-bottom: 10px; max-width: 100%; float: left; width: 20px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <img width=\"20px\" height=\"20\" class=\"\" data-type=\"png\" data-ratio=\"1\" data-w=\"20\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-left: 30px; max-width: 100%; line-height: 1.5; color: rgb(102, 102, 102); font-size: 14px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <section style=\"margin: 32px 5px; max-width: 100%; color: inherit; font-size: inherit; line-height: 28px; box-sizing: border-box !important; word-wrap: break-word !important;\">\n “etcd的3.0版本在效率、可靠性和可扩展性等方面都获得长足的进步。它将帮助Kubernetes管理超过数万台机器,甚至更多”,Google产品经理,David Aronchick这样说:“Google容器引擎(GKE)团队非常感谢CoreOS团队能对Kubernetes项目作出持续的贡献。对于云原生社区来说,这使Kubernetes成为一个产品级的容器管理系统。” \n </section> \n </section> \n </section> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">etcd 3.0是etcd3 API和其数据模型的第一个稳定版本。升级是非常容易的,因为etcd2的JSON外部协议和集群内部协议在etcd3中同样支持。但是,etcd3是通过搜集了etcd2用户的反馈和实际扩展etcd2的经验基础上全新设计了API的产品。这篇文章将会点明etcd3在效率,可靠性和并发控制上改进的闪光点。</p> \n <section style=\"margin: 30px 15px 30px 5px; max-width: 100%; color: rgb(51, 51, 51); line-height: 25.6px; text-align: justify; white-space: normal; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <section style=\"margin-top: 4px; margin-right: 15px; margin-bottom: 10px; max-width: 100%; float: left; width: 20px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <img width=\"20px\" height=\"20\" class=\"\" data-type=\"png\" data-ratio=\"1\" data-w=\"20\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-left: 30px; max-width: 100%; line-height: 1.5; color: rgb(102, 102, 102); font-size: 14px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <section style=\"margin: 32px 5px; max-width: 100%; color: inherit; font-size: inherit; line-height: 28px; box-sizing: border-box !important; word-wrap: break-word !important;\">\n “见证了etcd在技术和社区的持续进步并成长为Kubernetes项目的一部分是非常让人激动的。etcd3的正式发布将会使这样的势头得以持续,我们期待将来有更多的功能和特性被引入到Red Hat OpenShift容器应用平台产品中,”Red Hat首席软件工程师Timothy St. Clair如是说。 \n </section> \n </section> \n </section> \n <p><br></p> \n <section style=\"margin-top: -2px; max-width: 100%; line-height: 25.6px; white-space: normal; color: rgb(51, 51, 51); width: 670px; overflow: hidden; text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <img class=\"\" data-type=\"png\" data-ratio=\"0.046762589928057555\" data-w=\"\" width=\"670px\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-top: 15px; margin-bottom: 30px; max-width: 100%; white-space: normal; line-height: 12px; font-size: 12px; color: rgb(128, 128, 128); text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"></section> \n <section style=\"margin: 30px 5px 20px; max-width: 100%; white-space: normal; color: rgb(51, 51, 51); text-align: justify; font-weight: 700; font-size: 20px; line-height: 1.5; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\">\n 从etcd2到etcd3 \n </section> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">etcd最早是被设计用来解决CoreOS升级时机器的协调问题的。<strong>现在它被用于分布式网络、服务发现、配置管理、任务调度和负载均衡等服务中。</strong>原始设计的部分内容被证明是成功的:etcd已经成长为键值对存储引擎,包括JSON外部协议,持续键值更新观察者和有生存时间的键等特性。不幸的是,其他的一些功能被频繁吐槽,包括客户端空闲时会把仲裁的压力释放到集群中,对于老的键存在不可预测的垃圾回收。虽然etcd2可以满足协调机器的任务,但当今微服务的趋势使得etcd需要具备数以万计的客户端去操作数百万键的能力。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">etcd3吸取了etcd2的教训。基础服务接口使用gRPC(http://www.grpc.io/)代替了JSON以增加效率。JSON外部协议可以通过gRPC gateway(http://dwz.cn/3GW9fY)得到支持。有生命周期的键的实现被替换为轻型流式租约存活(streaming lease keepalive)模型。观察者也被重新设计,使用流式多路复用事件替代老式的事件模型。v3的数据模型去除了显示键继承和不稳定的观察窗口,取而代之的是扁平二进制键空间,并使用多版本并发控制的事务语义。</p> \n <section style=\"margin: 30px 15px 30px 5px; max-width: 100%; color: rgb(51, 51, 51); line-height: 25.6px; text-align: justify; white-space: normal; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <section style=\"margin-top: 4px; margin-right: 15px; margin-bottom: 10px; max-width: 100%; float: left; width: 20px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <img width=\"20px\" height=\"20\" class=\"\" data-type=\"png\" data-ratio=\"1\" data-w=\"20\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-left: 30px; max-width: 100%; line-height: 1.5; color: rgb(102, 102, 102); font-size: 14px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <section style=\"margin: 32px 5px; max-width: 100%; color: inherit; font-size: inherit; line-height: 28px; box-sizing: border-box !important; word-wrap: break-word !important;\">\n “etcd在我们的Elastic Services Infrastructure(ESI)中作为生产级中心配置管理存储器而使用,”NTT创新研究院的首席架构师Ichiro Fukuda这样介绍道:“我们对etcd v3的发布是非常兴奋的,并希望通过扩大使用它来增强我们的服务。 \n </section> \n </section> \n </section> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">我们邀请您加入我们一起庆祝etcd在性能和扩展性的长足进步使etcd的生产级v3版本成为云原生,分布式系统的基石。像华为、NTT和PingCAP这样的公司在它们的产品和项目中是非常依赖这个快速的键值对存储引擎的。</p> \n <section style=\"margin: 30px 15px 30px 5px; max-width: 100%; color: rgb(51, 51, 51); line-height: 25.6px; text-align: justify; white-space: normal; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <section style=\"margin-top: 4px; margin-right: 15px; margin-bottom: 10px; max-width: 100%; float: left; width: 20px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <img width=\"20px\" height=\"20\" class=\"\" data-type=\"png\" data-ratio=\"1\" data-w=\"20\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-left: 30px; max-width: 100%; line-height: 1.5; color: rgb(102, 102, 102); font-size: 14px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <section style=\"margin: 32px 5px; max-width: 100%; color: inherit; font-size: inherit; line-height: 28px; box-sizing: border-box !important; word-wrap: break-word !important;\">\n “祝贺CoreOS发布了etcd的v3.0版本。etcd在华为PaaS平台被作为关键组件应用在分布式数据协调和数据改变观察等架构中。随着etcd的3.0版本的发布,我们希望它能帮助我们的平台在扩展性,性能和稳定性这些方面得到显著的提升。我们很高兴过去能与CoreOS团队和技术社区一起工作,并希望持续与CoreOS协作将这项技术和其子系统推到一个更高的层面”——华为PaaS平台首席架构师Ying Xiong这样说。 \n </section> \n </section> \n </section> \n <p><br></p> \n <section style=\"margin-top: -2px; max-width: 100%; line-height: 25.6px; white-space: normal; color: rgb(51, 51, 51); width: 670px; overflow: hidden; text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <img class=\"\" data-type=\"png\" data-ratio=\"0.046762589928057555\" data-w=\"\" width=\"670px\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-top: 15px; margin-bottom: 30px; max-width: 100%; white-space: normal; line-height: 12px; font-size: 12px; color: rgb(128, 128, 128); text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"></section> \n <section style=\"margin: 30px 5px 20px; max-width: 100%; white-space: normal; color: rgb(51, 51, 51); text-align: justify; font-weight: 700; font-size: 20px; line-height: 1.5; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\">\n 效率与支持大规模使用 \n </section> \n <h3 style=\"margin: 30px 5px 20px; font-weight: 700; font-size: 20px; line-height: 1.5; white-space: normal;\"><span style=\"font-size: 16px;\">远程调用</span></h3> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">原生的etcd3客户端使用gRPC协议进行通信。<strong>协议消息使用protobuf进行定义,它简化了PRC客户端存根代码的生成并且使协议易于管理。</strong>比较来看,即使etcd2客户端经过解析优化后与etcd3的消息处理性能仍然有2倍的差距。并且,gRPC在处理链接方面优势明显,因为gRPC使用单一链接的HTTP2多路复用流式RPC调用,而JSON客户端必须为每个请求建立一个链接。</p> \n <h3 style=\"margin: 30px 5px 20px; font-weight: 700; font-size: 20px; line-height: 1.5; white-space: normal;\"><span style=\"font-size: 16px;\">租约</span></h3> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">etcd2的键失效是通过存活时间(TTL)机制实现的。对于每个有存活时间的键,客户端必须周期性的刷新该键以保证到期时它不会被自动删除掉。每个刷新行为都会建立一个新连接并提交一个一致性仲裁给etcd去更新键。为了保证所有的TTL键存活,一个空闲的集群必须支持保持一个最低限度的TTL的键除以平均过期时间的吞吐量。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">etcd3中的租约替代了早期TTL的实现。<strong>租约减少了保持活动的请求并限制了平稳状态一致性更新。</strong>与一个键一个TTL不同,一个租约包含一个TTL,租约被分配给一个键。当租约生命到期了,它所关联的所有键全被删除。这个模型在很多键有相同的租约时减少了保持活性的通信量。保持活性的链接也不会像在etcd2中那样被回收,而是使用多路复用的gPRC流的方式来保持活性。同样的,保持活性现在由领导者来处理,避免了在空闲集群提交一致性协议占用资源过多的情况。</p> \n <h3 style=\"margin: 30px 5px 20px; font-weight: 700; font-size: 20px; line-height: 1.5; white-space: normal;\"><span style=\"font-size: 16px;\">观察者</span></h3> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">观察者在etcd中持续观测键值的变化。<strong>与ZooKeeper或Consul等返回观察事件不同,etcd可以持续观察从当前版本开始的变化。</strong>在etcd2中,这些流式的观察室通过long polling模式的HTTP请求实现的,它使etcd2的服务器极其浪费的为每个观察者建立一个TCP链接。当应用有数千个客户端观察数千个键时,这种机制会很快耗尽etcd2服务器的套接字和内存资源。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">etcd3的多路复用观察者使用一个链接。与每次都打开一个新连接不同,客户端会在一个双向gRPC流中注册一个观察者。流会发送一个带有观察者注册ID的事件。多个观察流甚至可以共享相同的TCP链接。多路复用和流式链接共享减少了至少一个数量级的etcd3的内存占用。</p> \n <p><br></p> \n <section style=\"margin-top: -2px; max-width: 100%; line-height: 25.6px; white-space: normal; color: rgb(51, 51, 51); width: 670px; overflow: hidden; text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <img class=\"\" data-type=\"png\" data-ratio=\"0.046762589928057555\" data-w=\"\" width=\"670px\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-top: 15px; margin-bottom: 30px; max-width: 100%; white-space: normal; line-height: 12px; font-size: 12px; color: rgb(128, 128, 128); text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"></section> \n <section style=\"margin: 30px 5px 20px; max-width: 100%; white-space: normal; color: rgb(51, 51, 51); text-align: justify; font-weight: 700; font-size: 20px; line-height: 1.5; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\">\n 可靠事件的数据模型 \n </section> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">跟所有键值对存储引擎相同,etcd的数据模型是键映射到值上。etcd2的模型仅仅保持最近的键值映射是可用的;老版本是被废掉的。但是,跟踪所有键变化或者扫描整个键空间的应用需要一个可靠的事件流去持续重构过去的键状态。<strong>为了避免过早的删除事件以保证这些应用在短暂掉线后仍能正常工作,etcd2维护一个短小的全局滑动事件窗口。</strong>但是,如果一个观察者从一个窗口划过的修订开始观察,那么观察者将错过废弃的事件。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">etcd3去掉了这个不可预计的窗口,取而代之的是通过新的多版本并发控制模型去维护键的历史版本。历史版本保留策略可以为了细粒度存储管理的需要由集群管理员进行配置。<strong>通常etcd3通过一个定时器作废老版本的键更改。</strong>一个典型的etcd3集群会保存几个小时的作废键。为了稳定处理客户端过长时间离线,不仅仅是透明的网络中断,观察者可以从最后一次观察的历史修订中恢复过来。为了从存储中读取特定时间的数据,键读取请求需要使用一个修订版来标记,这样就会返回键在这个特定版本的值。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">另外为了保存历史数据,etcd3用扁平二进制键空间替代了etcd2的继承键结构。事件上,应用更倾向于获取单独的键或者迭代获取一个目录下所有的键。使用继承模式的场景并不常见。etcd3额外提供了在一个区间中键按范围搜索的功能。这个区间模型支持前缀匹配查询和一个键命名习惯模式,这种模式像从一个目录里来列出键一样。</p> \n <p><br></p> \n <section style=\"margin-top: -2px; max-width: 100%; line-height: 25.6px; white-space: normal; color: rgb(51, 51, 51); width: 670px; overflow: hidden; text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <img class=\"\" data-type=\"png\" data-ratio=\"0.046762589928057555\" data-w=\"\" width=\"670px\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-top: 15px; margin-bottom: 30px; max-width: 100%; white-space: normal; line-height: 12px; font-size: 12px; color: rgb(128, 128, 128); text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"></section> \n <section style=\"margin: 30px 5px 20px; max-width: 100%; white-space: normal; color: rgb(51, 51, 51); text-align: justify; font-weight: 700; font-size: 20px; line-height: 1.5; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\">\n 并发控制 \n </section> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">当多个客户端并发读取或修改一个或一组键时,为了阻止损害应用状态的数据竞争,同步原子操作变得格外重要。为了这个目的,etcd2提供了load-link/store-conditional和compare-and-swap操作;一个客户端确定一个先前的版本索引或者值去做匹配,看是否可以更新键。虽然对于简单的信号量和有限的原子更新这些操作是足够的,但是对于一个像分布式锁和事务级内存这种更加要求成熟度的序列化数据访问方案来说,这就明显不适合了。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\"><strong>etcd3可以序列化多个操作为一个条件性的迷你事务。</strong>每个事务包含一组条件守护的组合(例如,对于键版本,键值,已经修改的版本和创建版本的检查),当所有提交满足时一组操作被执行(例如,Get、Put、Delete操作),并且任何条件不满足时另外一组操作被执行。事务可以保证分布式锁的安全。在etcd3中,因为访问是否被条件性取决于是否客户端持有它的锁。这意味着如果一个客户端因为时钟倾斜或者错过失效事件而失去它获得的锁,那么etcd3会毫不留情的拒绝客户端失效的请求。</p> \n <p><br></p> \n <section style=\"margin-top: -2px; max-width: 100%; line-height: 25.6px; white-space: normal; color: rgb(51, 51, 51); width: 670px; overflow: hidden; text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <img class=\"\" data-type=\"png\" data-ratio=\"0.046762589928057555\" data-w=\"\" width=\"670px\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDsBZJmPGhibNvDxPWibRB3shyzUeRCFXHQ8wYznFhPGiaEKAqBNOl7PGKw9e9ZFWvlckteVAaOWqNKQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-top: 15px; margin-bottom: 30px; max-width: 100%; white-space: normal; line-height: 12px; font-size: 12px; color: rgb(128, 128, 128); text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"></section> \n <section style=\"margin: 30px 5px 20px; max-width: 100%; white-space: normal; color: rgb(51, 51, 51); text-align: justify; font-weight: 700; font-size: 20px; line-height: 1.5; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\">\n 展望未来 \n </section> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">etcd3相对于etcd模型有了质的飞跃。新的etcd3的API是更加有效率和可扩展的。它不仅满足了当今使用etcd的应用的需求,同时满足未来的超大规模的集群。</p> \n <section style=\"margin: 30px 15px 30px 5px; max-width: 100%; color: rgb(51, 51, 51); line-height: 25.6px; text-align: justify; white-space: normal; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"> \n <section style=\"margin-top: 4px; margin-right: 15px; margin-bottom: 10px; max-width: 100%; float: left; width: 20px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <img width=\"20px\" height=\"20\" class=\"\" data-type=\"png\" data-ratio=\"1\" data-w=\"20\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVDDlkJ7Tnicuzsia7tXwcGiaLzk1jGzl76hrHqiayocncfR5bfutriazrtQ1pb8gel4fgsPGRsN6TAMbnQ/640?wx_fmt=png\"> \n </section> \n <section style=\"margin-left: 30px; max-width: 100%; line-height: 1.5; color: rgb(102, 102, 102); font-size: 14px; box-sizing: border-box !important; word-wrap: break-word !important;\"> \n <section style=\"margin: 32px 5px; max-width: 100%; color: inherit; font-size: inherit; line-height: 28px; box-sizing: border-box !important; word-wrap: break-word !important;\">\n “我们在我们的大规模分布式存储产品——TiKV中广泛使用etcd。我们将etcd的raft库嵌入到我们存储层去支持一致性复制,并且我们在TiKV集群中使用etcd去协调存储节点,”PingCAP的CEO刘琦介绍说。“我们非常高兴与etcd团队合作,并乐于见到他们新版本的发布!” \n </section> \n </section> \n </section> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">有了etcd3,通过多版本历史键数据技术,数据传播会更加可靠。同时etcd3的事务原语使原子性更新多个键变得容易,同步多个进程变的安全。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">etcd目前还在活跃开发中去继续在集群同步软件中成为最好的。项目遵循稳定发布模式,这样可以快速开发新功能而不用担心牺牲稳定性。未来,etcd项目计划增加支持更好扩容性的智能代理,自定义etcd个性化协议网关,和更多的测试,更好的保证整个系统。</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">想提问题,建议或者咨询相关内容?赶快告诉我们:https://github.com/coreos/etcd/issues!</p> \n <p style=\"margin: 32px 5px; color: rgb(62, 62, 62); line-height: 28px; white-space: normal;\">想要马上体验基于etcd、Kubernetes和CoreOS其他分布式计算的强大威力吗?现在就加入Tectonic Starter(https://tectonic.com/starter/)计划来体验。</p> \n <p style=\"margin: 32px 5px; max-width: 100%; min-height: 1em; white-space: normal; color: rgb(62, 62, 62); line-height: 28px; text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"><img data-s=\"300,640\" data-type=\"jpeg\" data-ratio=\"0.2875457875457875\" data-w=\"546\" data-src=\"http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNlHibd20E7VBdu9u613ftfWVdp60HvuPGhjZkibGcXyrf1PIkvrOlGxuekhMfX3MoGiao6fEficmHSxcw/640?wx_fmt=jpeg\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNlHibd20E7VBdu9u613ftfWVdp60HvuPGhjZkibGcXyrf1PIkvrOlGxuekhMfX3MoGiao6fEficmHSxcw/640?wx_fmt=jpeg\"></p> \n <p style=\"margin: 32px 5px; max-width: 100%; min-height: 1em; white-space: normal; color: rgb(62, 62, 62); line-height: 28px; text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"><a href=\"http://mp.weixin.qq.com/s?__biz=MzA5OTAyNzQ2OA==&mid=208173179&idx=1&sn=392c17b136c2bf570429785702d98353&scene=21#wechat_redirect\" target=\"_blank\" data_ue_src=\"http://mp.weixin.qq.com/s?__biz=MzA5OTAyNzQ2OA==&mid=208173179&idx=1&sn=392c17b136c2bf570429785702d98353&scene=21#wechat_redirect\"><img data-s=\"300,640\" data-type=\"jpeg\" data-src=\"http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNnv4wW6icpvGHHhAn2ztNVqA0GXtUAGBMaibSGVzK7UxcibdZTRP4PQnfCkrqBn3z2ggJWAJPHnbj94g/0?wx_fmt=jpeg\" data-ratio=\"0.3882783882783883\" data-w=\"546\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNnv4wW6icpvGHHhAn2ztNVqA0GXtUAGBMaibSGVzK7UxcibdZTRP4PQnfCkrqBn3z2ggJWAJPHnbj94g/640?wx_fmt=jpeg\"></a><br><a href=\"http://mp.weixin.qq.com/s?__biz=MzA5OTAyNzQ2OA==&mid=206455244&idx=1&sn=8c4ea5ad4d817f9bb25ae9bae254be00&scene=21#wechat_redirect\" target=\"_blank\" data_ue_src=\"http://mp.weixin.qq.com/s?__biz=MzA5OTAyNzQ2OA==&mid=206455244&idx=1&sn=8c4ea5ad4d817f9bb25ae9bae254be00&scene=21#wechat_redirect\"><img data-s=\"300,640\" data-type=\"jpeg\" data-src=\"http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNnv4wW6icpvGHHhAn2ztNVqAFXvzWTebDicIoxIyj9ibIcEISHLNoZcuU2AmHDS8dyBWdSsbCJQEiaEwA/0?wx_fmt=jpeg\" data-ratio=\"0.3882783882783883\" data-w=\"546\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNnv4wW6icpvGHHhAn2ztNVqAFXvzWTebDicIoxIyj9ibIcEISHLNoZcuU2AmHDS8dyBWdSsbCJQEiaEwA/640?wx_fmt=jpeg\"></a><br></p> \n <p style=\"max-width: 100%; min-height: 1em; color: rgb(62, 62, 62); line-height: 25.6px; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"><img class=\"\" data-type=\"png\" data-ratio=\"0.046762589928057555\" data-w=\"\" width=\"auto\" data-src=\"http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVCOWf5S13mT2bLSnXyxXBNHkEKOMBDJqUHfZod9ot6EBhrJ04T4HaWwy0BcMcN9vDpYRkrXibpb5lw/640?wx_fmt=png\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/dyDu14T9ZVCOWf5S13mT2bLSnXyxXBNHkEKOMBDJqUHfZod9ot6EBhrJ04T4HaWwy0BcMcN9vDpYRkrXibpb5lw/640?wx_fmt=png\"></p> \n <p><br></p> \n <section style=\"margin: 30px 5px 20px; max-width: 100%; white-space: normal; color: rgb(51, 51, 51); text-align: justify; font-weight: 700; font-size: 20px; line-height: 1.5; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\">\n 活动推荐 \n </section> \n <p style=\"margin: 32px 5px; max-width: 100%; min-height: 1em; white-space: normal; color: rgb(62, 62, 62); font-size: 17px; line-height: 1.6em; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\">【CNUTCon全球容器技术大会】微服务、持续集成、容器云、大数据、电商、传统行业、创业公司等12个专题,Docker、Kubernetes、Netflix、Mesos、CoreOS、阿里巴巴、京东等公司的核心技术负责人现场独家揭秘,容器化和微服务化,从这里开始,8折报名中,详情请点击阅读原文链接。</p> \n <p style=\"margin: 32px 5px; max-width: 100%; min-height: 1em; white-space: normal; color: rgb(62, 62, 62); font-size: 17px; line-height: 1.6em; text-align: center; box-sizing: border-box !important; word-wrap: break-word !important; background-color: rgb(255, 255, 255);\"><img data-s=\"300,640\" data-type=\"jpeg\" data-ratio=\"0.5567765567765568\" data-w=\"546\" data-src=\"http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNlHibd20E7VBdu9u613ftfWVs1FjNm9nyDWiaGiafDiaxLyoqWoUpeNneLECSw1s2RLls33iaNVibmUbBvg/640?wx_fmt=jpeg\" style=\"width: auto; height: auto;\" src=\"http://ss.csdn.net/p?http://mmbiz.qpic.cn/mmbiz/A1HKVXsfHNlHibd20E7VBdu9u613ftfWVs1FjNm9nyDWiaGiafDiaxLyoqWoUpeNneLECSw1s2RLls33iaNVibmUbBvg/640?wx_fmt=jpeg\"></p> \n </div> \n <div class=\"ct_mpda_wrp\" id=\"js_sponsor_ad_area\" style=\"display:none;\"> \n </div> \n <div class=\"reward_area tc\" id=\"js_reward_area\" style=\"display:none;\"> \n <p> <a class=\"reward_access\" id=\"js_reward_link\" href=\"##\">赞赏</a> </p> \n <div id=\"js_reward_inner\" class=\"reward_area_inner\" style=\"display:none;\"> \n <p class=\"tips_global reward_user_tips\"><a href=\"##\" id=\"js_reward_total\"></a>人赞赏</p> \n <div id=\"js_reward_list\" class=\"reward_user_list\"></div> \n </div> \n </div> \n </div> \n </div> \n </div> \n</div> \n<!--tailTrap<body></body><head></head><html></html>-->","level":3,"createdAt":1488453405000,"updatedAt":1488453405000}}
公众号