blob: a7ff46e81435b51c552d09745b2ad876a61971b5 [file] [log] [blame]
<!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="en" class="no-js">
<head>
<meta charset="utf-8">
<!-- begin SEO -->
<title>Quick Start - Apache ServiceComb</title>
<meta name="description" content="Describe how to use mesher to merge into the servicecomb microservice system">
<meta name="author" content="">
<meta property="og:locale" content="en">
<meta property="og:site_name" content="Apache ServiceComb">
<meta property="og:title" content="Quick Start">
<link rel="canonical" href="https://github.com/pages/apache/incubator-servicecomb-website/docs/products/mesher/quick-start/">
<meta property="og:url" content="https://github.com/pages/apache/incubator-servicecomb-website/docs/products/mesher/quick-start/">
<meta property="og:description" content="Describe how to use mesher to merge into the servicecomb microservice system">
<meta name="twitter:site" content="@ServiceComb">
<meta name="twitter:title" content="Quick Start">
<meta name="twitter:description" content="Describe how to use mesher to merge into the servicecomb microservice system">
<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://www.apachecon.com/event-images/snippet.js"></script>
<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="/"><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="/">Home</a>
</li>
<li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')">
<a href="/developers/">Projects</a>
</li>
<li class="def-nav-li" onmouseenter="$('#childrenShow').css('display', 'block')">
<a href="/docs/users/">Documentation</a>
<ul id="childrenShow" class="def-children-show-en" onmouseleave="$('#childrenShow').css('display', 'none')">
<li><a href="/docs/getting-started/" class="">Getting started</a></li>
<li><a href="/docs/users/" class="">Docs</a></li>
<li><a href="/slides/" class="">Video</a></li>
<li><a href="/faqs/" class="">FAQ</a></li>
</ul>
</li>
<li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')">
<a href="/year-archive/">Blogs</a>
</li>
<li class="masthead__menu-item" onmouseenter="$('#childrenShow').css('display', 'none')">
<a href="/release/">Downloads</a>
</li>
</ul>
<button><div class="navicon"></div></button>
<ul class="hidden-links hidden"></ul>
<div class="nav-lang">
<a href=/cn/docs/products/mesher/quick-start/>中文</a>
</div>
</nav>
</div>
</div>
</div>
<div id="main" role="main">
<div class="sidebar sticky">
<div class="back-to-home"><a href="/">Home</a> > Quick Start</div>
<nav class="nav__list">
<input id="ac-toc" name="accordion-toc" type="checkbox" />
<label for="ac-toc">Toggle Menu</label>
<ul class="nav__items">
<li>
<a href="/docs/getting-started/"><span class="nav__sub-title nav__sub-title-with-url">Getting Started</span></a>
</li>
<li>
<a href="/docs/introduction/"><span class="nav__sub-title nav__sub-title-with-url">Introduction</span></a>
</li>
<li>
<span class="nav__sub-title">Service Center</span>
<ul>
<li><a href="/docs/products/service-center/install/" class="">Install</a></li>
<li><a href="/docs/products/service-center/registration-discovery/" class="">Registration&Discovery</a></li>
</ul>
</li>
<li>
<span class="nav__sub-title">Java Chassis</span>
<ul>
<li><a href="/docs/products/java-chassis/quick-start/" class="">getting started</a></li>
<li><a href="/docs/products/java-chassis/bmi/" class="">Develop microservice application in minutes</a></li>
<li><a href="/docs/products/java-chassis/advance/" class="">Advance microservice development</a></li>
<li><a href="/docs/products/java-chassis/load-balance/" class="">Load Balance</a></li>
<li><a href="/docs/products/java-chassis/flow-control/" class="">Flow Control</a></li>
<li><a href="/docs/products/java-chassis/service-management/" class="">Service Management</a></li>
<li><a href="/docs/products/java-chassis/distributed-tracing/" class="">Distributed Tracing</a></li>
</ul>
</li>
<li>
<span class="nav__sub-title">Mesher</span>
<ul>
<li><a href="/docs/products/mesher/quick-start/" class="active">getting started</a></li>
<li><a href="/docs/products/mesher/advance/" class="">mesher Advance</a></li>
<li><a href="/docs/products/mesher/load-balance/" class="">mesher balance</a></li>
<li><a href="/docs/products/mesher/flow-control/" class="">mesher Flow Control</a></li>
<li><a href="/docs/products/mesher/service-management/" class="">mesher Service Management</a></li>
<li><a href="/docs/products/mesher/distributed-tracing/" class="">mesher Distributed Tracing</a></li>
</ul>
</li>
<li>
<span class="nav__sub-title">Toolkit</span>
<ul>
<li><a href="/docs/products/toolkit/quick-start/" class="">Quick Start</a></li>
<li><a href="/docs/products/toolkit/oas-validator/" class="">OpenAPI V3 Spec validation tools</a></li>
</ul>
</li>
<li>
<span class="nav__sub-title">Syncer</span>
<ul>
<li><a href="/docs/products/syncer/quick-start/" class="">Quick Start</a></li>
<li><a href="/docs/products/syncer/multi-servicecenters/" class="">Different service centers communicate with each other</a></li>
</ul>
</li>
</ul>
</nav>
</div>
<article class="page" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="headline" content="Quick Start">
<meta itemprop="description" content="Describe how to use mesher to merge into the servicecomb microservice system">
<meta itemprop="dateModified" content="August 08, 2019">
<div class="page__inner-wrap">
<header>
<h1 class="page__title" itemprop="headline">Quick Start
</h1>
</header>
<section class="page__content" itemprop="text">
<h1 id="install-development-environment">Install development environment</h1>
<ul>
<li>
<p>Install <strong>git</strong>. Get details <a href="https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git" target="_blank">git Installation tutorial</a>.</p>
</li>
<li>
<p>Install <strong>golang 1.12.7</strong>. Get details <a href="https://golang.google.cn/doc/install" target="_blank">Go Installation tutorial</a>.</p>
</li>
<li>
<p>Install <strong>python 2.7</strong>. Get details <a href="https://wiki.python.org/moin/BeginnersGuide/Download" target="_blank">python Installation tutorial</a>.</p>
</li>
<li>
<p>Install <strong>nodejs v10.16.2</strong>. Get details <a href="https://nodejs.org/en/download/" target="_blank">nodejs download</a>。</p>
</li>
</ul>
<h1 id="run-service-center">Run Service Center</h1>
<p>In the <strong>ServiceComb</strong> microservices framework, <strong>Service Center</strong> provides service registration and service discovery.</p>
<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><em>Reference to <a href="/docs/products/service-center/install/#run-with-release-package">service center install</a> to learn deploying Service Center and front as a local binary.</em></p>
<h1 id="use-mesher-to-merge-into-the-servicecomb-microservice-system">Use mesher to merge into the servicecomb microservice system</h1>
<h2 id="background">Background</h2>
<ul>
<li>This use case is mainly to help users get started quickly with <strong>mesher sidecar</strong> mode. We hope that users can understand the working mode of mesher and learn how to merge the existing http service into the ServiceComb micro-service system with mesher. The final goal is to help user get the micro-service capabilities such as load balancing, flow control, service management and call chain tracing provided by servicecomb. The full case will be submitted to <a href="https://github.com/apache/servicecomb-mesher/tree/master/examples/quick_start">Case Download</a>.</li>
</ul>
<h2 id="mesher-use-case-service-introduction">mesher use case service introduction</h2>
<ul>
<li>1 <strong>httpserver_calculator</strong>. A http server based on python which is for BMI calculator and can be developed by any language.</li>
<li>2 <strong>httpserver_webapp</strong>. A http server based on nodejs which is used for displaying results on the browser.</li>
<li>3 <strong>mesher_webapp</strong>. A mesher instance which serves for httpserver_webapp via sidecar mode.</li>
<li>4 <strong>mesher_calculator</strong>. A mesher instance which serves for httpserver_calculator via sidecar mode.</li>
<li>5 <strong>servicecenter</strong>. Servicecenter which receives registration of mesher service and provides services as service discovery, routing query, service monitoring and so on.</li>
</ul>
<p><img src="/assets/images/mesher/mesher-deployment-simple.png" alt="mesher deployment diagram" /></p>
<h2 id="process-details">Process details</h2>
<ul>
<li>1 The browser[192.168.88.78] execute a http call to the <strong>httpserver_webapp</strong> service with url <a href=""></a><a href="http://192.168.88.64:4597/calculator/bmi">http://192.168.88.64:4597/calculator/bmi</a>.</li>
<li>2 The httpserver_webapp service receives the request and execute http call <a href=""></a><a href="http://calculator/bmi">http://calculator/bmi</a>. Because the proxy is set as <a href=""></a><a href="http://127.0.0.1:30101">http://127.0.0.1:30101</a>, the request initiated by <strong>httpserver_webapp</strong> will be forwarded to the <strong>mesher_webapp</strong> service.</li>
<li>3 <strong>mesher_webapp</strong> gets the address of the service name(the service name <strong>calculator</strong> here is configured in microservice.yaml) from the <strong>servicecenter</strong> and forwarded to <strong>mesher_calculator</strong>.</li>
<li>4 <strong>mesher_calculator</strong> service forward http requests to the <strong>httpserver_calculator</strong> service.</li>
<li>
<p>5 <strong>httpserver_calculator</strong> will calculate according to the input parameters(height and weight). The result containing service id and body mass index will be displayed on the browser. The flow chart is as follows:</p>
<p><img src="/assets/images/mesher/mesher-flowchart-simple.png" alt="mesher-flow-chart" /></p>
</li>
</ul>
<h2 id="environmental-construction">Environmental construction</h2>
<ul>
<li>
<p>1 Compile <strong>mesher</strong> <a href="https://github.com/apache/servicecomb-mesher">download</a>. Download the project and get the executable mesher(linux) or mesher.exe(windows) by README.md.</p>
</li>
<li>
<p>2 Create <strong>mesher_webapp</strong> which serves for <strong>httpserver_webapp</strong>. In the mesher directory execute the following linux command to create mesher_webapp. In order to the run mesher you also need to copy the conf.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> /usr/local/src/mesher_webapp
<span class="nb">cp</span> ./mesher /usr/local/src/mesher_webapp
<span class="nb">cp</span> <span class="nt">-r</span> ./conf /usr/local/src/mesher_webapp
</code></pre></div> </div>
<p>Change <strong>service name</strong> in microservice.yaml from hellemesher to <strong>webapp</strong>. Change the listening service address in chassis.yaml from 127.0.0.1 to <strong>intranet ip</strong>(Viewed by cmd ifconfig in linux, such as 192.168.88.64).</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>listenAddress: 127.0.0.1:40101 <span class="nt">-----</span>》 listenAddress: 192.168.88.64:40101
listenAddress: 127.0.0.1:30101 <span class="nt">-----</span>》 listenAddress: 192.168.88.64:30101
listenAddress: 127.0.0.1:30102 <span class="nt">-----</span>》 listenAddress: 192.168.88.64:30102
</code></pre></div> </div>
</li>
<li>
<p>3 Create mesher_calculator service.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir</span> /usr/local/src/mesher_calculator
<span class="nb">cp</span> ./mesher /usr/local/src/mesher_calculator
<span class="nb">cp</span> <span class="nt">-r</span> ./conf /usr/local/src/mesher_calculator
</code></pre></div> </div>
<p>Change the <strong>service name</strong> in conf file <strong>microservice.yaml</strong> from hellemesher to <strong>calculator</strong>.<br />
Change the listening address and port in conf file <strong>chassis.yaml</strong>.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>listenAddress: 127.0.0.1:40101 <span class="nt">-----</span>》 listenAddress: 192.168.88.64:40107
listenAddress: 127.0.0.1:30101 <span class="nt">-----</span>》 listenAddress: 192.168.88.64:30111
listenAddress: 127.0.0.1:30102 <span class="nt">-----</span>》 listenAddress: 192.168.88.64:30112
</code></pre></div> </div>
</li>
<li>
<p>4 Run mesher_webapp and mesher_calculator respectively by cmd.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd</span> /usr/local/src/mesher_calculator
<span class="nb">export </span><span class="nv">SPECIFIC_ADDR</span><span class="o">=</span>127.0.0.1:4540
./mesher
</code></pre></div> </div>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd</span> /usr/local/src/mesher_webapp
./mesher
</code></pre></div> </div>
</li>
<li>
<p>5 Run <strong>httpserver_webapp</strong>.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd</span> /usr/local/src/httpserver_webapp
npm <span class="nb">install
export </span><span class="nv">http_proxy</span><span class="o">=</span>http://127.0.0.1:30101
node ./httpserver_webapp.js
</code></pre></div> </div>
</li>
<li>
<p>6 Run <strong>httpserver_calculator</strong> program as BMI calculator. You need to install python2.7 and this service relies on package BaseHTTPServer.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd</span> /usr/local/src/httpserver_calculator
./httpserver_calculator.py
</code></pre></div> </div>
</li>
</ul>
<h2 id="start-testing">Start testing</h2>
<ul>
<li>
<p>1 Open url <a href="http://192.168.88.64:30103">http://192.168.88.64:30103</a> in browser(You need to start the front service of the service-center. Referring <a href="http://servicecomb.apache.org/docs/service-center/install/#run-with-release-package">http://servicecomb.apache.org/docs/service-center/install/#run-with-release-package</a>). You can see services information in web. The name <strong>webapp</strong> represents the <strong>mesher_webapp</strong> which is the service name configured in microservice.yaml. The name <strong>calculator</strong> represents the <strong>mesher_calculator</strong> which is the service name configured in microservice.yaml. <strong>SERVICECENTER</strong> represents the <strong>servicecenter</strong>.</p>
<p><img src="/assets/images/mesher/mesher-servercenter.png" alt="Service-center-monitoring" /></p>
</li>
<li>
<p>2 Open <a href="http://192.168.88.64:4597">http://192.168.88.64:4597</a> in browser and you can see the following interface.</p>
<p><img src="/assets/images/mesher/mesher-testinit.png" alt="mesher_calculatormi-test" /></p>
</li>
<li>
<p>3 Enter the parameters (180, 70) and click submit.</p>
<p><img src="/assets/images/mesher/mesher-testpythonhttp.png" alt="mesher-testhttp" /></p>
</li>
</ul>
<h1 id="whats-next">What’s next</h1>
<ul>
<li>Read <a href="/docs/products/mesher/advance/">mesher quick start advance</a></li>
</ul>
</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">Events</p>
<a class="acevent" data-format="square" data-mode="dark" data-event="random"></a>
</ul>
</div>
<div class="col">
<ul>
<p class="header">Resources</p>
<li><a href="/docs/getting-started/">Getting started</a></li>
<li><a href="/docs/users/">User Guide</a></li>
<li><a href="/slides/">Slides</a></li>
<li><a href="/users/faq/">Common Questions</a></li>
</ul>
</div>
<div class="col">
<ul>
<p class="header">ASF</p>
<li><a href="http://www.apache.org">Foundation</a></li>
<li><a href="http://www.apache.org/licenses/">License</a></li>
<li><a href="http://www.apache.org/events/current-event">Events</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
</ul>
</div>
<div class="col">
<ul>
<p class="header">Contribute</p>
<li><a href="http://issues.apache.org/jira/browse/SCB">Report a Doc Issue</a></li>
<li><a href="https://github.com/apache/servicecomb-website/edit/master/_docs/products/mesher/quick-start.md">Edit This Page on Github</a></li>
<li><a href="/developers/submit-codes/">Code Submit Guide</a></li>
<li><a href="/security">Security</a></li>
</ul>
</div>
<div class="col">
<ul class="social-icons">
<p class="header">Community</p>
<li>
<a href="mailto:dev-subscribe@servicecomb.incubator.apache.org" rel="nofollow"><span class="mail">Mailing List</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>&copy; 2024 Apache ServiceComb. Powered by <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> &amp; <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>