Backend Sets

This section describes how to use backend sets to create logical entities consisting of a load balancing policy, health check policy, and a list of backend servers for a Load Balancer resource.

Creating a Load Balancer Backend Set

You can create a backend set for an existing load balancer. The backend set is a group of servers to which traffic is load balanced. You can create backend servers after you create the backend set, or at the same time. This topic creates only the backend set.

Using the Compute Web UI

  1. Open the Navigation Menu. Under Networking, click Load Balancers.

  2. Click the name of the Load Balancer for which you want to create the load balancer backend set.

  3. Click Backend Sets under Resources.
  4. Any existing backend sets are listed, otherwise the list says No data available. To create a backend set, click Create Backend Set.
  5. Enter the following information:

    • Name: Enter a descriptive name for the LB backend set. This must be unique and can't be changed.

    • Traffic Distribution Policy: Select load balancer policy for the backend set. Possible values are:

      • Weighted Round Robin: Traffic is balanced in a "next turn" fashion, with some servers having a preference.

      • Least Connections: Traffic is balanced based on the server with the fewest current connections.

      • IP Hash: Traffic is balanced based on a hash of several fields in the IP header.
    • Session Persistence: Select the box to enable session persistence.
    • SSL: Select the box to use SSL with the backend set.
    • Health Checking: Enter the health checking parameters for the backend set.

      • Protocol: Choose the protocol that the health checker monitors. Possible values are: HTTP or TCP.

      • Port: Enter the port that the protocol uses.

      • Interval in Milliseconds: Enter a number between 1 and 1,800,000 for the health check interval.
      • Timeout in Milliseconds:: Enter a number between 1 and 600,000 for the health check timeout.
      • Number of Retries: Enter the number of health check retries.
      • Status Code: Enter the numeric value that the health check uses.
      • URL Path: Enter the URL path, such as /. that the health checker monitors.
      • Response Body: Enter the response body regex, such as .*, that the health checker uses.
  6. Click the Create Backend Set button in the dialog. To display the details of the new backend set, view the backend set.

Using the OCI CLI

  1. Gather the information you need to run the command:

    • Compartment OCID (oci iam compartment list --compartment-id-in-subtree true)

    • LB OCID (oci lb load-balancer list --compartment-id compartment_OCID)

  2. Run the backend set create command.

    Use the LB OCID and backend set name to create the backend set for the LB in the specified compartment.

    Note:

    For information about optional parameters, run the command with the --help option.

    Syntax (entered on a single line):

    oci lb backend-set create --health-checker-protocol health-checker-protocol-name \
      --load-balancer-id load-balancer_OCID \  
      --name backend-set-name --policy load-balancer-policy --backends \ 
      backends-info-complex-type --health-checker-port port-number \ 
      --health-checker-response-body-regex regex --health-checker-return-code code-number  

    Where:

    health-checker-protocol-name is the protocol associated with the health checker, such as HTTP.

    load-balancer_OCID is the OCID of the load balancer associated with the backend set and servers.

    backend-set-name is the name specific to the backend set.

    load-balancer-policy is the policy associated with the load balancer.

    backends-info-complex-type are the parameters associated with the backend servers, which are configured here. This is complex type data and must be valid JSON. If no backend servers are configured with this command, enter '[]'.

    port-number is the port number associated with the health checker.

    health-checker-response-body-regex is the regex specific to the health checker.

    code-number is the numeric code returned by the health checker.

    Example:

    oci lb backend-set create --health-checker-protocol TCP \ 
      --load-balancer-id ocid1.loadbalancer....….….….uniqueID --name BackendSet1 \
      --policy LEAST_CONNECTIONS --backends '[]' --health-checker-port 22 \ 
      --health-checker-response-body-regex ".*" --health-checker-return-code 200
    
    {
      "opc-work-request-id": "ocid1.workrequest.....….….….uniqueID "
    }
    

    Note:

    The command returns a work request ID. To see the backend set results, you must list backend sets associated with the specified LB and verify that the backend set created is listed. Use the oci lb backend-set list command to view the backend set details.
    oci lb backend-set list --load-balancer-id ocid1.loadbalancer.....….….….uniqueID  
     
    {
      "data": {
        "backends": [],
        "health-checker": {
          "interval-in-millis": 10000,
          "port": 80,
          "protocol": "HTTP",
          "response-body-regex": ".*",
          "retries": 3,
          "return-code": 200,
          "timeout-in-millis": 3000,
          "url-path": "/"
        },
        "lb-cookie-session-persistence-configuration": null,
        "name": "BackendSet1",
        "policy": "LEAST_CONNECTIONS",
        "session-persistence-configuration": null,
        "ssl-configuration": null
      },
    "etag": "90000"
    }

Viewing Load Balancer Backend Set Details

You can view a list of the servers in a backend set of an existing load balancer and view their details.

Using the Compute Web UI

  1. Open the Navigation Menu. Under Networking, click Load Balancers.

  2. Click the name of the Load Balancer for which you want to list the existing load balancer backend set details.

  3. Click the Backend Sets under Resources to display a list of any available backend sets.
  4. If the load balancer backend set exists, you can view its details by clicking on the backend set name or under the Action (three vertical dots) pull-down menu.

Using the OCI CLI

  1. Gather the information you need to run the command:

    • Compartment OCID (oci iam compartment list --compartment-id-in-subtree true)

    • LB OCID (oci lb load-balancer list --compartment-id compartment_OCID)

  2. Run the get command.

    Use the backend set name and LB OCID to view the details for the LB backend set in the specified compartment.

    Note:

    For information about optional parameters, run the command with the --help option.

    Syntax (entered on a single line):

    oci lb backend-set get --backend-set-name backend_set_name \ 
      --load-balancer-id load-balancer_OCID 

    Example:

    $ oci lb backend-set get --backend-set-name My-Backend-Set-1 \ 
      --load-balancer-id load-balancer_OCID
    
    {
      "data": {
        "backends": [
          {
            "backup": false,
            "drain": false,
            "ip-address": "192.168.2.10",
            "name": "192.168.2.10:80",
            "offline": false,
            "port": 80,
            "weight": 1
          },
          {
            "backup": false,
            "drain": false,
            "ip-address": "192.168.2.11",
            "name": "192.168.2.11:80",
            "offline": false,
            "port": 80,
            "weight": 1
          }
        ],
        "health-checker": {
          "interval-in-millis": 10000,
          "port": 0,
          "protocol": "HTTP",
          "response-body-regex": ".*",
          "retries": 3,
          "return-code": 200,
          "timeout-in-millis": 3000,
          "url-path": "/"
        },
        "lb-cookie-session-persistence-configuration": {
          "cookie-name": null,
          "disable-fallback": null,
          "domain": null,
          "is-http-only": null,
          "is-secure": null,
          "max-age-in-seconds": null,
          "path": null
        },
        "name": "My-Backend-Set-1",
        "policy": "ROUND_ROBIN",
        "session-persistence-configuration": {
          "cookie-name": "My-cookie", 
          "disable-fallback": null
        },
        "ssl-configuration": null
      }
    }

Editing a Load Balancer Backend Set

You can change load balancer (LB) backend set properties, such as the health checker protocol used.

Using the Compute Web UI

  1. Open the Navigation Menu. Under Networking, click Load Balancers.

  2. Click the name of the load balancer for which you want to edit the backend set information.
  3. Under Resources, click Backend Sets.
  4. Select the name of the LB backend set that you want to edit.

  5. In the Actions list, click Edit to open the Edit Load Balancer Backend Set window.

  6. Make allowable changes in the pop-up window.

  7. Click Update Load Balancer Backend Set to update the LB Backend Set properties.

Using the OCI CLI

  1. Gather the information you need to run the command:

    • Compartment OCID (oci iam compartment list --compartment-id-in-subtree true)

    • LB OCID (oci lb load-balancer list --compartment-id compartment_OCID)

  2. Run the update command, which returns a work request ID.

    Note:

    For information about optional parameters, run the command with the --help option.

    Syntax (entered on a single line):

    oci lb backend-set update --load-balancer-id loadbalancer_OCID \
    --backend-set-name [backendset_name] \ 
    --backends [complex-type] --health-checker-protocol [protocol] \
    --policy [IP_HASH [OPTIONS] 

    Example:

    $ oci lb backend-set update --backend-set-name HTTP_BckEndSet --backends '[{"backup": false, \
      "drain": false, "ip-address": "192.168.2.10","name":"192.168.2.10:80","offline":false, \
      "port": 80, "weight": 1},{"backup": false, "drain": false, "ip-address": "192.168.2.11",\
      "name": "192.168.2.11:80","offline": false, "port": 80, "weight": 1}]' --health-checker-protocol \
      HTTP --load-balancer-id loadbalancer_OCID --policy ROUND_ROBIN
    WARNING: Updates to backends and health-checker and ssl-configuration and session-persistence-
      configuration and lb-cookie-session-persistence-configuration will replace any existing values. 
      Are you sure you want to continue? [y/N]: y
    
    {
      "opc-work-request-id": "ocid1.workrequest.xxx.loadbalancer......unique_ID"
    }

Deleting a Load Balancer Backend Set

You can delete a load balancer (LB) Backend Set and remove it from service.

Using the Compute Web UI

  1. Open the Navigation Menu. Under Networking, click Load Balancers.

  2. Click the name of the load balancer for which you want to delete the backend set.
  3. Under Resources, click Backend Sets.
  4. Select the name of the LB backend set you want to delete.

  5. Under the Actions column, click the three-dots pull-down menu, and select Terminate.

  6. Confirm the operation when prompted.

Using the OCI CLI

  1. Gather the information you need to run the command:

    • Compartment OCID (oci iam compartment list --compartment-id-in-subtree true)

    • LB OCID (oci lb load-balancer list --compartment-id compartment_OCID)

  2. Run the delete command, which returns a work request ID.

    Syntax (entered on a single line):

    $ oci lb backend-set delete --backend-set-name HTTP_BckEndSet --load-balancer-id \
      ocid1.loadbalancer....….….….uniqueID 
    Are you sure you want to delete this resource? [y/N]: y
    {
      "opc-work-request-id": "ocid1.workrequest.xxx.loadbalancer-...….….….uniqueID"
    }

    Note:

    To delete the LB backend set without verification, run the command with the --force option.