百度智能云

All Product Document

          Load Balance

          Application BLB Instance

          The flow chart of using the application BLB instance by the user is as follows:

          BLB1.jpg

          There are four steps as below:

          Step 1: Create application BLB instance;

          Step 2: Configure server groups including port configuration, health check, and adding servers;

          Step 3: Configure the listener;

          Step 4: View monitoring and set alarms;

          Create Application BLB Instance

          1. Log in to the Baidu AI Cloud Platform, and select "Product Services" > "Baidu Load Balance (BLB)" > "Application Instances" to enter the "Instance List Page".
          2. Click "Create BLB" to enter the interface for creating instances.

            Note:

            Before creating a BLB instance, you should first create a BCC example; otherwise, you cannot create a BLB instance.

          3. Select configuration information.

            • Basic information: You can select the region and set the instance name. The network is the private network (VPC) to which the cloud resources currently created such as BLB and corresponding BCC belong.

            Note: Users need to specify a subnet when creating a BLB instance.

            • Configure public network access: You can select to "Enable" or "Disable" public network access according to the actual situation

              • If "OFF" is selected, disable. The public IP address is not bound when the BLB instance is created. You can bind the public IP address as required after you purchase the service.
              • If "ON" is selected, enable. It indicates that the public network IP is purchased and bound when the BLB instance is created.
            • Purchase information: Select the purchase quantity and whether the configuration is released automatically.

            Note: When creating a BLB instance, the user can directly set the automatic release of the BLB instance, and the BLB instance will be automatically released at the set time.

            (Optional. The system will automatically skip this step if public network access is disabled) Configure EIP instance information. For how to configure an EIP instance, please see Create EIP Instance.

            image.png

          4. Confirm the configuration information and complete the order confirmation and payment according to the prompt of the system. The user will receive a text message prompt if the creation is successful.

          Configure Server Group

          The steps to configure a server group are:

          1. Fill in the basic information of the server group
          2. Configure open ports;
          3. Add the server group;

          Note: A server group can correspond to multiple open ports, for example: Server Group A can open both TCP 80 and HTTP 80 ports.

          Fill in the Basic Information of the Server Group

          Operation Steps

          1. Select "Product Services" > "Baidu Load Balance (BLB)"> "Application Instance" to enter the application instance list.
          2. Click the ID link in the "Load Balance ID/Name" column to enter the instance details page.
          3. Select "Target Group" in the left navigation bar, and click "Server Group" on the details page to enter the Add Server Group Configuration page, and fill in the server group name and description.

          Configure TCP Protocol Open Ports

          Operation Steps

          1.Enter the Add Server Group Configuration page, click "Add Port" for basic settings and health check settings of the listener, and select TCP for the open protocol [Port].

          2.Set the configuration information.

          Project Description
          Open protocol [port] Specify the protocol and port on which the backend server provides services. The BLB service forwards the request to the target service. The port on which the target service listens. The port input range is an integer from 1 to 65,535.The default is "80".

          3.Set up a health check.

          ProjectDescription
          Health Check AgreementSpecify the type of protocol used when checking the health of the backend server.
          Response timeoutIf no response is received from the backend server within the specified time, the backend server response is considered to have timed out.
          Health check interval Interval for checking backend servers.
          Unhealthy thresholdIf the number of consecutive health check failures of the backend server exceeds the threshold, the server is considered unhealthy.
          Healthy thresholdFor an unhealthy server, if the number of consecutive health check successes exceeds the threshold, the server is considered healthy.

          4.After completing the above configuration, click the "OK" button to finish the configuration of the TCP protocol open port.

          Configure UDP Protocol Open Ports

          Operation Steps

          1.Enter the Add Server Group Configuration page, click "Add Port" to perform basic settings and health check settings of the listener, and select UDP for the open protocol [Port].

          2.Set the configuration information.

          ProjectDescription
          Open protocol [port]Specify the protocol and port on which the backend server provides services. The BLB service forwards the request to the target service. The port on which the target service listens. The port input range is an integer from 1 to 65,535.The default is "80".

          3.Set up a health check.

          Item Description
          Health Check Agreement Specify the type of protocol used when checking the health of the backend server.
          Check the string BLB is capable of implementing health check by sending a UDP packet with user-specified strings to back-end members.
          You need to configure the application to complete the response. Under the circumstance where the back-end server is a DNS server,
          You can configure the DNS resolution request as a health check packet. The default value is the DNS resolution request sent to baidu.com
          (\00\01\01\00\00\01\00\00\00\00\00\00\05baidu\03com\00\00\01\00\01)。
          Response timeout If no response is received from the backend server within the specified time, the backend server response is considered to have timed out.
          The input range is an integer from 1 to 60. It is recommended to set it to 3 seconds.
          Health check interval Interval for checking backend servers. The input range is an integer from 1 to 10.It is recommended to set it to 3 seconds.
          Unhealthy threshold If the number of consecutive health check failures of the backend server exceeds the threshold, the server is considered unhealthy.
          Healthy threshold For an unhealthy server, if the number of consecutive health check successes exceeds the threshold, the server is considered healthy.

          4.After completing the above configuration, click the "OK" button to finish the configuration of the UDP open port.

          Configure HTTP Protocol Open Ports

          1.Enter the Add Server Group Configuration page, click "Add Port" for basic settings and health check settings of the listener, and select HTTP for the open protocol [Port].

          2.Set the configuration information.

          ProjectDescription
          Open protocol [port]Specify the protocol and port on which the backend server provides services. The BLB service forwards the request to the target service. The port on which the target service listens. The port input range is an integer from 1 to 65,535.The default is "80".

          3.Set up a health check.

          Item Description
          Health Check Agreement Specify the type of protocol used when checking the health of the backend server. You can select "HTTP" or "TCP"
          Check port Specify the port on which the backend server provides services. The field is valid only for HTTP health checks.
          Check path URI for health check page files. It is recommended to check static pages.
          Length is limited to 1-80 characters. Only letters, numbers, -, /, ., %, ?, # and & can be used. The field is valid only for HTTP health checks.
          Response timeout If no response is received from the backend server within the specified time, the backend server response is considered to have timed out.
          Health check interval Interval for checking backend servers.
          Unhealthy threshold If the number of consecutive health check failures of the backend server exceeds the threshold, the server is considered unhealthy.
          Healthy threshold For an unhealthy server, if the number of consecutive health check successes exceeds the threshold, the server is considered healthy.
          Normal code status Normal HTTP status code for health check. You can select "http_2xx", "http_3xx", "http_4xx" and "http_5xx". The field is only valid for HTTP health check
          1. After completing the above configuration, click the "OK" button to complete the HTTP protocol server group configuration.

          Add Server Group

          Click "Add Server" in the server group details page to enter the "Add Backend Server" menu bar, select the server name to be added to the server group, and then select "Next" to set the server weight. Finally, click "OK" to complete the steps of adding a server group.

          Note:

          During the process of adding servers, all servers must be in the same VPC as the application BLB instance.

          Configure backend server weights. Weights are used to set different request forwarding ratios for different backend server instances. For example, if there are two backend server instances with different configurations, for the higher-configuration instance, you can select to set a higher weight to receive more external access requests.

          The weight value is a relative value. If it is set to the same value, the forwarding ratio is the same.

          Support setting a weight value ranging from 0 to 100. The higher the weight is, the more requests are received; if the weight is set to "0", no new requests will be received.

          Non-zero weights have no effect on forwarding rules other than weighted round-robin.

          Server Security Group Settings

          For the server security group settings of the general BLB instance, please see Security Group Settings of the Common BLB Instance

          Edit Port

          On the "Open Port" tab, click < Edit> to jump to the editing interface. After editing, click < OK>.

          Delete Port

          1. On the "Open Ports" tab, select the monitoring settings you want to delete and click the < Delete > button.
          2. On the pop-up interface, click < OK> to complete the release.

          After filling in the basic information of the server group, adding servers, and configuring open ports, click "OK" at the bottom of the page to complete the steps to create server group.

          Configure IP Group

          The main steps for configuring IP group include:

          1. Fill in the basic information of IP group
          2. Configure open protocol;
          3. Add IP.

          Note: IP group is only available to Whitelist users only at present. To use, please submit a Work Order .

          Fill in the basic information of IP group

          Operation steps

          1.Select "Product Services" -> "BLB"> "Application Instance" to enter the application instance list. 2.Click the ID link in the "Load Balancing ID/Name" column to enter the instance details page. 3.Select the "Target Group" in the left navigation bar, select the "IP Group" tab on the details page, and click "Add IP Group" to enter the adding IP group configuration page, and fill in the IP group name and description.

          Configure TCP Open Protocol

          Operation steps

          1.Enter the Add IP Group configuration page, click "New Protocol" to perform basic settings and health check of listener, and select TCP for the open protocol.

          2.Set the configuration information.

          Item Description
          Open Protocol Specify the protocol for backend members providing service. The BLB service forwards the request to backend members.

          3.Set up a health check.

          ItemDescription
          Health Check Agreement Specify the protocol type to use for checking the health status of back-end members.
          Response timeout If no response is received from backend member within a specified time, the backend member response is deemed as timeout.
          Health check interval Time interval for checking backend members.
          Unhealthy threshold If the number of consecutive failed health checks of a backend member exceeds the threshold, this backend member is regarded as unhealthy.
          Healthy threshold For an unhealthy backend member, if the number of consecutive succeeded health checks exceeds the threshold, this backend member is regarded as healthy.

          4.After completing the above configuration, click the "OK" button to complete the configuration of TCP open protocol.

          Configure UDP Open Protocol

          Operation steps

          1.Enter the Add IP Group configuration page, click "New Protocol" to perform basic settings and health check of listener, and select UDP for the open protocol.

          2.Set the configuration information.

          ItemDescription
          Open ProtocolSpecify the protocol and port for backend members providing service. The BLB service forwards the request to backend members.

          3.Set up a health check.

          Item Description
          Health Check Agreement Specify the protocol type to use for checking the health status of back-end members.
          Check string BLB sends UDP packet containing user-specified string to backend members to realize health check. You need to configure App to complete the response. In the case of DNS backend server, you can configure DNS resolution requests to serve as health check packets. The default is to request
          (00\01\01\00\01\00\00\00\00\00\00\05baidu\03com\00\00\01\00\01 ) for DNS resolution of baidu.com.
          Response timeout If no response is received from backend member within a specified time, the backend member response is deemed as timeout. The input range is an integer from 1 to 60. It is recommended to set it to 3 seconds.
          Health check interval Time interval for checking backend members. The input range is an integer from 1 to 10. It is recommended to set it to 3 seconds.
          Unhealthy threshold If the number of consecutive failed health checks of a backend member exceeds the threshold, this backend member is regarded as unhealthy.
          Healthy threshold For an unhealthy backend member, if the number of consecutive succeeded health checks exceeds the threshold, this backend member is regarded as healthy.

          4.After completing the above configuration, click the "OK" button to complete the configuration of UDP open protocol.

          Configure HTTP Open Protocol

          1.Enter the Add IP Group configuration page, click "New Protocol" to perform basic settings and health check of listener, and select HTTP for the open protocol.

          2.Set the configuration information.

          ItemDescription
          Open protocol [port] Specify the protocol for backend members providing service. The BLB service forwards the request to backend members.

          3.Set up a health check.

          Item Description
          Health Check Agreement Specify the protocol type to use for checking the health status of back-end members. "HTTP" can be selected.
          Check port Specify the port for back-end members providing service. The field is valid only for HTTP health checks.
          Check path URI for health check page files. It is recommended to check static pages. The length is limited to 1-80 characters, you can only use such characters as letters, numbers, ‘-’, ‘/’, ‘.’, ‘%’, ‘?’, '#', '&'. The field is valid only for HTTP health checks.
          Response timeout If no response is received from backend member within a specified time, the backend member response is deemed as timeout.
          Health check interval Time interval for checking backend members.
          Unhealthy threshold If the number of consecutive failed health checks of a backend member exceeds the threshold, this backend member is regarded as unhealthy.
          Healthy threshold For an unhealthy backend member, if the number of consecutive succeeded health checks exceeds the threshold, this backend member is regarded as healthy.
          Normal code status Normal HTTP status code for health check. You can select "http_2xx", "http_3xx", "http_4xx" and "http_5xx". The field is only valid for HTTP health check

          4.After completing the above configuration, click the "OK" button to complete the configuration of HTTP open protocol.

          Add IP Group

          On the server group details page, click "Add IP" to open the "Add IP" menu bar, fill in the IP address + port to be added into this IP group, and set the weight. Finally, click "OK" to complete the IP addition.

          Note:

          In the process of adding IP, all IPs need to be in a same VPC as the application-oriented BLB instance.

          Configure the weight of the backend members, that is, IPs + ports. The weight is used to set different request forwarding ratio for different back-end members. For example, there are two backend members with different configurations, the member with higher configuration can be set with higher weight for receiving more external access requests.

          The weight value is a relative value. If it is set to the same value, the forwarding ratio is the same.

          Support setting a weight value ranging from 0 to 100. The higher the weight is, the more requests are received; if the weight is set to "0", no new requests will be received.

          Non-zero weights have no effect on forwarding rules other than roundrobin.

          Configure Listener For the Application BLB Instance

          Including the configuration of TCP, UDP, HTTP and HTTPS listeners

          TCP Listener

          1. Select "Product Services" > "Baidu Load Balance (BLB)"> "Application Instance" to enter the application instance list.
          2. Click the ID link in the "Load Balance ID/Name" column to enter the instance details page.
          3. Click "Monitoring Settings > Add Monitoring Settings" in the left navigation bar to configure the basic settings of the listener. Select "TCP" for the listening protocol [Port].
          4. Set the configuration information.

            Item Description
            Listening protocol [Port] Specify the protocol and port that the BLB listener listens on. The port input range is an integer from 1 to 65,535.The default is "80".
            Scheduling method Weighted round-robin: Requests are sent to the backend server in turn according to the weight of the backend server, which is often used for short connection services such as HTTP service. For how to configure weights, please see the chapter "Configure Backend Servers".
            Least connection: Requests are sent to backend servers with the Least connection first. It is often used for long-connection services such as database connection services. With this algorithm, server weights do not take effect.
          5. Advanced options

            Item Description
            keep session If you select "Enable" to enable session persistence, the listener will use the source IP algorithm as the scheduling method.
            Source IP: Only for the case where the BLB protocol is configured as TCP. The requested source IP is hashed and distributed to a matching server. This can ensure that requests for the same client IP are always sent to a certain server. The source IP algorithm provides a keep session mechanism for TCP listeners. With this algorithm, server weights do not take effect.
          6. Set up forwarding rules.

            Item Description
            Target server group Forward the traffic that matches the rule to the specified server group
            Target port Forward the traffic that matches the rule to the specified open port of the specified server group

            Note: TCP listener has only one default forwarding rule, and the rule cannot be deleted. For example: Forward the traffic received by the listener to TCP Port 80 of Server Group A. Select Server Group A in the target server group, and select TCP 80 in the target port.

          7. After completing the above configuration, click the "OK" button to finish adding the TCP listener.

          UDP Listener

          Scenario introduction

          Common application scenarios for UDP traffic are: DNS services, the Internet of Things, and some scenarios where data transmission reliability is not highly required.

          Operation steps

          If the health check is enabled, BLB will automatically block unhealthy backend servers.

          1. Select "Product Services" > "Baidu Load Balance (BLB)"> "Application Instance" to enter the application instance list.
          2. Click the ID link in the "Load Balance ID/Name" column to enter the instance details page.
          3. Click "Monitoring Settings > Add Monitoring Settings" in the left navigation bar to configure the basic settings of the listener. Select "UDP" for the listening protocol [Port].
          4. Set the configuration information.

            Item Description
            Listening protocol [Port] Specify the protocol and port that the BLB listener listens on. The port input range is an integer from 1 to 65,535.The default is " 53".
            Scheduling method weighted round-robin: Requests are sent to the backend server in turn according to the weight of the backend server, which is often used for short connection services such as HTTP service. For how to configure weights, please see the chapter "Configure Backend Servers".
            Least connection: Requests are sent to backend servers with the Least connection first. It is often used for long-connection services such as database connection services. With this algorithm, server weights do not take effect.
            keep session Session persistence is enabled. The listener will use the source IP algorithm as the scheduling method.
          5. Advanced options

            Item Description
            keep session If you select "Enable" to enable session persistence, the listener will use the source IP algorithm as the scheduling method. Source IP: Only for the case where the BLB protocol is configured as TCP. The requested source IP is hashed and distributed to a matching server. This can ensure that requests for the same client IP are always sent to a certain server. The source IP algorithm provides a keep session mechanism for TCP listeners. With this algorithm, server weights do not take effect.
          6. Set up forwarding rules.
          Item Description
          Target server group Forward the traffic that matches the rule to the specified server group
          Target port Forward the traffic that matches the rule to the specified open port of the specified server group

          Note: UDP listener has only one default forwarding rule, and the rule cannot be deleted. For example: Forward the traffic received by the listener to UDP Port 53 of Server Group A. Select Server Group A in the target server group, and select UDP 53 in the target port. 7.After completing the above configuration, click the "OK" button to finish adding the UDP listener.

          HTTP Listener

          1. Select "Product Services" > "Baidu Load Balance (BLB)"> "Application Instance" to enter the application instance list.
          2. Click the ID link in the "Load Balance ID/Name" column to enter the instance details page.
          3. Click "Monitoring Settings > Add Monitoring Settings" in the left navigation bar to configure the basic settings of the listener. Select "HTTP" for the listening protocol [Port].
          4. Set the configuration information.

            Item Description
            Listening protocol [Port] Specify the protocol and port that the BLB listener listens on. The port input range is an integer from 1 to 65,535.The default is "80".
            Scheduling method weighted round-robin: Requests are sent to the backend server in turn according to the weight of the backend server, which is often used for short connection services such as HTTP service. For how to configure weights, please see the chapter "Configure Backend Servers".
            Least connection: Requests are sent to backend servers with the Least connection first. It is often used for long-connection services such as database connection services. With this algorithm, server weights do not take effect.
            Timeout period The timeout period for waiting for the response from the backend server; if the backend server takes a long time to process the request, you can increase the value appropriately. It is 30 seconds by default.
          5. Advanced options.

            Item Description
            keep session The TCP listener can maintain the session through the source IP forwarding rules; the 7-layer listener (HTTP and HTTPS) maintains the session by inserting/modifying cookies. You can select "On" or "Off".
            Append HTTP header Attach a header field to the HTTP request to obtain the client's real IP or listening protocol information when the backend server processes the message.
            Get real IP: If this feature is enabled, the user's IP address can be recorded in the X-Forwarded-For header field;
            Get the monitoring protocol: If this feature is enabled, the monitoring protocol can be recorded in the X-Forwarded-Proto header field.
            Enable HTTPS redirect Redirects this listener's HTTP request to this BLB's HTTPS listener. Please make sure the HTTPS listener on the corresponding port is working properly. You can select "On" or "Off". Off by default.
            Other options When this option is enabled, if the HTTP request contains non-ASCII characters, BLB will pass it and forward it to the backend server for processing. Enabling this option may bring security risks. It is recommended to keep it off for non-special use scenarios. Off by default.
          6. Set up forwarding rules.

            Item Description
            Forwarding rules You can set domain name, URL, and forwarding rules matching all
            Target server group Forward the traffic that matches the rule to the specified server group
            Target port Forward the traffic that matches the rule to the specified open port of the specified server group

            Note:

            • The smaller the priority value, the higher the priority, and the priority is not allowed to be repeated.
            • When a single rule has both the domain name and URL conditions, the conditions must be met at the same time to be considered a successful match.
            • Match content restrictions on forwarding rules of domain name:

              1. Limited length < 100
              2. Wildcard characters only support *
              3. The wildcard * can appear 0 or 1 time
              4. The wildcard * matches 0-n characters
              5. Only prefix matching is supported, that is, * can only appear at the beginning of a domain name, such as: *.baidu.com
            • Match content restrictions on forwarding rules of URL:

              1. Limited length < 100
              2. Wildcard characters only support *
              3. The wildcard * can appear 0 or 1 time
              4. The wildcard * matches 0-n characters
              5. Prefix, infix and suffix matching is supported, that is, * can appear anywhere in the matching rule

            For example: Forward the traffic received by the listener to HTTP Port 80 of Server Group A. Select Server Group A in the target server group, and select HTTP 80 in the target port.

          7. After completing the above configuration, click the "OK" button to finish adding the HTTP listener.

          HTTPS Listener

          To ensure information security, users can configure the protocol of the BLB listener to HTTPS. BLB decrypts the user's HTTPS request and then sends it to the backend server; the packet returned after the backend server processes the request is first sent to BLB, encrypted by BLB, and then returned to the user side. The whole process is shown in the following figure:

          blb_https01.png

          Pre-task

          Before configuring the HTTPS listener, you should first apply for a certificate and upload the certificate to the certificate management module. For details, please see Certificate Management.

          Operation Steps

          1. Select "Product Services" > "Baidu Load Balance (BLB)"> "Application Instance" to enter the application instance list.
          2. Click the ID link in the "Load Balance ID/Name" column to enter the instance details page.
          3. Click "Monitoring Settings > Add Monitoring Settings" in the left navigation bar to configure the basic settings of the listener. Select "HTTPS" for the listening protocol [Port].
          4. Set the configuration information.

            Item Description
            Listening protocol [Port] Specify the protocol and port that the BLB listener listens on. The port input range is an integer from 1 to 65,535.The default is " 443".
            Scheduling method weighted round-robin: Requests are sent to the backend server in turn according to the weight of the backend server, which is often used for short connection services such as HTTP service. For how to configure weights, please see the chapter "Configure Backend Servers".
            Least connection: Requests are sent to backend servers with the Least connection first. It is often used for long-connection services such as database connection services. With this algorithm, server weights do not take effect.
            Certificate Before configuring the HTTPS listener, you should first apply for a certificate and upload the certificate to the certificate management module. For specific operations, please see Certificate Management.
            Encryption options You can select "IE-compatible encryption method" or "Disable insecure encryption method".
            You can configure the SSL encryption protocol and algorithm through "Encryption Options". The system enables IE-compatible encryption by default; if you disable the encryption method with hidden security risks, it may not be compatible with earlier versions of clients.
            Timeout period The timeout period for waiting for the response from the backend server; if the backend server takes a long time to process the request, you can increase the value appropriately. It is 30 seconds by default.
          5. Advanced options

            Item Description
            keep session The TCP listener can maintain the session through the source IP forwarding rules; the 7-layer listener (HTTP and HTTPS) maintains the session by inserting/modifying cookies. You can select "On" or "Off". Off by default.
            Append HTTP header Attach a header field to the HTTP request to obtain the client's real IP or listening protocol information when the backend server processes the message.
            Get real IP: If this feature is enabled, the user's IP address can be recorded in the X-Forwarded-For header field;
            Get the monitoring protocol: If this feature is enabled, the monitoring protocol can be recorded in the X-Forwarded-Proto header field.
            HTTP requests allow non-ASCII characters When this option is enabled, if the HTTP request contains non-ASCII characters, BLB will pass it and forward it to the backend server for processing. Enabling this option may bring security risks. It is recommended to keep it off for non-special use scenarios. Off by default.
          6. Set up forwarding rules.

            Item Description
            Forwarding rules You can set forwarding rules for domain name, HOST, and both
            Target group Forward the traffic that matches the rule to the specified server group or IP group
            Target port Forward the traffic that matches the rule to the specified open port of the specified server group

            Note:

            • The smaller the priority value, the higher the priority, and the priority is not allowed to be repeated.
            • When a single rule has both the domain name and URL conditions, the conditions must be met at the same time to be considered a successful match.
            • Match content restrictions on forwarding rules of domain name:

              1. Limited length < 100
              2. Wildcard characters only support *
              3. The wildcard * can appear 0 or 1 time
              4. The wildcard * matches 0-n characters
              5. Only prefix matching is supported, that is, * can only appear at the beginning of a domain name, such as: *.baidu.com
            • Match content restrictions on forwarding rules of URL:

              1. Limited length < 100
              2. Wildcard characters only support *
              3. The wildcard * can appear 0 or 1 time
              4. The wildcard * matches 0-n characters
              5. Prefix, infix and suffix matching is supported, that is, * can appear anywhere in the matching rule

            For example: Forward the traffic received by the listener to HTTP Port 80 of Server Group A. Select Server Group A in the target server group, and select HTTP 80 in the target port.

          7. After completing the above configuration, click the "OK" button to finish adding the HTTPS listener.

          Edit Listening

          On the "Monitoring Settings" tab, click < Edit> to jump to the editing interface. After editing, click < OK>.

          Release Listening

          1. On the "Monitoring Settings" tab, select the monitoring settings you want to release and click the < Release> button.
          2. On the pop-up interface, click < OK > to complete the release.
          Previous
          Common BLB Instance
          Next
          Extension Domain