| <!doctype html> |
| <!-- |
| Minimal Mistakes Jekyll Theme 4.4.1 by Michael Rose |
| Copyright 2017 Michael Rose - mademistakes.com | @mmistakes |
| Free for personal and commercial use under the MIT license |
| https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE.txt |
| --> |
| <html lang="cn" class="no-js"> |
| <head> |
| <meta charset="utf-8"> |
| |
| <!-- begin SEO --> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <title>ServiceComb中的数据最终一致性方案 - part 1 - Apache ServiceComb</title> |
| |
| |
| |
| |
| <meta name="description" content="在微服务场景下的数据一致性问题背景"> |
| |
| |
| |
| |
| <meta name="author" content="Sean Yin"> |
| |
| <meta property="og:locale" content="cn"> |
| <meta property="og:site_name" content="Apache ServiceComb"> |
| <meta property="og:title" content="ServiceComb中的数据最终一致性方案 - part 1"> |
| |
| |
| <link rel="canonical" href="https://github.com/pages/apache/incubator-servicecomb-website/cn/docs/distributed_saga_1/"> |
| <meta property="og:url" content="https://github.com/pages/apache/incubator-servicecomb-website/cn/docs/distributed_saga_1/"> |
| |
| |
| |
| <meta property="og:description" content="在微服务场景下的数据一致性问题背景"> |
| |
| |
| |
| <meta name="twitter:site" content="@ServiceComb"> |
| <meta name="twitter:title" content="ServiceComb中的数据最终一致性方案 - part 1"> |
| <meta name="twitter:description" content="在微服务场景下的数据一致性问题背景"> |
| <meta name="twitter:url" content=""> |
| |
| |
| <meta name="twitter:card" content="summary"> |
| |
| |
| |
| |
| <meta name="twitter:creator" content="@seanyinx"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <meta property="og:type" content="article"> |
| <meta property="article:published_time" content="2017-09-13T00:00:00+08:00"> |
| |
| |
| |
| |
| |
| |
| |
| |
| <script type="application/ld+json"> |
| { |
| "@context" : "http://schema.org", |
| "@type" : "Person", |
| "name" : "Apache ServiceComb", |
| "url" : "https://github.com/pages/apache/incubator-servicecomb-website", |
| "sameAs" : null |
| } |
| </script> |
| |
| |
| |
| <meta name="google-site-verification" content="HvJjNd7vvJ-yjSTHlBiIWEYxp_Hrz-PYEY5Idz9LRcA" /> |
| |
| |
| |
| |
| <!-- end SEO --> |
| |
| |
| <link href="/feed.xml" type="application/atom+xml" rel="alternate" title="Apache ServiceComb Feed"> |
| |
| <!-- http://t.co/dKP3o1e --> |
| <meta name="HandheldFriendly" content="True"> |
| <meta name="MobileOptimized" content="320"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <script> |
| document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js '; |
| </script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js"></script> |
| <script src="/assets/vendor/prism/prism.js"></script> |
| |
| <script type="text/javascript" async |
| src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML"> |
| </script> |
| |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> |
| |
| <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script> |
| <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script> |
| <!-- For all browsers --> |
| <link rel="stylesheet" href="/assets/css/main.css?v=1"> |
| <link rel="stylesheet" href="/assets/vendor/prism/prism.css?v=1"> |
| |
| <!--[if lte IE 9]> |
| <style> |
| /* old IE unsupported flexbox fixes */ |
| .greedy-nav .site-title { |
| padding-right: 3em; |
| } |
| .greedy-nav button { |
| position: absolute; |
| top: 0; |
| right: 0; |
| height: 100%; |
| } |
| </style> |
| <![endif]--> |
| |
| <meta http-equiv="cleartype" content="on"> |
| |
| <!-- start custom head snippets --> |
| |
| <!-- insert favicons. use http://realfavicongenerator.net/ --> |
| <link href="https://fonts.cat.net/css?family=Roboto:400,500,700|Source+Code+Pro" rel="stylesheet"> |
| <script src="/assets/js/custom.js"></script> |
| <!-- end custom head snippets --> |
| |
| </head> |
| |
| <body class="layout--single"> |
| |
| <!--[if lt IE 9]> |
| <div class="notice--danger align-center" style="margin: 0;">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</div> |
| <![endif]--> |
| <div class="masthead" onmouseleave="$('#childrenShow').css('display', 'none')"> |
| <div class="masthead__inner-wrap"> |
| <div class="masthead__menu"> |
| <nav id="site-nav" class="greedy-nav"> |
| |
| <a class="site-title active" href="/cn"><img src="https://www.apache.org/img/servicecomb.png"></a> |
| |
| <ul class="visible-links"> |
| |
| |
| |
| |
| |
| <li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')"> |
| |
| <a href="/cn/">首页</a> |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| <li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')"> |
| |
| <a href="/cn/developers/">项目</a> |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| <li class="def-nav-li" onmouseenter="$('#childrenShow').css('display', 'block')"> |
| |
| |
| |
| |
| |
| <a href="/cn/docs/users/">文档</a> |
| |
| |
| <ul id="childrenShow" class="def-children-show" onmouseleave="$('#childrenShow').css('display', 'none')"> |
| |
| <li><a href="/cn/docs/getting-started/" class="">入门指南</a></li> |
| |
| <li><a href="/cn/docs/users/" class="">用户手册</a></li> |
| |
| <li><a href="/cn/slides/" class="">大咖视频</a></li> |
| |
| <li><a href="/cn/faqs/" class="">常见问题</a></li> |
| |
| </ul> |
| </li> |
| |
| |
| |
| |
| |
| |
| <li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')"> |
| |
| <a href="/cn/developers/contributing">社区</a> |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| <li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')"> |
| |
| <a href="/cn/year-archive/">博文</a> |
| |
| </li> |
| |
| |
| |
| |
| |
| |
| <li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')"> |
| |
| <a href="/cn/release/">下载</a> |
| |
| </li> |
| |
| |
| </ul> |
| <button><div class="navicon"></div></button> |
| <ul class="hidden-links hidden"></ul> |
| <div class="nav-lang"> |
| |
| |
| |
| <a href=/docs/distributed_saga_1/>English</a> |
| |
| </div> |
| </nav> |
| </div> |
| </div> |
| </div> |
| |
| |
| |
| |
| |
| |
| <div id="main" role="main"> |
| |
| <div class="sidebar sticky"> |
| |
| <div class="back-to-home"><a href="/cn/">首页</a> > ServiceComb中的数据最终一致性方案 - part 1</div> |
| |
| |
| |
| <div itemscope itemtype="http://schema.org/Person"> |
| |
| |
| |
| <div class="author__content"> |
| <h3 class="author__name" itemprop="name">Sean Yin</h3> |
| |
| <p class="author__bio" itemprop="description"> |
| |
| |
| Nothing but speed is indestructible |
| |
| |
| </p> |
| |
| </div> |
| |
| <div class="author__urls-wrapper"> |
| <button class="btn btn--inverse">关注</button> |
| <ul class="author__urls social-icons"> |
| |
| |
| |
| <li> |
| <a href="http://seanyinx.github.io" itemprop="url"> |
| <i class="fa fa-fw fa-chain" aria-hidden="true"></i> 网站 |
| </a> |
| </li> |
| |
| |
| |
| <li> |
| <a href="mailto:seanyinx@gmail.com"> |
| <meta itemprop="email" content="seanyinx@gmail.com" /> |
| <i class="fa fa-fw fa-envelope-square" aria-hidden="true"></i> 电子邮箱 |
| </a> |
| </li> |
| |
| |
| |
| |
| |
| <li> |
| <a href="https://twitter.com/seanyinx" itemprop="sameAs"> |
| <i class="fa fa-fw fa-twitter-square" aria-hidden="true"></i> Twitter |
| </a> |
| </li> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <!-- |
| <li> |
| <a href="http://link-to-whatever-social-network.com/user/" itemprop="sameAs"> |
| <i class="fa fa-fw" aria-hidden="true"></i> Custom Social Profile Link |
| </a> |
| </li> |
| --> |
| </ul> |
| </div> |
| </div> |
| |
| |
| </div> |
| |
| |
| |
| <article class="page" itemscope itemtype="http://schema.org/CreativeWork"> |
| <meta itemprop="headline" content="ServiceComb中的数据最终一致性方案 - part 1"> |
| <meta itemprop="description" content="在微服务场景下的数据一致性问题背景"> |
| <meta itemprop="datePublished" content="September 13, 2017"> |
| <meta itemprop="dateModified" content="September 13, 2017"> |
| |
| <div class="page__inner-wrap"> |
| |
| |
| <header> |
| <h1 class="page__title" itemprop="headline">ServiceComb中的数据最终一致性方案 - part 1 |
| </h1> |
| |
| <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> |
| |
| |
| |
| |
| 少于 1 分钟 阅读 |
| |
| </p> |
| |
| </header> |
| |
| |
| |
| <section class="page__content" itemprop="text"> |
| <p>数据一致性是许多系统的关键部分,特别是在微服务和云的环境下。我们最近在ServiceComb下发布了<a href="https://github.com/apache/incubator-servicecomb-saga">Saga</a>项目, |
| 以解决数据一致性问题。但为什么数据一致性如此重要?Saga又是什么?</p> |
| |
| <h2 id="单体应用的数据一致性">单体应用的数据一致性</h2> |
| <p>想象一下如果我们经营着一家大型企业,下属有航空公司、租车公司、和连锁酒店。我们为客户提供一站式的旅游行程规划服务,这样客户只需要提供出行目的地, |
| 我们帮助客户预订机票、租车、以及预订酒店。从业务的角度,我们必须保证<strong>上述三个服务的预订都完成才能满足一个成功的旅游行程,否则不能成行</strong>。</p> |
| |
| <p>我们的单体应用要满足这个需求非常简单,只需将这个三个服务请求放到同一个数据库事务中,数据库会帮我们保证全部成功或者全部回滚。</p> |
| |
| <p><img src="/assets/images/saga.monolithic.png" alt="单体应用" class="align-center" /></p> |
| |
| <p>当这个功能上线以后,公司非常满意,客户也非常高兴。</p> |
| |
| <h2 id="微服务场景下的数据一致性">微服务场景下的数据一致性</h2> |
| <p>这几年中,我们的行程规划服务非常成功,企业蒸蒸日上,用户量也翻了数十倍。企业的下属航空公司、租车公司、和连锁酒店也相继推出了更多服务以满足客户需求, |
| 我们的应用和开发团队也因此日渐庞大。如今我们的单体应用已变得如此复杂,以至于没人了解整个应用是怎么运作的。更糟的是新功能的上线现在需要所有研发团队合作, |
| 日夜奋战数周才能完成。看着市场占有率每况愈下,公司高层对研发部门越来越不满意。</p> |
| |
| <p>经过数轮讨论,我们最终决定将庞大的单体应用一分为四:机票预订服务、租车服务、酒店预订服务、和支付服务。服务各自使用自己的数据库,并通过HTTP协议通信。 |
| 负责各服务的团队根据市场需求按照自己的开发节奏发版上线。如今我们面临新的挑战:如何保证最初<strong>三个服务的预订都完成才能满足一个成功的旅游行程, |
| 否则不能成行</strong>的业务规则?现在服务有各自的边界,而且数据库选型也不尽相同,通过数据库保证数据一致性的方案已不可行。</p> |
| |
| <p><img src="/assets/images/saga.service.boundary.png" alt="服务边界" class="align-center" /></p> |
| |
| <h2 id="sagas">Sagas</h2> |
| <p>幸运的是我们在互联网找到一篇精彩的<a href="https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">论文</a>,文中提出的数据一致性解决方案<em>Saga</em>恰好满足我们的业务要求。</p> |
| |
| <blockquote> |
| <p>Saga是一个长活事务,可被分解成可以交错运行的子事务集合。其中每个子事务都是一个保持数据库一致性的真实事务。[<a href="https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">1</a>]</p> |
| </blockquote> |
| |
| <p>在我们的业务场景下,一个行程规划的事务就是一个Saga,其中包含四个子事务:机票预订、租车、酒店预订、和支付。</p> |
| |
| <p><img src="/assets/images/saga.transactions.png" alt="事务" class="align-center" /></p> |
| |
| <p><a href="http://www.chrisrichardson.net/">Chris Richardson</a>在他的文章<a href="http://microservices.io/patterns/data/saga.html">Pattern: Saga</a>中对Saga有所描述。 |
| Caitie McCaffrey也在她的<a href="https://www.youtube.com/watch?v=xDuwrtwYHu8">演讲</a>中提到如何在微软的<a href="https://en.wikipedia.org/wiki/Halo_4">光晕 4</a>游戏中如何应用saga解决数据一致性问题。</p> |
| |
| <h3 id="saga的运行原理">Saga的运行原理</h3> |
| <blockquote> |
| <p>Saga中的事务相互关联,应作为(非原子)单位执行。任何未完全执行的Saga是不满足要求的,如果发生,必须得到补偿。要修正未完全执行的部分, |
| 每个saga子交易T<sub>1</sub>应提供对应补偿事务C<sub>1</sub>[<a href="https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">1</a>]</p> |
| </blockquote> |
| |
| <p>我们根据上述规则定义以下事务及其相应的事务补偿:</p> |
| |
| <table> |
| <thead> |
| <tr> |
| <th style="text-align: center">服务</th> |
| <th style="text-align: center">事务</th> |
| <th style="text-align: center">补偿</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td style="text-align: center">机票预订</td> |
| <td style="text-align: center">预订机票</td> |
| <td style="text-align: center">取消预订</td> |
| </tr> |
| <tr> |
| <td style="text-align: center">租车</td> |
| <td style="text-align: center">租车</td> |
| <td style="text-align: center">取消预订</td> |
| </tr> |
| <tr> |
| <td style="text-align: center">酒店预订</td> |
| <td style="text-align: center">预订房间</td> |
| <td style="text-align: center">取消预订</td> |
| </tr> |
| <tr> |
| <td style="text-align: center">支付</td> |
| <td style="text-align: center">支付</td> |
| <td style="text-align: center">退款</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <blockquote> |
| <p>当每个saga子事务 T<sub>1</sub>, T<sub>2</sub>, …, T<sub>n</sub> 都有对应的补偿定义 C<sub>1</sub>, C<sub>2</sub>, …, C<sub>n-1</sub>, |
| 那么saga系统可以保证 [<a href="https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">1</a>]</p> |
| <ul> |
| <li>子事务序列 T<sub>1</sub>, T<sub>2</sub>, …, T<sub>n</sub>得以完成 (最佳情况)</li> |
| <li>或者序列 T<sub>1</sub>, T<sub>2</sub>, …, T<sub>j</sub>, C<sub>j</sub>, …, C<sub>2</sub>, C<sub>1</sub>, 0 < j < n, 得以完成</li> |
| </ul> |
| </blockquote> |
| |
| <p>换句话说,通过上述定义的事务/补偿,saga保证满足以下业务规则:</p> |
| <ul> |
| <li>所有的预订都被执行成功,如果任何一个失败,都会被取消</li> |
| <li>如果最后一步付款失败,所有预订也将被取消</li> |
| </ul> |
| |
| <h3 id="saga的恢复方式">Saga的恢复方式</h3> |
| <p><a href="https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">原论文</a>中描述了两种类型的Saga恢复方式:</p> |
| <ul> |
| <li><strong>向后恢复</strong> <em>补偿</em>所有已完成的事务,如果任一子事务失败</li> |
| <li><strong>向前恢复</strong> <em>重试</em>失败的事务,假设每个子事务最终都会成功</li> |
| </ul> |
| |
| <p>显然,向前恢复没有必要提供补偿事务,如果你的业务中,子事务(最终)总会成功,或补偿事务难以定义或不可能,向前恢复更符合你的需求。</p> |
| |
| <p>理论上补偿事务永不失败,然而,在分布式世界中,服务器可能会宕机,网络可能会失败,甚至数据中心也可能会停电。在这种情况下我们能做些什么? |
| 最后的手段是提供回退措施,比如人工干预。</p> |
| |
| <h3 id="使用saga的条件">使用Saga的条件</h3> |
| <p>Saga看起来很有希望满足我们的需求。所有长活事务都可以这样做吗?这里有一些限制:</p> |
| <ul> |
| <li>Saga只允许两个层次的嵌套,顶级的Saga和简单子事务 [<a href="https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">1</a>]</li> |
| <li>在外层,全原子性不能得到满足。也就是说,sagas可能会看到其他sagas的部分结果 [<a href="https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">1</a>]</li> |
| <li>每个子事务应该是独立的原子行为 [2]</li> |
| </ul> |
| |
| <p>在我们的业务场景下,航班预订、租车、酒店预订和付款是自然独立的行为,而且每个事务都可以用对应服务的数据库保证原子操作。</p> |
| |
| <p>我们在行程规划事务层面也不需要原子性。一个用户可以预订最后一张机票,而后由于信用卡余额不足而被取消。同时另一个用户可能开始会看到已无余票, |
| 接着由于前者预订被取消,最后一张机票被释放,而抢到最后一个座位并完成行程规划。</p> |
| |
| <p>补偿也有需考虑的事项:</p> |
| <blockquote> |
| <p>补偿事务从语义角度撤消了事务T<sub>i</sub>的行为,但未必能将数据库返回到执行T<sub>i</sub>时的状态。(例如,如果事务触发导弹发射, |
| 则可能无法撤消此操作)[<a href="https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">1</a>]</p> |
| </blockquote> |
| |
| <p>但这对我们的业务来说不是问题。其实难以撤消的行为也有可能被补偿。例如,发送电邮的事务可以通过发送解释问题的另一封电邮来补偿。</p> |
| |
| <h2 id="总结">总结</h2> |
| <p>现在我们有了通过Saga来解决数据一致性问题的方案。它允许我们成功地执行所有事务,或在任何事务失败的情况下,补偿已成功的事务。 |
| 虽然Saga不提供<a href="https://en.wikipedia.org/wiki/ACID">ACID</a>保证,但仍适用于许多数据最终一致性的场景。那我们如何设计一个Saga系统? |
| 让我们在下一篇博文来回答这个问题。</p> |
| |
| <h2 id="参考">参考</h2> |
| <ol> |
| <li><a href="https://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf">Original Paper on Sagas</a> by By Hector Garcia-Molina & Kenneth Salem</li> |
| <li>Gifford, David K and James E Donahue, “Coordinating Independent Atomic Actions”, Proceedings of IEEE COMPCON, San Francisco, CA, February, 1985</li> |
| <li>Chris Richardson: http://www.chrisrichardson.net/</li> |
| <li>ServiceComb Saga Project: https://github.com/apache/incubator-servicecomb-saga</li> |
| </ol> |
| |
| |
| |
| </section> |
| |
| <footer class="page__meta"> |
| |
| |
| |
| |
| |
| |
| |
| <p class="page__date"><strong><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> 最新的:</strong> <time datetime="2017-09-13">2017年9月13日</time></p> |
| |
| |
| |
| </footer> |
| |
| <section class="page__share"> |
| |
| <h4 class="page__share-title">分享</h4> |
| |
| |
| <a href="https://twitter.com/intent/tweet?via=ServiceComb&text=ServiceComb中的数据最终一致性方案 - part 1 /cn/docs/distributed_saga_1/" class="btn btn--twitter" title="分享 Twitter"><i class="fa fa-fw fa-twitter" aria-hidden="true"></i><span> Twitter</span></a> |
| |
| <a href="https://www.facebook.com/sharer/sharer.php?u=/cn/docs/distributed_saga_1/" class="btn btn--facebook" title="分享 Facebook"><i class="fa fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span></a> |
| |
| <a href="https://plus.google.com/share?url=/cn/docs/distributed_saga_1/" class="btn btn--google-plus" title="分享 Google Plus"><i class="fa fa-fw fa-google-plus" aria-hidden="true"></i><span> Google+</span></a> |
| |
| <a href="https://www.linkedin.com/shareArticle?mini=true&url=/cn/docs/distributed_saga_1/" class="btn btn--linkedin" title="分享 LinkedIn"><i class="fa fa-fw fa-linkedin" aria-hidden="true"></i><span> LinkedIn</span></a> |
| </section> |
| |
| |
| |
| <nav class="pagination"> |
| |
| <a href="/docs/distributed_saga_1/" class="pagination--pager" title="Eventual Data Consistency Solution in ServiceComb - part 1 |
| ">向前</a> |
| |
| |
| <a href="/cn/docs/maven_dependency_management/" class="pagination--pager" title="使用maven管理复杂依赖关系的技巧 |
| ">向后</a> |
| |
| </nav> |
| |
| |
| </div> |
| |
| |
| <div class="page__comments"> |
| |
| |
| <section id="static-comments"> |
| |
| <!-- Start static comments --> |
| <div class="js-comments"> |
| |
| </div> |
| <!-- End static comments --> |
| |
| <!-- Start new comment form --> |
| <h4 class="page__comments-title">留下评论</h4> |
| <p class="small">您的电子邮箱地址并不会被展示。请填写标记为必须的字段。 <span class="required">*</span></p> |
| <form id="new_comment" class="page__comments-form js-form form" method="post" action="https://api.staticman.net/v1/entry/apache/incubator-servicecomb-website/master"> |
| <div class="form__spinner"> |
| <i class="fa fa-spinner fa-spin fa-3x fa-fw"></i> |
| <span class="sr-only">正在加载...</span> |
| </div> |
| |
| <fieldset> |
| <label for="comment-form-message">评论 <small class="required">*</small></label> |
| <textarea type="text" rows="3" id="comment-form-message" name="fields[message]" tabindex="1"></textarea> |
| <div class="small help-block"><a href="https://daringfireball.net/projects/markdown/">Markdown语法已支持。</a></div> |
| </fieldset> |
| <fieldset> |
| <label for="comment-form-name">姓名 <small class="required">*</small></label> |
| <input type="text" id="comment-form-name" name="fields[name]" tabindex="2" /> |
| </fieldset> |
| <fieldset> |
| <label for="comment-form-email">电子邮箱 <small class="required">*</small></label> |
| <input type="email" id="comment-form-email" name="fields[email]" tabindex="3" /> |
| </fieldset> |
| <fieldset> |
| <label for="comment-form-url">网站(可选)</label> |
| <input type="url" id="comment-form-url" name="fields[url]" tabindex="4"/> |
| </fieldset> |
| <fieldset class="hidden" style="display: none;"> |
| <input type="hidden" name="options[slug]" value="saga-background"> |
| <label for="comment-form-location">Not used. Leave blank if you are a human.</label> |
| <input type="text" id="comment-form-location" name="fields[hidden]" autocomplete="off"/> |
| </fieldset> |
| <!-- Start comment form alert messaging --> |
| <p class="hidden js-notice"> |
| <strong class="js-notice-text"></strong> |
| </p> |
| <!-- End comment form alert messaging --> |
| <fieldset> |
| <button type="submit" id="comment-form-submit" tabindex="5" class="btn btn--large">提交评论</button> |
| </fieldset> |
| </form> |
| <!-- End new comment form --> |
| |
| </section> |
| |
| </div> |
| |
| |
| </article> |
| |
| |
| |
| <div class="page__related"> |
| <h4 class="page__related-title">猜您还喜欢</h4> |
| <div class="grid__wrapper"> |
| |
| |
| |
| |
| |
| <div class="grid__item"> |
| <article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork"> |
| |
| <h2 class="archive__item-title" itemprop="headline"> |
| |
| <a href="/cn/docs/playing-on-the-open-source-community-with-Apache-ServiceComb-GDUT/" rel="permalink">与Apache ServiceComb一起玩开源-广工站 (PPT Download) |
| </a> |
| |
| </h2> |
| <p class="archive__item-excerpt" itemprop="description">与Apache ServiceComb一起玩开源-广工站 (PPT Download) |
| </p> |
| |
| <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> |
| |
| |
| |
| |
| 少于 1 分钟 阅读 |
| |
| </p> |
| |
| </article> |
| </div> |
| |
| |
| |
| |
| |
| |
| <div class="grid__item"> |
| <article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork"> |
| |
| <h2 class="archive__item-title" itemprop="headline"> |
| |
| <a href="/cn/docs/servicecomb-service-center-client/" rel="permalink">使用ServiceComb客户端轻松调用ServiceCenter |
| </a> |
| |
| </h2> |
| <p class="archive__item-excerpt" itemprop="description">使用ServiceComb客户端轻松调用ServiceCenter |
| </p> |
| |
| <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> |
| |
| |
| |
| |
| 2 分钟 阅读 |
| |
| </p> |
| |
| </article> |
| </div> |
| |
| |
| |
| |
| |
| |
| <div class="grid__item"> |
| <article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork"> |
| |
| <h2 class="archive__item-title" itemprop="headline"> |
| |
| <a href="/cn/docs/playing-on-the-open-source-community-with-Apache-ServiceComb-BUPT/" rel="permalink">与Apache ServiceComb一起玩开源-北邮站 (PPT Download) |
| </a> |
| |
| </h2> |
| <p class="archive__item-excerpt" itemprop="description">与Apache ServiceComb一起玩开源-北邮站 (PPT Download) |
| </p> |
| |
| <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> |
| |
| |
| |
| |
| 少于 1 分钟 阅读 |
| |
| </p> |
| |
| </article> |
| </div> |
| |
| |
| |
| |
| |
| |
| <div class="grid__item"> |
| <article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork"> |
| |
| <h2 class="archive__item-title" itemprop="headline"> |
| |
| <a href="/docs/servicecomb-accept-newcapec-institute-code-donation/" rel="permalink">Apache ServiceComb Accept Code Donation From NewCapec Institute |
| </a> |
| |
| </h2> |
| <p class="archive__item-excerpt" itemprop="description">Apache ServiceComb Accept Code Donation From NewCapec Institute |
| </p> |
| |
| <p class="page__meta"><i class="fa fa-clock-o" aria-hidden="true"></i> |
| |
| |
| |
| |
| 少于 1 分钟 阅读 |
| |
| </p> |
| |
| </article> |
| </div> |
| |
| |
| </div> |
| </div> |
| |
| </div> |
| |
| |
| <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> |
| <div align="center" style="margin: 0 0;"> |
| <ins class="adsbygoogle" |
| style="display:block; border-bottom: initial;" |
| data-ad-client="ca-pub-7328585512091257" |
| data-ad-slot="3049671934" |
| data-ad-format="auto"></ins> |
| </div> |
| |
| <div class="page__footer"> |
| <footer> |
| <!-- start custom footer snippets --> |
| |
| <!-- end custom footer snippets --> |
| |
| <div class="container"> |
| <div class="row justify-content-md-center"> |
| |
| <div class="col"> |
| <ul> |
| <p class="header">资源</p> |
| <li><a href="/cn/docs/getting-started/">入门指南</a></li> |
| <li><a href="/cn/docs/users/">用户指南</a></li> |
| <li><a href="/cn/slides/">资料</a></li> |
| <li><a href="/cn/users/faq/">常见问题</a></li> |
| </ul> |
| </div> |
| <div class="col"> |
| <ul> |
| <p class="header">ASF</p> |
| <li><a href="http://www.apache.org">基金会</a></li> |
| <li><a href="http://www.apache.org/licenses/">许可证</a></li> |
| <li><a href="http://www.apache.org/events/current-event">活动</a></li> |
| <li><a href="http://www.apache.org/foundation/sponsorship.html">赞助</a></li> |
| <li><a href="http://www.apache.org/foundation/thanks.html">鸣谢</a></li> |
| </ul> |
| </div> |
| <div class="col"> |
| <ul> |
| <p class="header">贡献</p> |
| <li><a href="http://issues.apache.org/jira/browse/SCB">报告本网页问题</a></li> |
| <li><a href="https://github.com/apache/servicecomb-website/edit/master/_posts/cn/2017-09-13-saga-background.md">在Github上编辑此页</a></li> |
| <li><a href="/cn/developers/submit-codes/">代码提交指南</a></li> |
| <li><a href="/cn/security">安全</a></li> |
| </ul> |
| </div> |
| <div class="col"> |
| <ul class="social-icons"> |
| <p class="header">社区</p> |
| <li> |
| <a href="mailto:dev-subscribe@servicecomb.incubator.apache.org" rel="nofollow"><span class="mail">邮件列表</span></a> |
| </li> |
| <li> |
| <a href="https://github.com/apache?q=ServiceComb" target="_blank"><span class="github">Github</span></a> |
| </li> |
| <li> |
| <a href="https://twitter.com/ServiceComb" target="_blank"><span class="twitter">Twitter</span></a> |
| </li> |
| <li> |
| <a href="/feed.xml" target="_blank"><span class="rss">Feed</span></a> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| <div class="page__footer-bottom"> |
| <div>© 2019 Apache ServiceComb. 技术来自于 <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/minimal-mistakes-jekyll-theme/" rel="nofollow">Minimal Mistakes</a>.</div> |
| <div>All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div> |
| </div> |
| |
| </footer> |
| </div> |
| |
| <script src="/assets/js/main.min.js"></script> |
| |
| |
| |
| |
| <script> |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| |
| ga('create', 'UA-101622733-1', 'auto'); |
| ga('send', 'pageview'); |
| </script> |
| |
| |
| |
| |
| |
| |
| |
| |
| <script> |
| (function ($) { |
| var $comments = $('.js-comments'); |
| |
| $('#new_comment').submit(function () { |
| var form = this; |
| |
| $(form).addClass('disabled'); |
| $('#comment-form-submit').html('<i class="fa fa-spinner fa-spin fa-fw"></i> 正在加载...'); |
| |
| $.ajax({ |
| type: $(this).attr('method'), |
| url: $(this).attr('action'), |
| data: $(this).serialize(), |
| contentType: 'application/x-www-form-urlencoded', |
| success: function (data) { |
| $('#comment-form-submit').html('已提交'); |
| $('.page__comments-form .js-notice').removeClass('notice--danger'); |
| $('.page__comments-form .js-notice').addClass('notice--success'); |
| showAlert('感谢您的评论!被批准后它会立即在此站点展示。'); |
| }, |
| error: function (err) { |
| console.log(err); |
| $('#comment-form-submit').html('提交评论'); |
| $('.page__comments-form .js-notice').removeClass('notice--success'); |
| $('.page__comments-form .js-notice').addClass('notice--danger'); |
| showAlert('很抱歉,您的提交存在错误。请确保所有必填字段都已填写正确,然后再试一次。'); |
| $(form).removeClass('disabled'); |
| } |
| }); |
| |
| return false; |
| }); |
| |
| function showAlert(message) { |
| $('.page__comments-form .js-notice').removeClass('hidden'); |
| $('.page__comments-form .js-notice-text').html(message); |
| } |
| })(jQuery); |
| </script> |
| |
| |
| |
| |
| |
| |
| |
| </body> |
| </html> |