Updated on 2024-07-01 GMT+08:00

Configuring Load Balancing

This section describes how to configure the endpoint for component access from outside the environment. Access it from your VPC or Internet.

CAE allows you to configure multiple load balancers at the same time to implement multiple access modes for a component.

Up to 10 load balancers can be configured for a component at the same time.

Prerequisites

You have created an application and component.

Adding a Load Balancing Configuration

  1. Log in to CAE.
  2. Choose Component Configurations.
  3. Select the target component from the drop-down list in the upper part of the page.
  4. Click Edit in the Access Mode module.
  5. In the Access Component from Another Environment area, click Load Balancing > Add Load Balancer.
  6. On the Create Load Balancer page, set parameters by referring to Table 1.

    Table 1 Configuring load balancing for public network access

    Parameter

    Description

    Load Balancer

    You can select Dedicated or Built-in load balancer.

    • If you select Built-in load balancer, only EIP-based public network access is supported.
    • If you select Dedicated, select the corresponding load balancer from the drop-down list.
      NOTE:

      If no load balancer is available, click Create Load Balancer to create a load balancer. For details, see Creating a Dedicated Load Balancer.

    Health Check

    The health check is for the load balancer.

    • Disable
    • Enable: default.
      • Protocol

        Protocol type of a health check request.

        Value: TCP or HTTP. Default value: TCP.

        NOTE:

        The protocol cannot be directly switched. To switch the protocol, disable it before selecting another one.

      • Check Path

        This parameter is mandatory when Protocol is set to HTTP.

        Health check URL. The path must start with a slash (/) and contain 1 to 80 characters.

        It can contain letters, digits, and the following characters: -/.%?&_.

      • Check Interval (s)

        Interval for sending health check requests, in seconds.

        Value range: 1 to 50. Default value: 5.

      • Timeout (s)

        Maximum time required for waiting for a response from the health check, in seconds.

        Value range: 1 to 50. Default value: 10.

      • Max. Retries

        Maximum number of health check retries.

        Value range: 1 to 10. Default value: 3.

    Access Control

    You can create an access control policy to allow or forbid an IP address to access a component. The value can be an IP address or an IP network segment.

    • Allow all IP addresses
    • Whitelist

      Only IP addresses in the whitelist are allowed to access the component.

    • Blocklist

      IP addresses in the blocklist are forbidden to access the component.

    Port Settings

    • Protocol: TCP and UDP are supported.
    • Listening Port: listening port of the program in a component, which is obtained from the user program code.

      Value range: 1 to 65535.

    • Access Port: port provided by a component for external access, which is set by user and must be unique.

      Value range: 1 to 65535.

    Figure 1 Configuring load balancing
    Figure 2 Configuring health check

  7. Click OK.
  8. (Optional) To add more load balancing configurations, repeat 5 to 7.
  9. Click OK.
  10. Make the configurations take effect.

    • If the component has been deployed, click Activate Settings in the upper part of the page. In the dialog box displayed on the right, confirm the configurations and click OK for the configurations to take effect.
    • If the component has not been deployed, click Set and Deploy Component in the upper part of the page. In the dialog box displayed on the right, click OK. After the deployment is complete, the configurations take effect.

    If a Nginx component is used, the protocol is TCP, listening port is 80, and access port is 8089. After deployment, choose Components, click the public network address in the Access Address column of the Nginx component to view its static web page.

    If you have configured an access control whitelist or blocklist, only IP addresses in the whitelist or not in the blocklist can access the component.
    Figure 3 Public network access

    You can also use a domain name for access, for example, http://test-test-7.com:8089, if you have added a domain name and bound it.

    Figure 4 Configuring a domain name
    Figure 5 Access using a domain name

Modifying a Load Balancing Configuration

  1. Log in to CAE.
  2. Choose Component Configurations.
  3. Select the target component from the drop-down list in the upper part of the page.
  4. Click Edit in the Access Mode module.
  5. In the Access Component from Another Environment area, click Load Balancing.
  6. Find the target configuration item and click Edit in the Operation column.

    Figure 6 Modifying a load balancing configuration

  7. Modify parameter settings by referring to Table 1.
  8. Click OK.
  9. Click OK.
  10. Make the configurations take effect.

    • If the component has been deployed, click Activate Settings in the upper part of the page. In the dialog box displayed on the right, confirm the configurations and click OK for the configurations to take effect.
    • If the component has not been deployed, click Set and Deploy Component in the upper part of the page. In the dialog box displayed on the right, click OK. After the deployment is complete, the configurations take effect.

Deleting a Load Balancing Configuration

  1. Log in to CAE.
  2. Choose Component Configurations.
  3. Select the target component from the drop-down list in the upper part of the page.
  4. Click Edit in the Access Mode module.
  5. In the Access Component from Another Environment area, click Load Balancing.
  6. Find the target configuration item and click Delete in the Operation column.
  7. In the displayed dialog box, click Yes.

    Figure 7 Deleting a Load Balancing Configuration

  8. Click OK.
  9. Make the configurations take effect.

    • If the component has been deployed, click Activate Settings in the upper part of the page. In the dialog box displayed on the right, confirm the configurations and click OK for the configurations to take effect.
    • If the component has not been deployed, click Set and Deploy Component in the upper part of the page. In the dialog box displayed on the right, click OK. After the deployment is complete, the configurations take effect.