forked from docs/doc-exports
Reviewed-by: Hajba, László Antal <laszlo-antal.hajba@t-systems.com> Co-authored-by: zhoumeng <zhoumeng35@huawei.com> Co-committed-by: zhoumeng <zhoumeng35@huawei.com>
217 lines
46 KiB
HTML
217 lines
46 KiB
HTML
<a name="elb_qs_0003"></a><a name="elb_qs_0003"></a>
|
|
|
|
<h1 class="topictitle1">Using Dedicated Load Balancers (Advanced Level)</h1>
|
|
<div id="body0000001080005612"><div class="section" id="elb_qs_0003__section18950295143553"><h4 class="sectiontitle">Scenarios</h4><p id="elb_qs_0003__p13318235811">You have two web applications that are deployed on separated ECSs but use the same domain name for access. You can set different URLs to process requests.</p>
|
|
<p id="elb_qs_0003__p14697175632114">To forward requests based on URLs, you need to create a load balancer, add an HTTP or HTTPS listener, and add forwarding policies to specify the URLs.</p>
|
|
<p id="elb_qs_0003__p66625093192530">An HTTP listener is used as an example to describe how to route requests from two URLs (<strong id="elb_qs_0003__b14506131414206">/ELB01</strong> and <strong id="elb_qs_0003__b1050771415200">/ELB02</strong>) of the same domain name (www.example.com) to different backend servers.</p>
|
|
</div>
|
|
<div class="section" id="elb_qs_0003__section3453061616119"><h4 class="sectiontitle">Prerequisites</h4><ul id="elb_qs_0003__ul15892133835819"><li id="elb_qs_0003__li169934443213">You have added security group rules to allow traffic from the ports used by the two ECSs. (Alternatively, you can enable all ports first and then disable the ports that are no longer used after service deployment.)</li><li id="elb_qs_0003__li16288402223">You have verified that the security group containing the ECSs allows access traffic from the VPC where the load balancer works and that the health check function is normal.<div class="note" id="elb_qs_0003__note2297145295010"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="elb_qs_0003__en-us_topic_0000001126827555_p1297043018186">If <strong id="elb_qs_0003__b1548161216271">IP as a Backend</strong> is not enabled for a dedicated load balancer that has a TCP or UDP listener, there is no need to configure security group rules to allow traffic from the VPC where the load balancer backend subnet works to the backend servers.</p>
|
|
</div></div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="elb_qs_0003__section29839590578"><h4 class="sectiontitle">Creating ECSs</h4><p id="elb_qs_0003__en-us_topic_0166358908_p17398174135812">ECSs are used as backend servers.</p>
|
|
<p id="elb_qs_0003__en-us_topic_0166358908_p1323855715215">Each ECS needs an EIP for accessing the Internet and configuring the application on the ECS.</p>
|
|
</div>
|
|
<ol id="elb_qs_0003__ol09857595579"><li id="elb_qs_0003__en-us_topic_0166358908_li18503134213513">Log in to the management console.</li><li id="elb_qs_0003__en-us_topic_0166358908_li1658495082510">In the upper left corner of the page, click <span><img id="elb_qs_0003__image92319195613" src="en-us_image_0000001747739624.png"></span> and select the desired region and project.</li><li id="elb_qs_0003__en-us_topic_0166358908_li1561583452013">Click <span><img id="elb_qs_0003__image191851623534759" src="en-us_image_0000001747380972.png"></span> in the upper left corner to display <strong id="elb_qs_0003__b143191738434759">Service List</strong> and choose <strong id="elb_qs_0003__b41717250434759">Computing</strong> > <strong id="elb_qs_0003__b39863341034759">Elastic Cloud Server</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li12985204673513"><p id="elb_qs_0003__en-us_topic_0166358908_p09941142915"><a name="elb_qs_0003__en-us_topic_0166358908_li12985204673513"></a><a name="en-us_topic_0166358908_li12985204673513"></a>Click <strong id="elb_qs_0003__b118581471934759">Create ECS</strong>, configure the parameters, and click <strong id="elb_qs_0003__b66343763334759">Create Now</strong>.</p>
|
|
<p id="elb_qs_0003__en-us_topic_0166358908_p1745011147553"></p>
|
|
<div class="p" id="elb_qs_0003__en-us_topic_0166358908_p1745013149557">The following table lists the specifications of the two ECSs.
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="elb_qs_0003__en-us_topic_0166358908_table169305003620" frame="border" border="1" rules="all"><caption><b>Table 1 </b>ECS specifications</caption><thead align="left"><tr id="elb_qs_0003__en-us_topic_0166358908_row1926804361"><th align="left" class="cellrowborder" valign="top" width="46.949999999999996%" id="mcps1.3.4.4.3.1.2.3.1.1"><p id="elb_qs_0003__en-us_topic_0166358908_p1892518019366"><strong id="elb_qs_0003__b176927738034759">Item</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="53.05%" id="mcps1.3.4.4.3.1.2.3.1.2"><p id="elb_qs_0003__en-us_topic_0166358908_p992515013615"><strong id="elb_qs_0003__b142702762634759">Example Value</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="elb_qs_0003__en-us_topic_0166358908_row1592617014367"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.4.4.3.1.2.3.1.1 "><p id="elb_qs_0003__en-us_topic_0166358908_p6926904361">Name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.4.4.3.1.2.3.1.2 "><p id="elb_qs_0003__en-us_topic_0166358908_p11926180193617">ECS01 and ECS02</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0003__en-us_topic_0166358908_row1692618015368"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.4.4.3.1.2.3.1.1 "><p id="elb_qs_0003__en-us_topic_0166358908_p99262003618">OS</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.4.4.3.1.2.3.1.2 "><p id="elb_qs_0003__en-us_topic_0166358908_p4926180103613">CentOS 7.2 64bit</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0003__en-us_topic_0166358908_row192710163612"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.4.4.3.1.2.3.1.1 "><p id="elb_qs_0003__en-us_topic_0166358908_p892618033614">vCPUs</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.4.4.3.1.2.3.1.2 "><p id="elb_qs_0003__en-us_topic_0166358908_p5927180103614">2</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0003__en-us_topic_0166358908_row1592812043617"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.4.4.3.1.2.3.1.1 "><p id="elb_qs_0003__en-us_topic_0166358908_p129271407366">Memory</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.4.4.3.1.2.3.1.2 "><p id="elb_qs_0003__en-us_topic_0166358908_p9927301368">4 GiB</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0003__en-us_topic_0166358908_row392816093610"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.4.4.3.1.2.3.1.1 "><p id="elb_qs_0003__en-us_topic_0166358908_p139281709369">System disk</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.4.4.3.1.2.3.1.2 "><p id="elb_qs_0003__en-us_topic_0166358908_p199287015363">40 GiB</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0003__en-us_topic_0166358908_row159291018368"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.4.4.3.1.2.3.1.1 "><p id="elb_qs_0003__en-us_topic_0166358908_p1992870163612">Data disk</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.4.4.3.1.2.3.1.2 "><p id="elb_qs_0003__en-us_topic_0166358908_p3929207369">100 GiB</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0003__en-us_topic_0166358908_row2092917063616"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.4.4.3.1.2.3.1.1 "><p id="elb_qs_0003__en-us_topic_0166358908_p13929906362">Bandwidth</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.4.4.3.1.2.3.1.2 "><p id="elb_qs_0003__en-us_topic_0166358908_p1892918013619">5 Mbit/s</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li98881217183519">Submit your request.</li></ol>
|
|
<div class="section" id="elb_qs_0003__section12375217165718"><h4 class="sectiontitle">Deploying the Application</h4><p id="elb_qs_0003__en-us_topic_0166358908_p19652191111417">Deploy Nginx on the two ECSs and edit two HTML pages so that a page with message "Welcome to ELB test page one!" is returned when ECS01 is accessed, and the other page with message "Welcome to ELB test page two!" is returned when ECS02 is accessed.</p>
|
|
<ol id="elb_qs_0003__en-us_topic_0166358908_ol1137531718571"><li id="elb_qs_0003__en-us_topic_0166358908_li7185175234820">Log in to the ECSs.</li><li id="elb_qs_0003__en-us_topic_0166358908_li417184819279">Install and start Nginx.<ol type="a" id="elb_qs_0003__en-us_topic_0166358908_ol38581142815"><li id="elb_qs_0003__en-us_topic_0166358908_li12862142143913">Run the <strong id="elb_qs_0003__b142024587234759">wget</strong> command to download the Nginx installation package for your operating system in use. CentOS 7.6 is used as an example here.<pre class="screen" id="elb_qs_0003__en-us_topic_0166358908_screen74712157217">wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm</pre>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li259319516119">Run the following command to create the Nginx yum repository: CentOS 7.6 is used as an example here.<pre class="screen" id="elb_qs_0003__en-us_topic_0166358908_screen1528319398215">rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm</pre>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li1142112271116">Run the following command to install Nginx:<pre class="screen" id="elb_qs_0003__en-us_topic_0166358908_screen9609175010218">yum -y install nginx</pre>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li197081130018">Run the following commands to start Nginx and configure automatic Nginx enabling upon ECS startup:<pre class="screen" id="elb_qs_0003__en-us_topic_0166358908_screen175165111635">systemctl start nginx
|
|
systemctl enable nginx</pre>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li10124171615285">Enter <strong id="elb_qs_0003__b122770532034759">http://</strong><em id="elb_qs_0003__i46464985934759">EIP bound to the ECS</em> in the address box of your browser. If the following page is displayed, Nginx has been installed.<div class="fignone" id="elb_qs_0003__en-us_topic_0166358908_fig137471211561"><span class="figcap"><b>Figure 1 </b>Nginx installed successfully</span><br><span><img id="elb_qs_0003__en-us_topic_0166358908_image1074715213563" src="en-us_image_0000001747739872.png"></span></div>
|
|
</li></ol>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li5437706117">Modify the HTML page of ECS01.<div class="p" id="elb_qs_0003__en-us_topic_0166358908_p1751133519291"><a name="elb_qs_0003__en-us_topic_0166358908_li5437706117"></a><a name="en-us_topic_0166358908_li5437706117"></a>Move the <strong id="elb_qs_0003__b6657887334759">index.html</strong> file from the default root directory of Nginx <strong id="elb_qs_0003__b141411221134759">/usr/share/nginx/html</strong> to the <strong id="elb_qs_0003__b5090868034759">ELB01</strong> directory and modify the file to identify access to ECS01.<ol type="a" id="elb_qs_0003__en-us_topic_0166358908_ol17991841818"><li id="elb_qs_0003__en-us_topic_0166358908_li73061128217">Create the <strong id="elb_qs_0003__b173081275934759">ELB01</strong> directory and copy the <strong id="elb_qs_0003__b151720032634759">index.html</strong> file to this directory:<p id="elb_qs_0003__en-us_topic_0166358908_p173003321518"><strong id="elb_qs_0003__en-us_topic_0166358908_b110913141263">mkdir /usr/share/nginx/html/ELB01</strong></p>
|
|
<p id="elb_qs_0003__en-us_topic_0166358908_p1130613127218"><strong id="elb_qs_0003__en-us_topic_0166358908_b1770484313713">cp <strong id="elb_qs_0003__en-us_topic_0166358908_b983391711810">/usr/share/nginx/html/</strong>index.html /usr/share/nginx/html/ELB01</strong>/</p>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li43715036155356">Open the <strong id="elb_qs_0003__b37166162034759">index.html</strong> file.<p id="elb_qs_0003__en-us_topic_0166358908_p57891004155356"><strong id="elb_qs_0003__en-us_topic_0166358908_b1282164811124">vim /usr/share/nginx/html<strong id="elb_qs_0003__en-us_topic_0166358908_b445614535191">/ELB01</strong>/index.html</strong></p>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li58659743155356">Press <strong id="elb_qs_0003__en-us_topic_0166358908_b58175644155356">i</strong> to enter editing mode.</li><li id="elb_qs_0003__en-us_topic_0166358908_li53818751155356">Modify the <strong id="elb_qs_0003__b37991776534759">index.html</strong> file.<div class="p" id="elb_qs_0003__en-us_topic_0166358908_p1092212610131">The following is the content to be modified:<pre class="screen" id="elb_qs_0003__en-us_topic_0166358908_screen42293086155356"> ...
|
|
<body>
|
|
<h1>Welcome to <strong>ELB</strong> test page one!</h1>
|
|
|
|
<div class="content">
|
|
<p>This page is used to test the <strong>ELB</strong>!</p>
|
|
|
|
<div class="alert">
|
|
<h2>ELB01</h2>
|
|
<div class="content">
|
|
<p><strong>ELB test (page one)!</strong></p>
|
|
<p><strong>ELB test (page one)!</strong></p>
|
|
<p><strong>ELB test (page one)!</strong></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body></pre>
|
|
</div>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li5284577155356">Press <strong id="elb_qs_0003__b118965941834759">Esc</strong> to exit editing mode. Then, enter <strong id="elb_qs_0003__b64474163734759">:wq</strong> to save the settings and exit the file.</li></ol>
|
|
</div>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li0811151216197">Modify the HTML page of ECS02.<div class="p" id="elb_qs_0003__en-us_topic_0166358908_p98116128199"><a name="elb_qs_0003__en-us_topic_0166358908_li0811151216197"></a><a name="en-us_topic_0166358908_li0811151216197"></a>Move the <strong id="elb_qs_0003__b17133533834759">index.html</strong> file from the default root directory of Nginx <strong id="elb_qs_0003__b178913068734759">/usr/share/nginx/html</strong> to the <strong id="elb_qs_0003__b9239396334759">ELB02</strong> directory and modify the file to identify access to ECS02.<ol type="a" id="elb_qs_0003__en-us_topic_0166358908_ol78111712121918"><li id="elb_qs_0003__en-us_topic_0166358908_li981115126194">Create the <strong id="elb_qs_0003__b8748241534759">ELB02</strong> directory and copy the <strong id="elb_qs_0003__b102704159034759">index.html</strong> file to this directory:<p id="elb_qs_0003__en-us_topic_0166358908_p68111412151912"><strong id="elb_qs_0003__en-us_topic_0166358908_b88113123191">mkdir /usr/share/nginx/html/ELB02</strong></p>
|
|
<p id="elb_qs_0003__en-us_topic_0166358908_p4811212191917"><strong id="elb_qs_0003__en-us_topic_0166358908_b3812912161910">cp <strong id="elb_qs_0003__en-us_topic_0166358908_b16812171217192">/usr/share/nginx/html/</strong>index.html /usr/share/nginx/html/ELB02</strong>/</p>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li6812121219197">Open the <strong id="elb_qs_0003__b195334109134759">index.html</strong> file.<p id="elb_qs_0003__en-us_topic_0166358908_p1881241241910"><strong id="elb_qs_0003__en-us_topic_0166358908_b17812212181915">vim /usr/share/nginx/html<strong id="elb_qs_0003__en-us_topic_0166358908_b1794479197">/ELB02</strong>/index.html</strong></p>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li1812121217199">Press <strong id="elb_qs_0003__en-us_topic_0166358908_b581213121197">i</strong> to enter editing mode.</li><li id="elb_qs_0003__en-us_topic_0166358908_li12812912161915">Modify the <strong id="elb_qs_0003__b166732217134759">index.html</strong> file.<p id="elb_qs_0003__en-us_topic_0166358908_p981221211917">The following is the content to be modified:</p>
|
|
<pre class="screen" id="elb_qs_0003__en-us_topic_0166358908_screen074901414420">...
|
|
<body>
|
|
<h1>Welcome to <strong>ELB</strong> test page two!</h1>
|
|
|
|
<div class="content">
|
|
<p>This page is used to test the <strong>ELB</strong>!</p>
|
|
|
|
<div class="alert">
|
|
<h2>ELB02</h2>
|
|
<div class="content">
|
|
<p><strong>ELB test (page two)!</strong></p>
|
|
<p><strong>ELB test (page two)!</strong></p>
|
|
<p><strong>ELB test (page two)!</strong></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body></pre>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li1431755212157">Press <strong id="elb_qs_0003__b193784306034759">Esc</strong> to exit editing mode. Then, enter <strong id="elb_qs_0003__b134054897134759">:wq</strong> to save the settings and exit the file.</li></ol>
|
|
</div>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li187810381119">Use your browser to access <strong id="elb_qs_0003__b131369660334759">http://</strong><em id="elb_qs_0003__i161851480434759">ECS01 EIP</em><strong id="elb_qs_0003__b122331775234759">/ELB01/</strong> and <strong id="elb_qs_0003__b45562416734759">http://</strong><em id="elb_qs_0003__i105034199434759">ECS02 EIP</em><strong id="elb_qs_0003__b44231219034759">/ELB02/</strong> to verify that Nginx has been deployed.<p id="elb_qs_0003__en-us_topic_0166358908_p12966153132218">If the modified HTML pages are displayed, Nginx has been deployed.</p>
|
|
<ul id="elb_qs_0003__en-us_topic_0166358908_ul117591613242"><li id="elb_qs_0003__en-us_topic_0166358908_li1275991102411">HTML page of ECS01<div class="fignone" id="elb_qs_0003__en-us_topic_0166358908_fig1823119513251"><span class="figcap"><b>Figure 2 </b>Nginx successfully deployed on ECS01</span><br><span><img id="elb_qs_0003__en-us_topic_0166358908_image162241919366" src="en-us_image_0000001747380964.png"></span></div>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li1049422182416">HTML page of ECS02<div class="fignone" id="elb_qs_0003__en-us_topic_0166358908_fig17457132212516"><span class="figcap"><b>Figure 3 </b>Nginx successfully deployed on ECS02</span><br><span><img id="elb_qs_0003__en-us_topic_0166358908_image122741811610" src="en-us_image_0000001794660689.png"></span></div>
|
|
</li></ul>
|
|
</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0003__section15436447172917"><h4 class="sectiontitle">Creating a Load Balancer</h4><p id="elb_qs_0003__p229893917615">Each ECS needs an EIP for accessing the Internet and configuring the application on the ECS. The load balancer needs an EIP to access the application deployed on the ECSs over the Internet. You can determine whether to bind an EIP to the load balancer based on your requirements. For details, see <a href="elb_pro_01_0004.html">Load Balancing on a Public or Private Network</a>.</p>
|
|
<ol id="elb_qs_0003__ol353744134512"><li id="elb_qs_0003__li1131682861711">In the upper left corner of the page, click <span><img id="elb_qs_0003__image258891312332" src="en-us_image_0000001747739624.png"></span> and select the desired region and project.</li><li id="elb_qs_0003__li17301740102218">Click <span><img id="elb_qs_0003__image42795691334759" src="en-us_image_0000001794660485.png"></span> in the upper left corner to display <strong id="elb_qs_0003__b165511356234759">Service List</strong> and choose <strong id="elb_qs_0003__b97020447334759">Network</strong> > <strong id="elb_qs_0003__b32510415734759">Elastic Load Balancing</strong>. </li><li id="elb_qs_0003__li59220156440">Click <strong id="elb_qs_0003__b16789101818419">Create Elastic Load Balancer</strong> and then configure the parameters.</li><li id="elb_qs_0003__li18940143983112">Click <strong id="elb_qs_0003__b105180856134759">Create Now</strong>.</li><li id="elb_qs_0003__li9984122593614">Confirm the configuration and submit your request.</li><li id="elb_qs_0003__li15984202593610">View the newly created load balancer in the load balancer list.</li></ol>
|
|
<div class="note" id="elb_qs_0003__note171711554395"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="elb_qs_0003__en-us_topic_0000001126827555_p817755163912">After you create a dedicated load balancer, configure the security group that contains the ECSs to allow traffic from the VPC where the load balancer works.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="elb_qs_0003__section26032025134916"><h4 class="sectiontitle">Configuring Security Group Rules</h4><ol id="elb_qs_0003__en-us_topic_0000001125381517_ol198141563813"><li id="elb_qs_0003__en-us_topic_0000001125381517_li677391520332">Log in to the management console.</li><li id="elb_qs_0003__en-us_topic_0000001125381517_li675519100420">In the upper left corner of the page, click <span><img id="elb_qs_0003__image741139113310" src="en-us_image_0000001747739624.png"></span> and select the desired region and project.</li><li id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0029320966_li50026016224047">Click <span><img id="elb_qs_0003__image36431824122715" src="en-us_image_0000001747380972.png"></span> in the upper left corner to display <strong id="elb_qs_0003__b10643162410273">Service List</strong> and choose <strong id="elb_qs_0003__b3643192412710">Computing</strong> > <strong id="elb_qs_0003__b364392413274">Elastic Cloud Server</strong>.</li><li id="elb_qs_0003__en-us_topic_0000001125381517_li34401539214315">On the <strong id="elb_qs_0003__b17347154465018">Elastic Cloud Server</strong> page, click the name of the ECS that has been added to a backend server group.<p id="elb_qs_0003__en-us_topic_0000001125381517_p19982029214319">The page providing details about the ECS is displayed.</p>
|
|
</li><li id="elb_qs_0003__en-us_topic_0000001125381517_li18750165432511">Click <strong id="elb_qs_0003__b108230856434759">Security Groups</strong>, locate the security group, and view security group rules.</li><li id="elb_qs_0003__en-us_topic_0000001125381517_li45534692214355">Click the security group rule ID or <strong id="elb_qs_0003__b169392652634759">Modify Security Group Rule</strong>. The security group details page is displayed.</li><li id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001390784280_en-us_topic_0029320966_li46525942225810">On the<strong id="elb_qs_0003__b112255653734759"> Inbound Rules</strong> tab page, click <strong id="elb_qs_0003__b144562385134759">Add Rule</strong>. Configure an inbound rule based on <a href="#elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_table22703095416">Table 2</a>.
|
|
<div class="tablenoborder"><a name="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_table22703095416"></a><a name="en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_table22703095416"></a><table cellpadding="4" cellspacing="0" summary="" id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_table22703095416" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Security group rules</caption><thead align="left"><tr id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row102813095415"><th align="left" class="cellrowborder" valign="top" width="22.95%" id="mcps1.3.7.2.7.4.2.5.1.1"><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p428103020541">Backend Protocol</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="22.68%" id="mcps1.3.7.2.7.4.2.5.1.2"><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p4283307544">Policy</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="29.37%" id="mcps1.3.7.2.7.4.2.5.1.3"><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p92883085412">Protocol & Port</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.7.2.7.4.2.5.1.4"><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p82816307548">Source IP Address</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row1328173035411"><td class="cellrowborder" valign="top" width="22.95%" headers="mcps1.3.7.2.7.4.2.5.1.1 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p728193015410">HTTP or HTTPS</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.68%" headers="mcps1.3.7.2.7.4.2.5.1.2 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1728113025413">Allow</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="29.37%" headers="mcps1.3.7.2.7.4.2.5.1.3 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p14281430155413"><strong id="elb_qs_0003__b187910197834759">Protocol</strong>: TCP</p>
|
|
<p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1499745325519"><strong id="elb_qs_0003__b18339183519719">Port</strong>: the port used by the backend server and health check port</p>
|
|
</td>
|
|
<td class="cellrowborder" rowspan="3" valign="top" width="25%" headers="mcps1.3.7.2.7.4.2.5.1.4 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p42853012545">Backend subnet of the load balancer</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row51717597200"><td class="cellrowborder" valign="top" headers="mcps1.3.7.2.7.4.2.5.1.1 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1518135920204">TCP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.7.2.7.4.2.5.1.2 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p7371172212119">Allow</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.7.2.7.4.2.5.1.3 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1268123713211"><strong id="elb_qs_0003__b35169455034759">Protocol</strong>: TCP</p>
|
|
<p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p36815374217"><strong id="elb_qs_0003__b107749123634759">Port</strong>: health check port</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row1928113012544"><td class="cellrowborder" valign="top" headers="mcps1.3.7.2.7.4.2.5.1.1 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p32812305543">UDP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.7.2.7.4.2.5.1.2 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p20399113617560">Allow</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.7.2.7.4.2.5.1.3 "><p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p828193011543"><strong id="elb_qs_0003__b173257728434759">Protocol</strong>: UDP and ICMP</p>
|
|
<p id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1820894010565"><strong id="elb_qs_0003__b153877768834759">Port</strong>: health check port</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="note" id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_note114001815510"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_ul123781623163110"><li id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_li0378102317311">After a load balancer is created, do not change the subnet. If the subnet is changed, the IP addresses occupied by the load balancer will not be released, and traffic from the previous backend subnet is still need to be allowed to backend servers.</li><li id="elb_qs_0003__en-us_topic_0000001125381517_en-us_topic_0000001420502298_li19629154814421">Traffic from the new backend subnet is also need to be allowed to backend servers.</li></ul>
|
|
</div></div>
|
|
</li><li id="elb_qs_0003__en-us_topic_0000001125381517_li1030715242413">Click <strong id="elb_qs_0003__b73532077534759">OK</strong>.</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0003__section1261104918577"><h4 class="sectiontitle">Firewall Rules</h4><p id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_p3997193819710">To control traffic in and out of a subnet, you can associate a firewall with the subnet. Firewalls rules control access to subnets and add an additional layer of defense to your subnets. Default <span id="elb_qs_0003__ph545213916372">firewall</span> rules reject all inbound and outbound traffic. If the subnet of a load balancer or associated backend servers has a <span id="elb_qs_0003__ph14546913711">firewall</span> associated, the load balancer cannot receive traffic from the Internet or route traffic to backend servers, and backend servers cannot receive traffic from and respond to the load balancer.</p>
|
|
<p id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_p79433211595">Configure an inbound firewall rule to allow traffic from the VPC where the load balancer resides to backend servers.</p>
|
|
<ol id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_ol17965143881417"><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li20860192818532">Log in to the management console.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li1486022812537">In the upper left corner of the page, click <span><img id="elb_qs_0003__image94944575534759" src="en-us_image_0000001747739624.png"></span> and select the desired region and project.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li59941052152319">Click <span><img id="elb_qs_0003__image134577316234759" src="en-us_image_0000001747739880.png"></span> in the upper left corner of the page and choose <strong id="elb_qs_0003__b7449690734759">Network</strong> > <strong id="elb_qs_0003__b54911937734759">Virtual Private Cloud</strong>.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li47160469161557">In the navigation pane on the left, choose <strong id="elb_qs_0003__b780072619371">Access Control</strong> > <span id="elb_qs_0003__ph2080402615379"><strong id="elb_qs_0003__b1180132620371">Firewalls</strong></span>.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li30045754154757">In the <span id="elb_qs_0003__ph1126611297377">firewall</span> list, click the name of the <span id="elb_qs_0003__ph226752911372">firewall</span> to switch to the page showing its details.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li1976338154757">On the <strong id="elb_qs_0003__b193921555434759">Inbound Rules</strong> or <strong id="elb_qs_0003__b59026074534759">Outbound Rules</strong> tab page, click <strong id="elb_qs_0003__b99184665534759">Add Rule</strong> to add a rule.<ul id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_ul185172012178"><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li4511820191719"><strong id="elb_qs_0003__b195627275334759">Action</strong>: Select <strong id="elb_qs_0003__b55846611334759">Allow</strong>.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li8626942141716"><strong id="elb_qs_0003__b21099048934759">Protocol</strong>: The protocol must be the same as the one you selected for the listener.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li9500202313188"><strong id="elb_qs_0003__b112394197134759">Source</strong>: Set it to the VPC CIDR block.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li66251610162417"><strong id="elb_qs_0003__b124932411148">Source Port Range</strong>: Select a port range based on the service requirements.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li7464162916350"><strong id="elb_qs_0003__b15276137534759">Destination</strong>: Enter a destination address allowed in this direction. The default value is <strong id="elb_qs_0003__b157683080134759">0.0.0.0/0</strong>, which indicates that traffic from all IP addresses is permitted.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li5915133319341"><strong id="elb_qs_0003__b20636229101417">Destination Port Range</strong>: Select a port range based on the service requirements.</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li75457153520">(Optional) <strong id="elb_qs_0003__b176452032103718">Description</strong>: Describe the firewall rule if necessary.</li></ul>
|
|
</li><li id="elb_qs_0003__en-us_topic_0000001126827555_en-us_topic_0000001125381517_li162953310168">Click <strong id="elb_qs_0003__b63113001734759">OK</strong>.</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0003__section184861920245"><h4 class="sectiontitle">Adding a Listener</h4><p id="elb_qs_0003__en-us_topic_0166358908_p845424162316">Add a listener to the created load balancer. When you add the listener, create a backend server group, configure a health check, and add the two ECSs to the created backend server group. If a backend server is detected unhealthy, the load balancer will stop routing traffic to it until the backend server recovers.</p>
|
|
<div class="p" id="elb_qs_0003__en-us_topic_0166358908_p174950177514">Configure two forwarding policies to forward HTTP requests to the two ECSs, for example, requests from <strong id="elb_qs_0003__b19477121211531">www.example.com/ELB01/</strong> to ECS01, and those from <strong id="elb_qs_0003__b447818124531">www.example.com/ELB02/</strong> to ECS02.<div class="fignone" id="elb_qs_0003__en-us_topic_0166358908_fig1585611052513"><span class="figcap"><b>Figure 4 </b>Traffic forwarding</span><br><span><img class="vsd" id="elb_qs_0003__en-us_topic_0166358908_image115200401353" src="en-us_image_0000001747739860.png"></span></div>
|
|
</div>
|
|
<ol id="elb_qs_0003__en-us_topic_0166358908_ol5476154122712"><li id="elb_qs_0003__en-us_topic_0166358908_li122074130268">Click <span><img id="elb_qs_0003__image174615155334759" src="en-us_image_0000001794660485.png"></span> in the upper left corner to display <strong id="elb_qs_0003__b99087358534759">Service List</strong> and choose <strong id="elb_qs_0003__b116053448434759">Network</strong> > <strong id="elb_qs_0003__b26692803834759">Elastic Load Balancing</strong>. </li><li id="elb_qs_0003__en-us_topic_0166358908_li44618046152949">Locate the load balancer and click its name.</li><li id="elb_qs_0003__en-us_topic_0166358908_li13174175374113">Under <strong id="elb_qs_0003__b79943675934759">Listeners</strong>, click <strong id="elb_qs_0003__b55375906534759">Add Listener</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li3525459183317">Configure the listener and click <strong id="elb_qs_0003__b37176564634759">Next</strong>.<ul id="elb_qs_0003__en-us_topic_0166358908_ul19799192211283"><li id="elb_qs_0003__en-us_topic_0166358908_li1680042242817"><strong id="elb_qs_0003__b26706974634759">Name</strong>: Enter a name, for example, <strong id="elb_qs_0003__b127297110634759">listener-HTTP</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li361710862912"><strong id="elb_qs_0003__b113489025834759">Frontend Protocol/Port</strong>: Select a protocol and enter a port for the load balancer to receive requests. For example, set it to <strong id="elb_qs_0003__b138567560534759">HTTP</strong> and <strong id="elb_qs_0003__b4682217934759">80</strong>.</li></ul>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li446913175196">Create a backend server group, configure a health check, and click <strong id="elb_qs_0003__b1542121421614">Finish</strong>.<ul id="elb_qs_0003__en-us_topic_0166358908_ul12469417191910"><li id="elb_qs_0003__en-us_topic_0166358908_li74691170194">Backend server group<ul id="elb_qs_0003__en-us_topic_0166358908_ul1346941761917"><li id="elb_qs_0003__en-us_topic_0166358908_li7469161717192"><strong id="elb_qs_0003__b164920124178">Name</strong>: Enter a name, for example, <strong id="elb_qs_0003__b2493151211711">server_group-ELB</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li94694172199"><strong id="elb_qs_0003__b157953536234759">Load Balancing Algorithm</strong>: Select an algorithm that the load balancer will use to route requests, for example, <strong id="elb_qs_0003__b25910379534759">Weighted round robin</strong>.</li></ul>
|
|
</li></ul>
|
|
<ul id="elb_qs_0003__en-us_topic_0166358908_ul1646920173194"><li id="elb_qs_0003__en-us_topic_0166358908_li846910176194">Health check<ul id="elb_qs_0003__en-us_topic_0166358908_ul046931771916"><li id="elb_qs_0003__en-us_topic_0166358908_li1646931771918"><strong id="elb_qs_0003__b184517735934759">Health Check Protocol</strong>: Select a protocol for the load balancer to perform health checks on backend servers. If the load balancer uses TCP, HTTP, or HTTPS to receive requests, the health check protocol can be TCP or HTTP. Here we use HTTP as an example. Note that the protocol cannot be changed after the listener is added.</li><li id="elb_qs_0003__en-us_topic_0166358908_li104691517151910"><strong id="elb_qs_0003__b137785870834759">Domain Name</strong>: Enter a domain name that will be used for health checks, for example, www.example.com.</li><li id="elb_qs_0003__en-us_topic_0166358908_li546971711191"><strong id="elb_qs_0003__b28072109234759">Health Check Port</strong>: Enter a port for the load balancer to perform health checks on backend servers, for example, <strong id="elb_qs_0003__b195972119834759">80</strong>.<p id="elb_qs_0003__en-us_topic_0166358908_p446918172196">If you do not specify a health check port, the backend port will be used for health checks by default.</p>
|
|
</li></ul>
|
|
</li></ul>
|
|
</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0003__section6778123018276"><h4 class="sectiontitle">Adding a Forwarding Policy</h4><ol id="elb_qs_0003__en-us_topic_0166358908_ol16279105810277"><li id="elb_qs_0003__en-us_topic_0166358908_li1279175813279">Click the name of the newly added listener and then click <strong id="elb_qs_0003__b24039750534759">Add</strong> next to <strong id="elb_qs_0003__b101705532734759">Forwarding Policies</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li42791058102718">Configure the forwarding policy and click <strong id="elb_qs_0003__b68801035234759">Next</strong>.<ul id="elb_qs_0003__en-us_topic_0166358908_ul4782734162215"><li id="elb_qs_0003__en-us_topic_0166358908_li197823348223"><strong id="elb_qs_0003__b48735143334759">Name</strong>: Enter a name for the forwarding policy, for example, <strong id="elb_qs_0003__b85232814234759">forwarding_policy-ELB01</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li2078323419221"><strong id="elb_qs_0003__b138938412">Domain Name</strong>: Enter a domain name that will be used to forward the requests, for example, www.example.com. The domain name in the request must exactly match that specified in the forwarding policy.</li><li id="elb_qs_0003__en-us_topic_0166358908_li2739202722519"><strong id="elb_qs_0003__b210210046034759">URL</strong>: You can also specify a URL to forward the requests, for example, <strong id="elb_qs_0003__b78763651634759">/ELB01/</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li66261226102716"><strong id="elb_qs_0003__b101237342334759">URL Matching Rule</strong>: Select a rule for matching the specified URL string with the URL in the request. Three options are available, <strong id="elb_qs_0003__b129130528034759">Exact match</strong>, <strong id="elb_qs_0003__b162287786734759">Prefix match</strong>, and <strong id="elb_qs_0003__b76956779934759">Regular expression match</strong>. <strong id="elb_qs_0003__b76681543634759">Exact match</strong> enjoys the highest priority, and <strong id="elb_qs_0003__b159773644334759">Regular expression match</strong> the lowest priority. Select <strong id="elb_qs_0003__b171209082534759">Exact match</strong> here.</li></ul>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li12748141114321">Create a backend server group and configure a health check.<ul id="elb_qs_0003__en-us_topic_0166358908_ul1274861111325"><li id="elb_qs_0003__en-us_topic_0166358908_li11748611203214">Backend server group<ul id="elb_qs_0003__en-us_topic_0166358908_ul17748131123211"><li id="elb_qs_0003__en-us_topic_0166358908_li15748191119321"><strong id="elb_qs_0003__b475018281579">Name</strong>: Enter a name, for example, <strong id="elb_qs_0003__b1375010285715">server_group-ELB01</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li1374821120322"><strong id="elb_qs_0003__b212057740734759">Load Balancing Algorithm</strong>: Select an algorithm that the load balancer will use to route requests, for example, <strong id="elb_qs_0003__b154488540734759">Weighted round robin</strong>.</li></ul>
|
|
</li></ul>
|
|
<ul id="elb_qs_0003__en-us_topic_0166358908_ul1574861111327"><li id="elb_qs_0003__en-us_topic_0166358908_li374812116329">Health check<ul id="elb_qs_0003__en-us_topic_0166358908_ul16748141112321"><li id="elb_qs_0003__en-us_topic_0166358908_li1574819117322"><strong id="elb_qs_0003__b168084178034759">Health Check Protocol</strong>: Select a protocol for the load balancer to perform health checks on backend servers. If the load balancer uses TCP, HTTP, or HTTPS to receive requests, the health check protocol can be TCP or HTTP. Here we use HTTP as an example. Note that the protocol cannot be changed after the listener is added.</li><li id="elb_qs_0003__en-us_topic_0166358908_li1174891118325"><strong id="elb_qs_0003__b694212421520">Domain Name</strong>: Enter a domain name that will be used for health checks, for example, <strong id="elb_qs_0003__b394318426511">www.example.com</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li574820119321"><strong id="elb_qs_0003__b41986592434759">Health Check Port</strong>: Enter a port for the load balancer to perform health checks on backend servers, for example, <strong id="elb_qs_0003__b44347085434759">80</strong>.<p id="elb_qs_0003__en-us_topic_0166358908_p3748171183218">If you do not specify a health check port, the backend port will be used for health checks by default.</p>
|
|
</li></ul>
|
|
</li></ul>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li614204520397">Select the newly added forwarding policy. On the <strong id="elb_qs_0003__b40823188634759">Backend Server Groups</strong> tab page on the right, click <strong id="elb_qs_0003__b123760118934759">Add</strong>.</li><li id="elb_qs_0003__en-us_topic_0166358908_li19903154544217">Select the server you want to add, set the backend port, and click <strong id="elb_qs_0003__b126538263234759">Finish</strong>.<ul id="elb_qs_0003__en-us_topic_0166358908_ul19482182214415"><li id="elb_qs_0003__en-us_topic_0166358908_li2048352284418">Backend server: ECS01</li><li id="elb_qs_0003__en-us_topic_0166358908_li6483922104411">Backend port: Set it to <strong id="elb_qs_0003__b178090125634759">80</strong>. Backend servers will use this port to communicate with the load balancer.</li></ul>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li1423765125218">Repeat the preceding steps to add another forwarding policy, create a backend server group, and add ECS02 to the backend server group.</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0003__section164467272278"><h4 class="sectiontitle">Verifying Load Balancing</h4><p id="elb_qs_0003__en-us_topic_0166358908_p159413171688">After the load balancer is configured, you can access the domain name or the specified URL to check whether the two ECSs are accessible.</p>
|
|
<ol id="elb_qs_0003__en-us_topic_0166358908_ol1177812309272"><li id="elb_qs_0003__en-us_topic_0166358908_li10778123092715">Modify the <strong id="elb_qs_0003__b176875560134759">C:\Windows\System32\drivers\etc\hosts</strong> file on your PC to map the domain name to the load balancer EIP.<div class="p" id="elb_qs_0003__en-us_topic_0166358908_p1439294619610">View the load balancer EIP on the <strong id="elb_qs_0003__b39168151034759">Summary</strong> page of the load balancer.<div class="fignone" id="elb_qs_0003__en-us_topic_0166358908_fig9717114412612"><span class="figcap"><b>Figure 5 </b><strong id="elb_qs_0003__b56520876434759">hosts</strong> file on your PC</span><br><span><img id="elb_qs_0003__en-us_topic_0166358908_image67171744569" src="en-us_image_0000001794660705.png"></span></div>
|
|
</div>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li1677863072715">On the CLI of your PC, run the following command to check whether the domain name is mapped to the load balancer EIP:<p id="elb_qs_0003__en-us_topic_0166358908_p141804481111"><a name="elb_qs_0003__en-us_topic_0166358908_li1677863072715"></a><a name="en-us_topic_0166358908_li1677863072715"></a><strong id="elb_qs_0003__en-us_topic_0166358908_b099542951110">ping www.example.com</strong></p>
|
|
<p id="elb_qs_0003__en-us_topic_0166358908_p081752681216">If data packets are returned, the domain name has been mapped to the load balancer EIP.</p>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li4888169202412">Use your browser to access <strong id="elb_qs_0003__b1713307811">http://www.example.com/ELB01/</strong>. If the following page is displayed, the load balancer has routed the request to ECS01.<div class="fignone" id="elb_qs_0003__en-us_topic_0166358908_fig174313116258"><span class="figcap"><b>Figure 6 </b>Accessing ECS01</span><br><span><img id="elb_qs_0003__en-us_topic_0166358908_image1262314345916" src="en-us_image_0000001794819797.png"></span></div>
|
|
<div class="note" id="elb_qs_0003__en-us_topic_0166358908_note7365102853611"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="elb_qs_0003__en-us_topic_0166358908_p1687510552309"><strong id="elb_qs_0003__b18472006734759">ELB01/</strong> indicates that the default directory named <strong id="elb_qs_0003__b46476352434759">ECS01</strong> is accessed, while <strong id="elb_qs_0003__b160378015834759">ELB01</strong> indicates the file name. Therefore, the slash (/) following <strong id="elb_qs_0003__b49106551034759">ELB01</strong> must be retained.</p>
|
|
</div></div>
|
|
</li><li id="elb_qs_0003__en-us_topic_0166358908_li1497010584220">Use your browser to access <strong id="elb_qs_0003__b1447320481081">http://www.example.com/ELB02/</strong>. If the following page is displayed, the load balancer has routed the request to ECS02.<div class="fignone" id="elb_qs_0003__en-us_topic_0166358908_fig897020534220"><span class="figcap"><b>Figure 7 </b>Accessing ECS02</span><br><span><img id="elb_qs_0003__en-us_topic_0166358908_image139479102108" src="en-us_image_0000001794660721.png"></span></div>
|
|
</li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="elb_qs_0000.html">Getting Started</a></div>
|
|
</div>
|
|
</div>
|
|
|