| <!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>环境配置 - Apache ServiceComb</title> |
| |
| |
| |
| |
| <meta name="description" content="环境配置"> |
| |
| |
| |
| |
| <meta name="author" content=""> |
| |
| <meta property="og:locale" content="cn"> |
| <meta property="og:site_name" content="Apache ServiceComb"> |
| <meta property="og:title" content="环境配置"> |
| |
| |
| <link rel="canonical" href="https://github.com/pages/apache/incubator-servicecomb-website/cn/docs/users/setup-environment/"> |
| <meta property="og:url" content="https://github.com/pages/apache/incubator-servicecomb-website/cn/docs/users/setup-environment/"> |
| |
| |
| |
| <meta property="og:description" content="环境配置"> |
| |
| |
| |
| <meta name="twitter:site" content="@ServiceComb"> |
| <meta name="twitter:title" content="环境配置"> |
| <meta name="twitter:description" content="环境配置"> |
| <meta name="twitter:url" content=""> |
| |
| |
| <meta name="twitter:card" content="summary"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <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"> |
| <link rel="stylesheet" href="/assets/vendor/prism/prism.css"> |
| |
| <!--[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.loli.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 class="active" href="/cn/docs/users/">文档</a> |
| |
| |
| <ul id="childrenShow" class="def-children-show-cn" 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/users/setup-environment/>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> > 环境配置</div> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <nav class="nav__list"> |
| |
| <input id="ac-toc" name="accordion-toc" type="checkbox" /> |
| <label for="ac-toc">切换菜单</label> |
| <ul class="nav__items"> |
| |
| <li> |
| |
| <span class="nav__sub-title">Java-chassis用户手册</span> |
| |
| |
| |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| <li><a href="/references/java-chassis/en_US/" class="">2.3.0</a></li> |
| |
| </ul> |
| |
| </li> |
| |
| <li> |
| |
| <span class="nav__sub-title">Pack用户手册</span> |
| |
| |
| |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| <li><a href="https://github.com/apache/servicecomb-pack/blob/master/docs/user_guide.md" class="">0.5.0(英文版)</a></li> |
| |
| </ul> |
| |
| </li> |
| |
| <li> |
| |
| <span class="nav__sub-title">ServiceCenter用户手册</span> |
| |
| |
| |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| <li><a href="https://service-center.readthedocs.io/en/latest/user-guides.html" class="">2.0.0(英文版)</a></li> |
| |
| </ul> |
| |
| </li> |
| |
| <li> |
| |
| <span class="nav__sub-title">Kie 用户手册</span> |
| |
| |
| |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| <li><a href="https://kie.readthedocs.io/en/latest/" class="">0.2.0(英文版)</a></li> |
| |
| </ul> |
| |
| </li> |
| |
| <li> |
| |
| <span class="nav__sub-title">Mesher 用户手册</span> |
| |
| |
| |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| <li><a href="https://mesher.readthedocs.io/en/latest/" class="">1.6.3(英文版)</a></li> |
| |
| </ul> |
| |
| </li> |
| |
| </ul> |
| </nav> |
| |
| |
| |
| </div> |
| |
| |
| |
| <article class="page" itemscope itemtype="http://schema.org/CreativeWork"> |
| <meta itemprop="headline" content="环境配置"> |
| <meta itemprop="description" content="环境配置"> |
| |
| <meta itemprop="dateModified" content="April 13, 2018"> |
| |
| <div class="page__inner-wrap"> |
| |
| |
| <header> |
| <h1 class="page__title" itemprop="headline">环境配置 |
| </h1> |
| |
| </header> |
| |
| |
| |
| <section class="page__content" itemprop="text"> |
| <aside class="sidebar__right"> |
| <nav class="toc"> |
| <!-- <header><h4 class="nav__title"><i class="fa fa-file-text"></i> 在本页上</h4></header> --> |
| <ul class="toc__menu" id="markdown-toc"> |
| <li><a href="#安装java开发环境" id="markdown-toc-安装java开发环境">安装Java开发环境</a></li> |
| <li><a href="#运行-service-center" id="markdown-toc-运行-service-center">运行 Service Center</a> <ul> |
| <li><a href="#运行-stand-alone-service-center" id="markdown-toc-运行-stand-alone-service-center">运行 Stand-alone Service Center</a></li> |
| <li><a href="#运行-service-center-集群" id="markdown-toc-运行-service-center-集群">运行 Service Center 集群</a></li> |
| </ul> |
| </li> |
| </ul> |
| |
| </nav> |
| </aside> |
| |
| <h2 id="安装java开发环境">安装Java开发环境</h2> |
| |
| <ul> |
| <li> |
| <p>安装git,详情可参考<a href="https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git">git安装教程</a></p> |
| </li> |
| <li> |
| <p>安装JDK 1.8,详情可参考<a href="https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html" target="_blank">JDK安装教程</a>。</p> |
| </li> |
| <li> |
| <p>安装Maven 3.x,详情可参考<a href="https://maven.apache.org/install.html" target="_blank">Maven安装教程</a>。</p> |
| </li> |
| <li> |
| <p>安装IntelliJ Idea IDE,详情可参考<a href="https://www.jetbrains.com/help/idea/installing-and-launching.html" target="_blank">IntelliJ安装教程</a>。</p> |
| </li> |
| </ul> |
| |
| <h2 id="运行-service-center">运行 Service Center</h2> |
| <h3 id="运行-stand-alone-service-center">运行 Stand-alone Service Center</h3> |
| <p>运行Stand-alone Service Center有以下两种方式:</p> |
| |
| <ol> |
| <li> |
| <p>以可执行文件的方式运行</p> |
| |
| <ul class="nav nav-tabs"> |
| <li data-toggle="tab" class="active"><a data-toggle="tab" href="#windows">Windows</a></li> |
| <li data-toggle="tab"><a data-toggle="tab" href="#linux">Linux</a></li> |
| </ul> |
| |
| <div class="tab-content"> |
| <div id="windows" class="tab-pane active"> |
| <ol> |
| <li>下载<a href="http://apache.org/dyn/closer.cgi/incubator/servicecomb/incubator-servicecomb-service-center/1.0.0-m2/apache-servicecomb-incubating-service-center-1.0.0-m2-windows-amd64.tar.gz">服务注册中心可执行文件压缩包</a></li> |
| <li>解压缩到当前文件夹</li> |
| <li>进入解压缩后的目录,然后双击运行<strong>start-service-center.bat</strong>文件</li> |
| </ol> |
| </div> |
| <div id="linux" class="tab-pane fade"> |
| <ol> |
| <li>下载服务注册中心可执行文件压缩包并解压缩 |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wget http://apache.org/dyn/closer.cgi/incubator/servicecomb/incubator-servicecomb-service-center/1.0.0-m2/apache-servicecomb-incubating-service-center-1.0.0-m2-linux-amd64.tar.gz |
| <span class="nb">tar </span>xvf apache-servicecomb-incubating-service-center-1.0.0-m2-linux-amd64.tar.gz |
| </code></pre></div> </div> |
| </li> |
| <li>运行服务注册中心 |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bash apache-servicecomb-incubating-service-center-1.0.0-m2-linux-amd64/start-service-center.sh |
| </code></pre></div> </div> |
| </li> |
| </ol> |
| |
| <p class="notice--warning">注意:前端(frontend)在Linux环境下默认会绑定ipv6地址,导致浏览器报错,修复办法为:先修改conf/app.conf中的httpaddr为外部可达网卡ip,之后修改app/appList/apiList.js中<code class="language-plaintext highlighter-rouge">ip : 'http://127.0.0.1'</code>为对应ip,最后重启ServiceCenter即可。</p> |
| |
| </div> |
| </div> |
| |
| <p class="notice--warning">注意:Window和Linux版本均只支持64位系统。</p> |
| </li> |
| <li> |
| <p>以Docker的方式运行</p> |
| </li> |
| </ol> |
| |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker pull servicecomb/service-center |
| docker run <span class="nt">-d</span> <span class="nt">-p</span> 30100:30100 servicecomb/service-center:latest |
| </code></pre></div></div> |
| |
| <p class="notice--warning"><strong>注意事项:</strong> 服务注册中心运行后绑定的IP为:<em>http://127.0.0.1:30100</em>。<br /> |
| 如使用Docker Toolbox,可通过 <code class="language-plaintext highlighter-rouge">docker-machine ip</code> 获取服务绑定IP地址。</p> |
| |
| <h3 id="运行-service-center-集群">运行 Service Center 集群</h3> |
| <p>Service Center是一个无状态的应用因此它很容易以集群的模式部署提供HA。</p> |
| |
| <p>它依赖<a href="https://github.com/coreos/etcd">etcd</a>存储微服务的信息,etcd既支持standalone模式运行也支持<a href="https://coreos.com/etcd/docs/latest/op-guide/clustering.html">集群模式</a>运行。</p> |
| |
| <p>提示:我们强烈推荐etcd以集群模式运行,这样才能从整体上保证Service Center的HA能力;另外在这篇<a href="https://coreos.com/etcd/docs/latest/op-guide/runtime-configuration.html">文档</a>中我们可以了解到etcd需要部署至少三个节点才能够避免Majority Failure。</p> |
| |
| <p>部署了standalone或集群etcd后,你可以按下面的步骤部署Service Center集群,我们以在两台VM上各部署一个Service Center实例为例:</p> |
| |
| <table> |
| <thead> |
| <tr> |
| <th style="text-align: center">Name</th> |
| <th style="text-align: center">Address</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td style="text-align: center">VM1</td> |
| <td style="text-align: center">10.12.0.1</td> |
| </tr> |
| <tr> |
| <td style="text-align: center">VM2</td> |
| <td style="text-align: center">10.12.0.2</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <p>我们假定你的etcd运行在http://10.12.0.4:2379 上:</p> |
| |
| <h5 id="第一步">第一步</h5> |
| <p>在所有的VM上从<a href="https://github.com/apache/servicecomb-service-center/releases">ServiceComb官网</a>下载最新版本的Service Center并解压:</p> |
| |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">tar</span> <span class="nt">-xvf</span> service-center-X.X.X-linux-amd64.tar.gz |
| </code></pre></div></div> |
| |
| <p>提示:请不要按stand-alone提示的方式执行start-service-center.sh,因为这样会启动内置的etcd。</p> |
| |
| <h5 id="第二步">第二步</h5> |
| <p>编辑ServcieComb的配置文件,修改ip/port以及etcd地址:</p> |
| <h6 id="vm1">VM1</h6> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>vi conf/app.conf |
| </code></pre></div></div> |
| |
| <p>修改下面的配置 :</p> |
| <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>httpaddr = 10.12.0.1 |
| manager_cluster = "10.12.0.4:2379" |
| </code></pre></div></div> |
| |
| <p>然后启动Service Center :</p> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./service-center |
| </code></pre></div></div> |
| |
| <h6 id="vm2">VM2</h6> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>vi conf/app.conf |
| </code></pre></div></div> |
| |
| <p>修改下面的配置 :</p> |
| <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>httpaddr = 10.12.0.2 |
| manager_cluster = "10.12.0.4:2379" |
| </code></pre></div></div> |
| |
| <p>然后启动Service Center :</p> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./service-center |
| </code></pre></div></div> |
| |
| <p>提示:在<code class="language-plaintext highlighter-rouge">manger_cluster</code>配置中你可以填写多个在etcd群集中的etcd实例地址:</p> |
| <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>manager_cluster= "10.12.0.4:2379,10.12.0.X:2379,10.12.0.X:2379" |
| </code></pre></div></div> |
| |
| <h5 id="第三步">第三步</h5> |
| <p>验证你部署完毕的Service Center实例 :</p> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl http://10.12.0.1:30101/v4/default/registry/health |
| </code></pre></div></div> |
| <p>将会返回下面的内容 :</p> |
| <div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> |
| </span><span class="nl">"instances"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w"> |
| </span><span class="p">{</span><span class="w"> |
| </span><span class="nl">"instanceId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"d6e9e976f9df11e7a72b286ed488ff9f"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"serviceId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"d6e99f4cf9df11e7a72b286ed488ff9f"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"endpoints"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w"> |
| </span><span class="s2">"rest://10.12.0.1:30100"</span><span class="w"> |
| </span><span class="p">],</span><span class="w"> |
| </span><span class="nl">"hostName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"service_center_10_12_0_1"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"UP"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"healthCheck"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> |
| </span><span class="nl">"mode"</span><span class="p">:</span><span class="w"> </span><span class="s2">"push"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"interval"</span><span class="p">:</span><span class="w"> </span><span class="mi">30</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"times"</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="w"> |
| </span><span class="p">},</span><span class="w"> |
| </span><span class="nl">"timestamp"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1516012543"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"modTimestamp"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1516012543"</span><span class="w"> |
| </span><span class="p">},</span><span class="w"> |
| </span><span class="p">{</span><span class="w"> |
| </span><span class="nl">"instanceId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"16d4cb35f9e011e7a58a286ed488ff9f"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"serviceId"</span><span class="p">:</span><span class="w"> </span><span class="s2">"d6e99f4cf9df11e7a72b286ed488ff9f"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"endpoints"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w"> |
| </span><span class="s2">"rest://10.12.0.2:30100"</span><span class="w"> |
| </span><span class="p">],</span><span class="w"> |
| </span><span class="nl">"hostName"</span><span class="p">:</span><span class="w"> </span><span class="s2">"service_center_10_12_0_2"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="s2">"UP"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"healthCheck"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> |
| </span><span class="nl">"mode"</span><span class="p">:</span><span class="w"> </span><span class="s2">"push"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"interval"</span><span class="p">:</span><span class="w"> </span><span class="mi">30</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"times"</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="w"> |
| </span><span class="p">},</span><span class="w"> |
| </span><span class="nl">"timestamp"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1516012650"</span><span class="p">,</span><span class="w"> |
| </span><span class="nl">"modTimestamp"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1516012650"</span><span class="w"> |
| </span><span class="p">}</span><span class="w"> |
| </span><span class="p">]</span><span class="w"> |
| </span><span class="p">}</span><span class="w"> |
| </span></code></pre></div></div> |
| |
| <p>我们可以看到Service Center能够自动发现所有正在集群中运行的实例,<a href="https://github.com/apache/servicecomb-java-chassis">Java-Chassis SDK</a>将使用这个特性至少找到一个Service Center实例。</p> |
| |
| <p>在你的microservice.yaml中你可以填写一个或多个Service Center实例,如果<a href="https://github.com/apache/servicecomb-java-chassis">Java-Chassis SDK</a>发现配置的第一个地址(实例)失败,它将会自动使用下一个地址(实例):</p> |
| <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">servicecomb</span><span class="pi">:</span> |
| <span class="na">service</span><span class="pi">:</span> |
| <span class="na">registry</span><span class="pi">:</span> |
| <span class="na">address</span><span class="pi">:</span> <span class="s2">"</span><span class="s">http://10.12.0.1:30100,http://10.12.0.2:30100"</span> |
| <span class="na">autodiscovery</span><span class="pi">:</span> <span class="no">true</span> |
| </code></pre></div></div> |
| <p>上面的例子里包含了我们已经配置好的两个Service Center实例。</p> |
| |
| |
| </section> |
| |
| <footer class="page__meta"> |
| |
| |
| |
| |
| |
| </footer> |
| |
| |
| |
| |
| |
| </div> |
| |
| |
| </article> |
| |
| |
| |
| </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/_users/cn/setup-environment.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>© 2021 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> |
| |
| |
| |
| |
| |
| |
| |
| </body> |
| </html> |