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>
202 lines
39 KiB
HTML
202 lines
39 KiB
HTML
<a name="elb_qs_0002"></a><a name="elb_qs_0002"></a>
|
|
|
|
<h1 class="topictitle1">Using Dedicated Load Balancers (Entry Level)</h1>
|
|
<div id="body0000001126827555"><div class="section" id="elb_qs_0002__section18950295143553"><h4 class="sectiontitle">Scenarios</h4><p id="elb_qs_0002__en-us_topic_0167652100_p13318235811">You have a web application, which often needs to handle heavy traffic and is deployed on two ECSs for load balancing.</p>
|
|
<p id="elb_qs_0002__en-us_topic_0167652100_p14697175632114">You can create a <span id="elb_qs_0002__en-us_topic_0167652100_ph1645535710329">dedicated </span>load balancer to distribute traffic across multiple backend servers based on the forwarding policy you have configured, which eliminates SPOFs and makes your application more available.</p>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section3453061616119"><h4 class="sectiontitle">Prerequisites</h4><ul id="elb_qs_0002__ul15892133835819"><li id="elb_qs_0002__li125716431158">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_0002__li264157195913">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_0002__note169701630151818"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="elb_qs_0002__p1297043018186">If <strong id="elb_qs_0002__b1110017431584">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_0002__section1973682033616"><h4 class="sectiontitle">Creating ECSs</h4><p id="elb_qs_0002__en-us_topic_0167652100_p193565412368">ECSs are used as backend servers to process requests.</p>
|
|
<div class="p" id="elb_qs_0002__en-us_topic_0167652100_p1942152771010">Each ECS needs an EIP for accessing the Internet, and the EIP is used for configuring the application on the ECS. You can determine whether to bind an EIP to each ECS based on your requirements.<ol id="elb_qs_0002__en-us_topic_0167652100_ol153061641103515"><li id="elb_qs_0002__en-us_topic_0167652100_li18503134213513">Log in to the management console.</li><li id="elb_qs_0002__en-us_topic_0167652100_li675519100420">In the upper left corner of the page, click <span><img id="elb_qs_0002__en-us_topic_0167652100_image397247655" src="en-us_image_0000001747739624.png"></span> and select the desired region and project.</li><li id="elb_qs_0002__en-us_topic_0167652100_li18814181314416">Click <span><img id="elb_qs_0002__en-us_topic_0167652100_image2280134131215" src="en-us_image_0000001747380972.png"></span> in the upper left corner to display <strong id="elb_qs_0002__b85431967116">Service List</strong> and choose <strong id="elb_qs_0002__b1754411612115">Computing</strong> > <strong id="elb_qs_0002__b105455617119">Elastic Cloud Server</strong>.</li><li id="elb_qs_0002__en-us_topic_0167652100_li12985204673513"><p id="elb_qs_0002__en-us_topic_0167652100_p027115120107"><a name="elb_qs_0002__en-us_topic_0167652100_li12985204673513"></a><a name="en-us_topic_0167652100_li12985204673513"></a>Click <strong id="elb_qs_0002__b6848142517114">Create ECS</strong>, configure the parameters, and click <strong id="elb_qs_0002__b1084962541110">Create Now</strong>.</p>
|
|
<p id="elb_qs_0002__en-us_topic_0167652100_p690813309525"></p>
|
|
<div class="p" id="elb_qs_0002__en-us_topic_0167652100_p243964203718">The following table lists the specifications of the two ECSs.
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="elb_qs_0002__en-us_topic_0167652100_table9439114212376" frame="border" border="1" rules="all"><caption><b>Table 1 </b>ECS specifications</caption><thead align="left"><tr id="elb_qs_0002__en-us_topic_0167652100_row144381942113712"><th align="left" class="cellrowborder" valign="top" width="46.949999999999996%" id="mcps1.3.3.3.1.4.3.1.2.3.1.1"><p id="elb_qs_0002__en-us_topic_0167652100_p2437164211370"><strong id="elb_qs_0002__b46641429112">Item</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="53.05%" id="mcps1.3.3.3.1.4.3.1.2.3.1.2"><p id="elb_qs_0002__en-us_topic_0167652100_p1437144223718"><strong id="elb_qs_0002__b1161516441119">Example Value</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="elb_qs_0002__en-us_topic_0167652100_row19438184219379"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0167652100_p143814421375">Name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0167652100_p443818423371">ECS01 and ECS02</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0167652100_row4438164219374"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0167652100_p143834210373">OS</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0167652100_p7438154214376">CentOS 7.2 64bit</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0167652100_row124388426378"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0167652100_p34381142143710">vCPUs</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0167652100_p743854273713">2</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0167652100_row54398427375"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0167652100_p84381942143717">Memory</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0167652100_p74385422371">4 GB</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0167652100_row104391342163719"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0167652100_p134396423373">System disk</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0167652100_p44391842123715">40 GB</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0167652100_row64392042193716"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0167652100_p1843964233713">Data disk</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0167652100_p1443984283717">100 GB</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0167652100_row74391842173712"><td class="cellrowborder" valign="top" width="46.949999999999996%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.1 "><p id="elb_qs_0002__en-us_topic_0167652100_p13439144213370">Bandwidth</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53.05%" headers="mcps1.3.3.3.1.4.3.1.2.3.1.2 "><p id="elb_qs_0002__en-us_topic_0167652100_p19439174293718">5 Mbit/s</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li108811553173210">Submit your request.</li></ol>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section12375217165718"><h4 class="sectiontitle">Deploying the Application</h4><p id="elb_qs_0002__en-us_topic_0167652100_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_0002__en-us_topic_0167652100_ol5585103623813"><li id="elb_qs_0002__en-us_topic_0167652100_li7185175234820">Log in to the ECSs.</li><li id="elb_qs_0002__en-us_topic_0167652100_li4688114133916">Install and start Nginx.<ol type="a" id="elb_qs_0002__en-us_topic_0167652100_ol188621021113910"><li id="elb_qs_0002__en-us_topic_0167652100_li12862142143913">Run the <strong id="elb_qs_0002__b62438429130">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_0002__en-us_topic_0167652100_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_0002__en-us_topic_0167652100_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_0002__en-us_topic_0167652100_screen1528319398215">rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm</pre>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li1142112271116">Run the following command to install Nginx:<pre class="screen" id="elb_qs_0002__en-us_topic_0167652100_screen9609175010218">yum -y install nginx</pre>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li197081130018">Run the following commands to start Nginx and enable auto-start upon ECS startup:<pre class="screen" id="elb_qs_0002__en-us_topic_0167652100_screen175165111635">systemctl start nginx
|
|
systemctl enable nginx</pre>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li8864112163918">Enter <strong id="elb_qs_0002__b1341841241511">http://</strong><em id="elb_qs_0002__i1641918127152">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_0002__en-us_topic_0167652100_fig137471211561"><span class="figcap"><b>Figure 1 </b>Nginx installed successfully</span><br><span><img id="elb_qs_0002__en-us_topic_0167652100_image1074715213563" src="en-us_image_0000001747381136.png"></span></div>
|
|
</li></ol>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li106574123399">Modify the HTML page of ECS01.<div class="p" id="elb_qs_0002__en-us_topic_0167652100_p1751133519291"><a name="elb_qs_0002__en-us_topic_0167652100_li106574123399"></a><a name="en-us_topic_0167652100_li106574123399"></a>Modify the <strong id="elb_qs_0002__b13881231151518">index.html</strong> file in the default root directory of Nginx <strong id="elb_qs_0002__b68914317153">/usr/share/nginx/html</strong> to identify access to ECS01.<ol type="a" id="elb_qs_0002__en-us_topic_0167652100_ol17991841818"><li id="elb_qs_0002__en-us_topic_0167652100_li43715036155356">Open the <strong id="elb_qs_0002__b11873143715151">index.html</strong> file.<p id="elb_qs_0002__en-us_topic_0167652100_p57891004155356"><strong id="elb_qs_0002__en-us_topic_0167652100_b1282164811124">vim /usr/share/nginx/html<strong id="elb_qs_0002__en-us_topic_0167652100_b445614535191">/</strong>index.html</strong></p>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li58659743155356">Press <strong id="elb_qs_0002__b356716140166">i</strong> to enter editing mode.</li><li id="elb_qs_0002__en-us_topic_0167652100_li53818751155356">Modify the <strong id="elb_qs_0002__b17337416181610">index.html</strong> file.<div class="p" id="elb_qs_0002__en-us_topic_0167652100_p1092212610131">The following is the content to be modified:<pre class="screen" id="elb_qs_0002__en-us_topic_0167652100_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_0002__en-us_topic_0167652100_li5284577155356">Press <strong id="elb_qs_0002__b632322718164">Esc</strong> to exit editing mode. Then, enter <strong id="elb_qs_0002__b17323727101613">:wq</strong> to save the settings and exit the file.</li></ol>
|
|
</div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li74081445133915">Modify the HTML page of ECS02.<div class="p" id="elb_qs_0002__en-us_topic_0167652100_p17786250164018"><a name="elb_qs_0002__en-us_topic_0167652100_li74081445133915"></a><a name="en-us_topic_0167652100_li74081445133915"></a>Modify the <strong id="elb_qs_0002__b4615203171619">index.html</strong> file in the default root directory of Nginx <strong id="elb_qs_0002__b196161631151617">/usr/share/nginx/html</strong> to identify access to ECS02.<ol type="a" id="elb_qs_0002__en-us_topic_0167652100_ol37861150184013"><li id="elb_qs_0002__en-us_topic_0167652100_li6812121219197">Open the <strong id="elb_qs_0002__b193011411161617">index.html</strong> file.<p id="elb_qs_0002__en-us_topic_0167652100_p1881241241910"><strong id="elb_qs_0002__en-us_topic_0167652100_b17812212181915">vim /usr/share/nginx/html<strong id="elb_qs_0002__en-us_topic_0167652100_b1794479197">/</strong>index.html</strong></p>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li1812121217199">Press <strong id="elb_qs_0002__b17782181521610">i</strong> to enter editing mode.</li><li id="elb_qs_0002__en-us_topic_0167652100_li12812912161915">Modify the <strong id="elb_qs_0002__b8769101815168">index.html</strong> file.<p id="elb_qs_0002__en-us_topic_0167652100_p27485143427">The following is the content to be modified:</p>
|
|
<pre class="screen" id="elb_qs_0002__en-us_topic_0167652100_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_0002__en-us_topic_0167652100_li1974961484220">Press <strong id="elb_qs_0002__b12853172815168">Esc</strong> to exit editing mode. Then, enter <strong id="elb_qs_0002__b188531228201613">:wq</strong> to save the settings and exit the file.</li></ol>
|
|
</div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li259417884118">Use your browser to access <strong id="elb_qs_0002__b0181134920166">http://</strong><em id="elb_qs_0002__i18181164916161">ECS01 EIP</em> and <strong id="elb_qs_0002__b118244914163">http://</strong><em id="elb_qs_0002__i1182149131611">ECS02 EIP</em> to verify that Nginx has been deployed.<p id="elb_qs_0002__en-us_topic_0167652100_p12966153132218">If the modified HTML pages are displayed, Nginx has been deployed.</p>
|
|
<ul id="elb_qs_0002__en-us_topic_0167652100_ul117591613242"><li id="elb_qs_0002__en-us_topic_0167652100_li1275991102411">HTML page of ECS01<div class="fignone" id="elb_qs_0002__en-us_topic_0167652100_fig1823119513251"><span class="figcap"><b>Figure 2 </b>Nginx successfully deployed on ECS01</span><br><span><img id="elb_qs_0002__en-us_topic_0167652100_image162241919366" src="en-us_image_0000001794819981.png"></span></div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li1049422182416">HTML page of ECS02<div class="fignone" id="elb_qs_0002__en-us_topic_0167652100_fig17457132212516"><span class="figcap"><b>Figure 3 </b>Nginx successfully deployed on ECS02</span><br><span><img id="elb_qs_0002__en-us_topic_0167652100_image122741811610" src="en-us_image_0000001794660869.png"></span></div>
|
|
</li></ul>
|
|
</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section15436447172917"><h4 class="sectiontitle">Creating a Load Balancer</h4><p id="elb_qs_0002__p206191913341">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_0002__ol353744134512"><li id="elb_qs_0002__li66366715143438">In the upper left corner of the page, click <span><img id="elb_qs_0002__en-us_topic_0167652100_image1851513211124" src="en-us_image_0000001747739624.png"></span> and select the desired region and project.</li><li id="elb_qs_0002__li17301740102218">Click <span><img id="elb_qs_0002__image88113202262854" src="en-us_image_0000001794660485.png"></span> in the upper left corner to display <strong id="elb_qs_0002__b166254329262854">Service List</strong> and choose <strong id="elb_qs_0002__b85328055362854">Network</strong> > <strong id="elb_qs_0002__b194361913862854">Elastic Load Balancing</strong>.</li><li id="elb_qs_0002__li314119169018">Click <strong id="elb_qs_0002__b183730563188">Create Elastic Load Balancer</strong> and configure the parameters.</li><li id="elb_qs_0002__li41251723101514">Click <strong id="elb_qs_0002__b1169511452190">Create Now</strong>.</li><li id="elb_qs_0002__li9984122593614">Confirm the configuration and submit your request.</li><li id="elb_qs_0002__li1870167192111">View the newly created load balancer in the load balancer list.</li></ol>
|
|
<div class="note" id="elb_qs_0002__note171711554395"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="elb_qs_0002__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_0002__section26032025134916"><h4 class="sectiontitle">Configuring Security Group Rules</h4><ol id="elb_qs_0002__en-us_topic_0000001125381517_ol198141563813"><li id="elb_qs_0002__en-us_topic_0000001125381517_li677391520332">Log in to the management console.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li675519100420">In the upper left corner of the page, click <span><img id="elb_qs_0002__image38082578062851" src="en-us_image_0000001747739624.png"></span> and select the desired region and project.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0029320966_li50026016224047">Click <span><img id="elb_qs_0002__image154208406264" src="en-us_image_0000001747380972.png"></span> in the upper left corner to display <strong id="elb_qs_0002__b542014407262">Service List</strong> and choose <strong id="elb_qs_0002__b942034014269">Computing</strong> > <strong id="elb_qs_0002__b1742004017261">Elastic Cloud Server</strong>.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li34401539214315">On the <strong id="elb_qs_0002__b1068153722016">Elastic Cloud Server</strong> page, click the name of the ECS that has been added to a backend server group.<p id="elb_qs_0002__en-us_topic_0000001125381517_p19982029214319">The ECS details page is displayed.</p>
|
|
</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li18750165432511">Click <strong id="elb_qs_0002__b16965656102016">Security Groups</strong>, locate the security group, and view security group rules.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li45534692214355">Click the security group rule ID or <strong id="elb_qs_0002__b1759183217219">Modify Security Group Rule</strong>. The security group details page is displayed.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001390784280_en-us_topic_0029320966_li46525942225810">On the<strong id="elb_qs_0002__b115316616241"> Inbound Rules</strong> tab page, click <strong id="elb_qs_0002__b20153163249">Add Rule</strong>. Configure an inbound rule based on <a href="#elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_table22703095416">Table 2</a>.
|
|
<div class="tablenoborder"><a name="elb_qs_0002__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_0002__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_0002__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.6.2.7.4.2.5.1.1"><p id="elb_qs_0002__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.6.2.7.4.2.5.1.2"><p id="elb_qs_0002__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.6.2.7.4.2.5.1.3"><p id="elb_qs_0002__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.6.2.7.4.2.5.1.4"><p id="elb_qs_0002__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_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row1328173035411"><td class="cellrowborder" valign="top" width="22.95%" headers="mcps1.3.6.2.7.4.2.5.1.1 "><p id="elb_qs_0002__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.6.2.7.4.2.5.1.2 "><p id="elb_qs_0002__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.6.2.7.4.2.5.1.3 "><p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p14281430155413"><strong id="elb_qs_0002__b452814286254">Protocol</strong>: TCP</p>
|
|
<p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1499745325519"><strong id="elb_qs_0002__b3738341142519">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.6.2.7.4.2.5.1.4 "><p id="elb_qs_0002__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_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row51717597200"><td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.1 "><p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1518135920204">TCP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.2 "><p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p7371172212119">Allow</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.3 "><p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1268123713211"><strong id="elb_qs_0002__b11211731152514">Protocol</strong>: TCP</p>
|
|
<p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p36815374217"><strong id="elb_qs_0002__b1407165213259">Port</strong>: health check port</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_row1928113012544"><td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.1 "><p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p32812305543">UDP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.2 "><p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p20399113617560">Allow</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" headers="mcps1.3.6.2.7.4.2.5.1.3 "><p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p828193011543"><strong id="elb_qs_0002__b285935562512">Protocol</strong>: UDP and ICMP</p>
|
|
<p id="elb_qs_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_en-us_topic_0000001390784280_p1820894010565"><strong id="elb_qs_0002__b07060535257">Port</strong>: health check port</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="note" id="elb_qs_0002__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_0002__en-us_topic_0000001125381517_en-us_topic_0000001420502298_ul123781623163110"><li id="elb_qs_0002__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_0002__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_0002__en-us_topic_0000001125381517_li1030715242413">Click <strong id="elb_qs_0002__b1282171716264">OK</strong>.</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section1261104918577"><h4 class="sectiontitle">Configuring Firewall Rules</h4><p id="elb_qs_0002__en-us_topic_0000001125381517_p3997193819710">To control traffic in and out of a subnet, you can associate a <span id="elb_qs_0002__ph11873144811269">firewall</span> with the subnet. <span id="elb_qs_0002__ph20686125218264">Firewall</span> rules control access to subnets and add an additional layer of defense to your subnets. Default <span id="elb_qs_0002__ph1618815572266">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_0002__ph1418955711263">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_0002__en-us_topic_0000001125381517_p79433211595">Configure an inbound <span id="elb_qs_0002__ph48516116277">firewall</span> rule to allow traffic from the VPC where the load balancer resides to backend servers.</p>
|
|
<ol id="elb_qs_0002__en-us_topic_0000001125381517_ol17965143881417"><li id="elb_qs_0002__en-us_topic_0000001125381517_li20860192818532">Log in to the management console.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li1486022812537">In the upper left corner of the page, click <span><img id="elb_qs_0002__image8381439662851" src="en-us_image_0000001747739624.png"></span> and select the desired region and project.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li59941052152319">Click <span><img id="elb_qs_0002__image1319595313298" src="en-us_image_0000001747739880.png"></span> in the upper left corner of the page and choose <strong id="elb_qs_0002__b181971553182918">Network</strong> > <strong id="elb_qs_0002__b1019812535295">Virtual Private Cloud</strong>.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li47160469161557">In the navigation pane on the left, choose <strong id="elb_qs_0002__b194457556292">Access Control</strong> > <span id="elb_qs_0002__ph844717551293"><strong id="elb_qs_0002__b19446165515291">Firewalls</strong></span>.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li30045754154757">In the <span id="elb_qs_0002__ph181658142916">firewall</span> list, click the name of the <span id="elb_qs_0002__ph58214582299">firewall</span> to switch to the page showing its details.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li1976338154757">On the <strong id="elb_qs_0002__b3168809305">Inbound Rules</strong> or <strong id="elb_qs_0002__b41684043016">Outbound Rules</strong> tab page, click <strong id="elb_qs_0002__b616920013019">Add Rule</strong> to add a rule.<ul id="elb_qs_0002__en-us_topic_0000001125381517_ul185172012178"><li id="elb_qs_0002__en-us_topic_0000001125381517_li4511820191719"><strong id="elb_qs_0002__b06487216307">Action</strong>: Select <strong id="elb_qs_0002__b196484223010">Allow</strong>.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li8626942141716"><strong id="elb_qs_0002__b1227771073010">Protocol</strong>: The protocol must be the same as the one you selected for the listener.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li9500202313188"><strong id="elb_qs_0002__b1817991318306">Source</strong>: Set it to the VPC CIDR block.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li66251610162417"><strong id="elb_qs_0002__b0956101418307">Source Port Range</strong>: Select a port range based on the service requirements.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li7464162916350"><strong id="elb_qs_0002__b1526201743014">Destination</strong>: Enter a destination address allowed in this direction. If you keep the default value, <strong id="elb_qs_0002__b8224919123010">0.0.0.0/0</strong>, traffic will be allowed for all destination IP addresses.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li5915133319341"><strong id="elb_qs_0002__b456782183017">Destination Port Range</strong>: Select a port range based on the service requirements.</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li75457153520">(Optional) <strong id="elb_qs_0002__b1446317276306">Description</strong>: Describe the firewall rule if necessary.</li></ul>
|
|
</li><li id="elb_qs_0002__en-us_topic_0000001125381517_li162953310168">Click <strong id="elb_qs_0002__b10635183319305">OK</strong>.</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section184861920245"><h4 class="sectiontitle">Adding a Listener</h4><p id="elb_qs_0002__en-us_topic_0167652100_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="fignone" id="elb_qs_0002__en-us_topic_0167652100_fig1748151712518"><span class="figcap"><b>Figure 4 </b>Traffic forwarding</span><br><span><img class="vsd" id="elb_qs_0002__en-us_topic_0167652100_image11982290355" src="en-us_image_0000001794660861.png"></span></div>
|
|
<ol id="elb_qs_0002__en-us_topic_0167652100_ol5476154122712"><li id="elb_qs_0002__en-us_topic_0167652100_li17301740102218">Click <span><img id="elb_qs_0002__image34159303862854" src="en-us_image_0000001794660485.png"></span> in the upper left corner to display <strong id="elb_qs_0002__b72649707062854">Service List</strong> and choose <strong id="elb_qs_0002__b149045401962854">Network</strong> > <strong id="elb_qs_0002__b29645050662854">Elastic Load Balancing</strong>.</li><li id="elb_qs_0002__en-us_topic_0167652100_li44618046152949">Locate the created load balancer (<strong id="elb_qs_0002__b1788324118314">elb-01</strong>) and click its name.</li><li id="elb_qs_0002__en-us_topic_0167652100_li13174175374113">Under <strong id="elb_qs_0002__b116031549193119">Listeners</strong>, click <strong id="elb_qs_0002__b56031749133111">Add Listener</strong>.</li><li id="elb_qs_0002__en-us_topic_0167652100_li2251125613498">Configure the listener and click <strong id="elb_qs_0002__b17316175193115">Next</strong>.<ul id="elb_qs_0002__en-us_topic_0167652100_ul62511156154919"><li id="elb_qs_0002__en-us_topic_0167652100_li325135618495"><strong id="elb_qs_0002__b841155323112">Name</strong>: Enter a name, for example, <strong id="elb_qs_0002__b194124537318">listener-HTTP</strong>.</li><li id="elb_qs_0002__en-us_topic_0167652100_li82511563496"><strong id="elb_qs_0002__b99521356193119">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_0002__b695319562315">HTTP</strong> and <strong id="elb_qs_0002__b4953956143110">80</strong>.<div class="fignone" id="elb_qs_0002__en-us_topic_0167652100_fig14655442185116"><span class="figcap"><b>Figure 5 </b>Adding a listener</span><br><span><img id="elb_qs_0002__en-us_topic_0167652100_image2655742195114" src="en-us_image_0000001747381140.png"></span></div>
|
|
</li></ul>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li1895519482122">Create a backend server group and configure a health check.<ul id="elb_qs_0002__en-us_topic_0167652100_ul1688220191456"><li id="elb_qs_0002__en-us_topic_0167652100_li388214193454">Backend server group<ul id="elb_qs_0002__en-us_topic_0167652100_ul118811219184517"><li id="elb_qs_0002__en-us_topic_0167652100_li1488191919457"><strong id="elb_qs_0002__b17400111873214">Name</strong>: Enter a name, for example, <strong id="elb_qs_0002__b104004181329">server_group-ELB</strong>.</li><li id="elb_qs_0002__en-us_topic_0167652100_li19881201904512"><strong id="elb_qs_0002__b1021482217329">Load Balancing Algorithm</strong>: Select an algorithm that the load balancer will use to route requests, for example, <strong id="elb_qs_0002__b1221462216328">Weighted round robin</strong>.</li></ul>
|
|
</li></ul>
|
|
<ul id="elb_qs_0002__en-us_topic_0167652100_ul11882181919453"><li id="elb_qs_0002__en-us_topic_0167652100_li14882171984518">Health check<ul id="elb_qs_0002__en-us_topic_0167652100_ul7882161913451"><li id="elb_qs_0002__en-us_topic_0167652100_li188211917459"><strong id="elb_qs_0002__b2382123853212">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.</li><li id="elb_qs_0002__en-us_topic_0167652100_li15882121964513"><strong id="elb_qs_0002__b17946175283212">Domain Name</strong>: Enter a domain name that will be used for health checks, for example, www.example.com.</li><li id="elb_qs_0002__en-us_topic_0167652100_li1988214191451"><strong id="elb_qs_0002__b8254105733214">Health Check Port</strong>: Enter a port for the load balancer to perform health checks on backend servers, for example, <strong id="elb_qs_0002__b325445715324">80</strong>.<p id="elb_qs_0002__en-us_topic_0167652100_p888201917459">If no health check port is configured, the backend port is used for health checks by default. If you specify a port, it will be used for health checks.</p>
|
|
</li></ul>
|
|
</li></ul>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li48833192451">Click the name of the newly added listener. On the <strong id="elb_qs_0002__b461762116341">Backend Server Groups</strong> tab page on the right, click <strong id="elb_qs_0002__b8904124163419">Add</strong>.</li><li id="elb_qs_0002__en-us_topic_0167652100_li2076511864619">Select the servers you want to add, set the backend port, and click <strong id="elb_qs_0002__b176115261349">Finish</strong>.<ul id="elb_qs_0002__en-us_topic_0167652100_ul19482182214415"><li id="elb_qs_0002__en-us_topic_0167652100_li2048352284418">Backend servers: Select <strong id="elb_qs_0002__b6331113010347">ECS01</strong> and <strong id="elb_qs_0002__b1833233018341">ECS02</strong>.</li><li id="elb_qs_0002__en-us_topic_0167652100_li6483922104411">Backend port: Set it to <strong id="elb_qs_0002__b1820133310345">80</strong>. Backend servers will use this port to communicate with the load balancer.</li></ul>
|
|
</li></ol>
|
|
</div>
|
|
<div class="section" id="elb_qs_0002__section164467272278"><h4 class="sectiontitle">Verifying Load Balancing</h4><p id="elb_qs_0002__en-us_topic_0167652100_p159413171688">After the load balancer is configured, you can access the domain name to check whether the two ECSs are accessible.</p>
|
|
<ol id="elb_qs_0002__en-us_topic_0167652100_ol1177812309272"><li id="elb_qs_0002__en-us_topic_0167652100_li10778123092715">Modify the <strong id="elb_qs_0002__b57423311352">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_0002__en-us_topic_0167652100_p108335351756">View the load balancer EIP on the <strong id="elb_qs_0002__b2916107143510">Summary</strong> page of the load balancer.<div class="fignone" id="elb_qs_0002__en-us_topic_0167652100_fig11400732555"><span class="figcap"><b>Figure 6 </b><strong id="elb_qs_0002__b362771111356">hosts</strong> file on your PC</span><br><span><img id="elb_qs_0002__en-us_topic_0167652100_image154003321252" src="en-us_image_0000001747740024.png"></span></div>
|
|
</div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_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_0002__en-us_topic_0167652100_p141804481111"><a name="elb_qs_0002__en-us_topic_0167652100_li1677863072715"></a><a name="en-us_topic_0167652100_li1677863072715"></a><strong id="elb_qs_0002__en-us_topic_0167652100_b099542951110">ping www.example.com</strong></p>
|
|
<p id="elb_qs_0002__en-us_topic_0167652100_p081752681216">If data packets are returned, the domain name has been mapped to the load balancer EIP.</p>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li4888169202412">Use your browser to access <strong id="elb_qs_0002__b11496533143516">http://www.example.com</strong>. If the following page is displayed, the load balancer has routed the request to ECS01.<div class="fignone" id="elb_qs_0002__en-us_topic_0167652100_fig174313116258"><span class="figcap"><b>Figure 7 </b>Accessing ECS01</span><br><span><img id="elb_qs_0002__en-us_topic_0167652100_image2819142543217" src="en-us_image_0000001794660889.png"></span></div>
|
|
</li><li id="elb_qs_0002__en-us_topic_0167652100_li1497010584220">Use your browser to access <strong id="elb_qs_0002__b6820161369">http://www.example.com</strong>. If the following page is displayed, the load balancer has routed the request to ECS02.<div class="fignone" id="elb_qs_0002__en-us_topic_0167652100_fig897020534220"><span class="figcap"><b>Figure 8 </b>Accessing ECS02</span><br><span><img id="elb_qs_0002__en-us_topic_0167652100_image113469388329" src="en-us_image_0000001794819973.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>
|
|
|