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>
28 lines
3.3 KiB
HTML
28 lines
3.3 KiB
HTML
<a name="elb_faq_0067"></a><a name="elb_faq_0067"></a>
|
||
|
||
<h1 class="topictitle1">How Do I Test Sticky Sessions Using Linux Curl Commands?</h1>
|
||
<div id="body1568692772111"><ol id="elb_faq_0067__ol1225692695217"><li id="elb_faq_0067__li5256172655211">Prepare required resources.<ol type="a" id="elb_faq_0067__ol1119161413172"><li id="elb_faq_0067__li102014147176">Create three ECSs, one as the client and the other two as backend servers.</li><li id="elb_faq_0067__li16704122631717">Create a load balancer and add an HTTP listener to the load balancer. Enable sticky sessions when you add the listener.</li></ol>
|
||
</li></ol><ol start="2" id="elb_faq_0067__ol1374244435219"><li id="elb_faq_0067__li126712675314">Start the HTTP service of the two backend servers.<p id="elb_faq_0067__p289912181537"><a name="elb_faq_0067__li126712675314"></a><a name="li126712675314"></a>Log in to a backend server and create a file named <strong id="elb_faq_0067__b753721151911">1.file</strong> in the current directory to mark this server.</p>
|
||
<p id="elb_faq_0067__p3192611205315">Run the following command in the current directory to start the HTTP service:</p>
|
||
<p id="elb_faq_0067__p12376122895310"><strong id="elb_faq_0067__b437619286536">nohup python –m SimpleHTTPServer 80 &</strong></p>
|
||
<p id="elb_faq_0067__p178484287221">Run the following command to check whether the HTTP service is normal:</p>
|
||
<p id="elb_faq_0067__p1484832814221"><strong id="elb_faq_0067__b16848152812210">curl http://127.0.0.1:80</strong></p>
|
||
<p id="elb_faq_0067__p10848102892216"><span><img id="elb_faq_0067__image2084892832218" src="en-us_image_0000001747739620.jpg"></span></p>
|
||
<p id="elb_faq_0067__p594210402540">Log in to the other backend server and create a file named <strong id="elb_faq_0067__b73701131182114">2.file</strong> in the current directory.</p>
|
||
<p id="elb_faq_0067__p09821930195419">Run the following command in the current directory to start the HTTP service:</p>
|
||
<p id="elb_faq_0067__p1110713536548"><strong id="elb_faq_0067__b1107185325410">nohup python –m SimpleHTTPServer 80 &</strong></p>
|
||
<p id="elb_faq_0067__p684820286228">Run the following command to check whether the HTTP service is normal:</p>
|
||
<p id="elb_faq_0067__p7848132882212"><strong id="elb_faq_0067__b284882842215">curl http://127.0.0.1:80</strong></p>
|
||
<p id="elb_faq_0067__p1584814283224"><span><img id="elb_faq_0067__image5848328102214" src="en-us_image_0000001747380744.jpg"></span></p>
|
||
</li></ol><ol start="3" id="elb_faq_0067__ol3257182718553"><li id="elb_faq_0067__li72573275551">Access the load balancer from the client and specify the cookie value.<p id="elb_faq_0067__p184832815222"><a name="elb_faq_0067__li72573275551"></a><a name="li72573275551"></a>The following is an example command. Change the parameters as needed. Ensure that the returned file names of each request are the same.</p>
|
||
<p id="elb_faq_0067__p16848728112219"><strong id="elb_faq_0067__b580515476294">curl --cookie "name=abcd" <em id="elb_faq_0067__i580516478294"> </em>http://</strong><strong id="elb_faq_0067__b1996181615457">ELB_IP:Port</strong></p>
|
||
<p id="elb_faq_0067__p158481028202214"><span><img id="elb_faq_0067__image1884819289220" src="en-us_image_0000001794819569.jpg"></span></p>
|
||
</li></ol>
|
||
</div>
|
||
<div>
|
||
<div class="familylinks">
|
||
<div class="parentlink"><strong>Parent topic:</strong> <a href="elb_faq_0190.html">Sticky Sessions</a></div>
|
||
</div>
|
||
</div>
|
||
|