Create a TCP Listener for an External/Internal ELB Instance

<p>This article describes how to create an external/internal ELB TCP listener.</p> <p><strong><span style="font-size:18px">Prerequisites</span></strong></p> <p>You have successfully created an external/internal ELB instance.</p> <p><strong><span style="font-size:18px">Procedures</span></strong></p> <p>1.&nbsp;Log in to the <a href="https://pinganyun.com/console/loadBalance/overview" target="_blank">ELB Console</a>.</p> <p>2.&nbsp;In the left navigation pane, click <strong>Instance Management</strong> to enter the <strong>Instance Management</strong> page.</p> <p>3.&nbsp;Click the instance name of the target ELB instance and enter the <strong>Instance Information</strong> page.</p> <p>4.&nbsp;Click the <strong>Listener</strong> tab.</p> <p>5.&nbsp;In the upper-right corner of the tab, click <strong>Create</strong> to enter the <strong>Create Listener</strong> page.</p> <p>6.&nbsp;Configure the listener as described in the following tables.</p> <p><img src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20201607112912-198149ba91c1.png" style="height:669px; width:830px" /></p> <p><strong>Basic Information</strong></p> <table border="1" cellpadding="0" cellspacing="0" style="width:0px"> <tbody> <tr> <td style="background-color:#ededed; width:170px"> <p><strong>Configuration item</strong></p> </td> <td style="background-color:#ededed; vertical-align:top; width:611px"> <p><strong>Description</strong></p> </td> </tr> <tr> <td style="width:170px"> <p>Description</p> </td> <td style="vertical-align:top; width:611px"> <p>Customize the description of a listener.</p> </td> </tr> <tr> <td style="width:170px"> <p>Frontend protocol</p> </td> <td style="vertical-align:top; width:611px"> <p>Select TCP.</p> </td> </tr> <tr> <td style="width:170px"> <p>Port</p> </td> <td style="vertical-align:top; width:611px"> <p>Enter the port number used to receive the request and forward the request to the pool.</p> <p><img src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20201607112607-197ec68f94ac.png" style="height:22px; margin:1px; width:50px" /><strong>:</strong> In the same ELB instance, the listener port number cannot be repeated.</p> </td> </tr> <tr> <td style="width:170px"> <p>Schedule algorithm</p> </td> <td style="vertical-align:top; width:611px"> <p>Select a schedule algorithm. Currently only <strong>Weighted Round Robin</strong> is supported. In the weighted round robin mode, the access request will be assigned to the hosts in the server resource pool according to the weight value. The higher the host weight, the greater the probability of being distributed. If the weight values are the same, the round robin mode is implemented.</p> </td> </tr> <tr> <td style="width:170px"> <p>Pool</p> </td> <td style="vertical-align:top; width:611px"> <p>Choose a pool.</p> <p>You need to select a pool based on the following steps:</p> <p>1.&nbsp;Click <strong>Choose Pool,</strong> and the <strong>Choose Pool</strong> dialog box opens.</p> <p>2. Check the target pool, and click <strong>Confirm</strong>.</p> <p>If you have not yet created a pool, you need to create one before you can make a selection here. You can also create a server resource pool before you select one for a listener. For more information about creating a pool, see Create an /ELB Pool.</p> </td> </tr> <tr> <td style="width:170px"> <p>Turn on TCP+SSL</p> </td> <td style="vertical-align:top; width:611px"> <p>For external ELB instances, you can choose to turn on or off the TCP+SSL function. For the case where a large number of clients in the IoT environment are electrical appliances, such as refrigerators, washing machines, and air-conditioning terminals, TCP is usually used to initiate the connection. For the security of the connection, the terminal SSL certificate needs to be verified.</p> <p>If you turn on the TCP+SSL, you need to upload an SSL certificate.</p> <p><img src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20201607112607-197ec68f94ac.png" style="height:22px; margin:1px; width:50px" /><strong>:</strong> Before uploading the certificate, make sure that the certificate has been created. For more information, see Create a Certificate.</p> <p>You can upload the certificate in the following steps:</p> <p>1.&nbsp;Click <strong>Select Certificate</strong>, and the <strong>Select Certificate</strong> dialog box opens.</p> <p>2. Check the target certificate, and click <strong>Confirm</strong>.</p> </td> </tr> </tbody> </table> <p><strong>Advanced configuration</strong></p> <table border="1" cellpadding="0" cellspacing="0" style="width:0px"> <tbody> <tr> <td style="background-color:#ededed; width:257px"> <p><strong>Configuration item</strong></p> </td> <td style="background-color:#ededed; vertical-align:top; width:524px"> <p><strong>Description</strong></p> </td> </tr> <tr> <td style="width:257px"> <p>Session persistence</p> </td> <td style="vertical-align:top; width:524px"> <p>You can choose to turn on or off the session persistence function. After you turn on the session persistence function, requests belonging to the same session will be forwarded to the same host for processing.</p> <p>The way to keep the session is the source address hash SOURCE_ADDRESS.</p> </td> </tr> <tr> <td style="width:257px"> <p>Access control</p> </td> <td style="vertical-align:top; width:524px"> <p>For external ELB instances, you can choose to turn on or off the Access Control function. After you turn on the access control function, you can control the access permission of the specified IP address to ELB.</p> <p>If you turn on the access control function, you need to select the created access control policy group or create a new access control policy group and select the access control mode. The access control policy group includes one or more IP addresses. The access control modes include <strong>Whitelist</strong> and <strong>Blacklist</strong>. It decides whether to allow or deny the IP addresses in the policy group to access the ELB instance.</p> </td> </tr> <tr> <td style="width:257px"> <p>Create connection timeout</p> </td> <td style="vertical-align:top; width:524px"> <p>The create connection timeout defines the timeout period when establishing a connection. The session will be disconnected if it is not established. It is 60 seconds by default. The value range is [10,180] seconds.</p> </td> </tr> <tr> <td style="width:257px"> <p>Keepalive timeout</p> </td> <td style="vertical-align:top; width:524px"> <p>Configure the TCP keepalive timeout time. After the connection idle time exceeds this time period, ELB will actively disconnect the connection. It is 600 seconds by default, and the value range is [10, 900] seconds.</p> </td> </tr> <tr> <td style="width:257px"> <p>Source IP address transparent transmission</p> </td> <td style="vertical-align:top; width:524px"> <p>It is used to realize the transparent transmission capability of the four-layer TCP listener to the source IP address accessed. This function is turned off by default. If you need to obtain the source IP address, we recommend that you turn on this function. After you turn on this function, the TCP listener will carry the access source IP address to the back-end server. An nginx process needs to be started on the cloud server in the pool, and the configuration is as follows:</p> <p>stream {</p> <p>log_format basic &#39;$proxy_protocol_addr - $remote_user [$time_local] &#39;</p> <p>&#39;$protocol $status $bytes_sent $bytes_received &#39;</p> <p>&#39;$session_time&#39;;</p> <p>access_log /var/log/nginx/stream.access.log basic; #The source address falls to the log file</p> <p>server {</p> <p>listen 8012 proxy_protocol; #Resolve source address</p> <p>proxy_pass 127.0.0.1:8883; #Proxy to back-end application</p> <p>}</p> <p>}</p> </td> </tr> </tbody> </table> <p>7.&nbsp;Click<strong> Next</strong> and configure the health check information of the TCP listener as described in the following tables.</p> <p><img src="https://obs-cn-shanghai.yun.pingan.com/pcp-portal/20201607112951-1da28b3f9404.png" style="height:463px; width:830px" /></p> <p><strong>Health check</strong></p> <table border="1" cellpadding="0" cellspacing="0" style="width:0px"> <tbody> <tr> <td style="background-color:#ededed; width:153px"> <p><strong>Configuration item</strong></p> </td> <td style="background-color:#ededed; vertical-align:top; width:628px"> <p><strong>Description</strong></p> </td> </tr> <tr> <td style="width:153px"> <p>Health check</p> </td> <td style="vertical-align:top; width:628px"> <p>You can choose to turn on or off the health check function. If you turn on the health check function, the ELB service will check the health status of the hosts in the server resource pool. If the ELB service finds that there is a problem with a host, it will forward the request to other normal hosts. When the host returns to normal, the ELB service will resend the request to the host.</p> <p>After you turn on the health check function, you need to configure the following parameters.</p> </td> </tr> <tr> <td style="width:153px"> <p>Protocol</p> </td> <td style="vertical-align:top; width:628px"> <p>Select the protocol for health check. The only protocol available here is TCP.</p> </td> </tr> <tr> <td style="width:153px"> <p>Interval</p> </td> <td style="vertical-align:top; width:628px"> <p>Set the time interval between two health checks. The value range is [5, 300] seconds.</p> </td> </tr> <tr> <td style="width:153px"> <p>Timeout</p> </td> <td style="vertical-align:top; width:628px"> <p>Set the maximum timeout period for each health check response. The value range is [2, 60] seconds. During the health check, if the hosts in the server resource pool do not respond correctly within this period of time, the health check will fail.</p> </td> </tr> <tr> <td style="width:153px"> <p>Frequency threshold</p> </td> <td style="vertical-align:top; width:628px"> <p>Set the number of consecutive health checks to determine the health status of the host. The value range is [2, 10] times. If the frequency threshold is set to 3, the host is determined to be healthy after three times of successive successful health check, and the host is determined to be unhealthy after three times of successive failed health check.</p> </td> </tr> </tbody> </table> <p>8.&nbsp;Click <strong>Create</strong>, and you will see an <strong>Operation succeeded</strong> message at the bottom of the page.</p>
Did the above content solve your problem? Yes No
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products