After you bind an SLB instance to an application, you can configure different URL-based forwarding policies for different application instance groups in an ECS cluster. The SLB instance can forward requests from different paths to the instance groups of an application based on the specified forwarding policies. This topic describes how to configure URL-based forwarding policies to distribute traffic to the instance groups of an application.

Prerequisites

Background information

In an ECS cluster, you can create multiple application instance groups for an application, and deploy different versions of the application on the application instance groups. After the SLB instance is bound to the application, the following scenarios may occur:

  • If no forwarding policies are configured for different application instance groups, the traffic is randomly distributed to the application instances in each group.
  • If forwarding policies are configured for different application instance groups, the traffic is distributed to the application instances in each group based on the specified policies.

For example, the URL o.domain.com/orders/queryitem is used to query product information in the ordering system. In the scenario of flash sales, this URL is frequently requested compared with the URLs of other services. Therefore, you can deploy the service of querying product information to the flash sales-specific group, and deploy other services to the default group. Then, you can configure URL-based forwarding policies in the SLB instance so that the requests to query product information are forwarded to the flash sales-specific group, and other requests are forwarded to the default group.

Architecture of binding an SLB instance to application instance groups

Configure vServer groups and forwarding policies for application groups

Configure vServer groups and forwarding policies in the bound SLB instance for the preceding two groups.

Note The procedure is the same. However, you cannot configure the same vServer group for the two groups.
  1. Log on to the EDAS console.
  2. In the left-side navigation pane, click Applications.
  3. On the Applications page, select a region in the top navigation bar and select a namespace from the Namespace drop-down list. From the Cluster Type drop-down list, select ECS Cluster. Then, click the required application name in the application list.
  4. On the Basic Information page, click the Instance Deployment Information tab.
  5. On the Instance Deployment Information tab, click Group Settings next to the default group, and then select Internet SLB Information from the drop-down list.
  6. In the Group Settings dialog box, select a vServer group, configure a forwarding policy, and then click Next.

    You can use one of the following methods to configure a vServer group and URL-based forwarding policy for an application instance group:

    • If you want to use the vServer group that is created for the specified SLB instance, perform the following operations:
      1. Select Existing VServer Group and then select an existing vServer group.
        Notice A vServer group can be bound to only one application or application group.
      2. Configure a forwarding policy.
        • To use a forwarding policy that is configured for the vServer group, select Modify the forwarding policy of the current VServer group and then select the required forwarding policy.
        • If no forwarding policies have been configured for the vServer group or you want to add a forwarding policy, select Add Forwarding Policy and then specify a domain name in the Forwarding Policy field.
    • If no vServer group has been configured for the specified SLB instance or you want to add a vServer group for the application, perform the following steps:
      1. Select Create VServer Group and specify the VServer Group Name parameter.
      2. Select Add Forwarding Policy and then specify a domain name in the Forwarding Policy field.
  7. On the Application SLB Change Ticket tab, click Confirm.

Verify the result

Check whether you can access the application by using the URLs of the two application instance groups.