Backend Servers

Creating a Load Balancer Backend Server

You can create a backend server to add to an existing load balancer's backend set. A backend set is a group of backend servers to which traffic is load balanced.

If the backend server resides in a different VCN as the load balancer, then you must set up a Local Peering Gateway so the LB and Backend Servers can communicate.

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 a backend server.
  3. Under Resources, click Backend Sets.
  4. Click the name of the Backend Set for which you want to create the backend server.

  5. On the Details page of the backend set, click Create Backend.
  6. Enter the following information:

    • Computed Instances: The system provides a list of instances for the backend server.

    • IP Addresses: You can add backend servers by IP address. You must also provide:

      • Port: The server port to load balance.

      • Weight: The precedence assigned to this backend server within the group.

        You can add more than one IP address by clicking +Add IP Address.

    • Security Rules: To enable load balancer traffic, you must add ingress and egress security list rules to the corresponding subnets. You can choose to configure the security rules manually or automatically. The default is to manually configure the security rules.

  7. Click Submit to create the backend server. 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 server create command, which returns a work request ID.

    Use the LB OCID, backend IP address, and backend set name to create the backend server for the backend set of a specific load balancer.

    Note:

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

    Syntax (entered on a single line):

    oci lb backend create --backend-set-name backend-server-set-name \ 
    --ip-address ip-addr-of-compute-instance \ 
    --load-balancer-id load-balancer_OCID --port port-integer 

    Where:

    backend-server-set-name is the name of the existing backend server set in which to add the backend server. Example: example_backend_set.

    ip-addr-of-compute-instanceis the IP address of the backend server. Example: 10.0.0.3.

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

    port-integer is the communication port for the backend server. Example: 8080.

    Example:

    $ oci lb backend create --backend-set-name example_backend_set \ 
    --ip-address 10.0.0.3 --load-balancer-id ocid1.loadbalancer....….….….uniqueID --port 8080
    
    { 
      "opc-work-request-id": "ocid1.workrequest.xxx....….….….uniqueID"
    }

    Note:

    To see the backend server results, you can list the backends by providing the backend-set name and load balancer OCID. You can also use the backend-set get command to see complete details.
    $ oci lb backend list --backend-set-name example_backend_set \
    --load-balancer-id ocid1.loadbalancer....….….….uniqueID 
    
    {
      "data": 
      [
        {
          "backup": false,
          "drain": false,
          "ip-address": "10.0.0.3",
          "name": "10.0.0.3:8080",
          "offline": false,
          "port": 8080,
          "weight": 1
        },
        {
          "backup": false,
          "drain": false,
          "ip-address": "172.16.0.240",
          "name": "172.16.0.240:8080",
          "offline": false,
          "port": 8080,
          "weight": 1
        }
      ]
    }

Viewing a Load Balancer Backend Server Details

You can view a list of the backend servers in an existing load balancer backend set 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 existing backend servers.

  3. Under Resources, click the name of the existing Backend Set to view its details, such as IP address, port, and weight.

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 list command.

    Use the LB OCID and backend set name to list the backend server details for the backend set.

    Note:

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

    Syntax (entered on a single line):

    oci lb backend list --backend-set-name backend-set-name \
    --load-balancer-id load-balancer_OCID 

    Example:

    $ oci lb backend list --backend-set-name PrivLB1_BckEndSet  \
    --load-balancer-id ocid1.loadbalancer....….….….uniqueID
    
    {
      "data": [
        {
          "backup": false,
          "drain": false,
          "ip-address": "172.16.0.151",
          "name": "172.16.0.151:8080",
          "offline": false,
          "port": 8080,
          "weight": 1
        },
        {
          "backup": false,
          "drain": false,
          "ip-address": "172.16.0.240",
          "name": "172.16.0.240:8080",
          "offline": false,
          "port": 8080,
          "weight": 1
        }
      ]
    }
    

Editing a Load Balancer Backend Server

You can change the properties of a load balancer (LB) backend server that's a member of a 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 edit backend server properties.
  3. Under Resources, click Backend Sets.
  4. Click the name of the Backend Set to edit.
  5. Select the name of the LB backend server that you want to edit.

  6. In the Actions list, click Edit to open the Edit Load Balancer Backend Server window.

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

  8. Click Update Load Balancer Backend Server to update the LB Backend Server 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 update --backend-name ipaddr_port --backend-set-name backendset_name \
    --drain drain_boolean--load-balancer-id loadbalancer_OCID --offline offline_boolean \
    --weight weight_boolean --backup backup_boolean 

    Note:

    All of these parameters are required to update the backend server. The drain, offline, and backup parameters are ignored, but must be set to false.

    Where:

    ipaddr_portis the IP address and port of the backend server to update. For example, 10.0.0.3:8080.

    backendset_name is the name of the backend set associated with the backend server being edited. For example, example_backend_set.

    loadbalancer_OCID is the OCID of the load balancer associated with the backend set and server.

    drain_boolean determines whether or not the load balancer drains this server. Backend servers marked as "drain" receive no new incoming traffic. Set to false (the backend server accepts traffic).

    offline_boolean determines whether or not the load balancer treats this backend server as offline. Offline servers receive no incoming traffic. Set to false (the backend server still receives traffic).

    weight_integer sets the load balancing policy weight assigned to the backend server. Backend servers with a greater weight receive a larger proportion of incoming traffic. For example, 3 (this backend server receives more traffic than a backend server set with weight = 1)

    backup_boolean determines whether or not the load balancer treats this backend server as a backup unit. If set to "true," the load balancer forwards no ingress traffic to this backend server unless all other backend servers not marked as "backup" fail the health check policy. Set to false (the backend server is not a backup unit and receives traffic along with other members of the backend set).

    Example:

    $ oci lb backend update --backend-name 10.0.0.3:8080 --backend-set-name example-backend-set \
    --drain false --load-balancer-id ocid1.loadbalancer....….….….uniqueID --offline false \
    --weight 3 --backup false 
    
    { 
      "opc-work-request-id": "ocid1.workrequest.xxx....….….….uniqueID"
    }

    Note:

    To see the backend server results, use the backend get command for that backend server.
    $ oci lb backend get --backend-name 172.16.0.151:80 --backend-set-name example_backend_set \
    --load-balancer-id ocid1.loadbalancer....….….….uniqueID 
    
    {
      "data": {
        "backup": false,
        "drain": false,
        "ip-address": "172.16.0.151",
        "name": "172.16.0.151:80",
        "offline": false,
        "port": 8080,
        "weight": 1
      },
    }

Deleting a Load Balancer Backend Server

You can delete a load balancer (LB) Backend Server from a 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 server.
  3. Under Resources, click Backend Sets.
  4. Click the name of the Backend Set that contains the backend server you want to delete to view the backend set details.
  5. Select the name of the backend server you want to delete.

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

  7. 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.

    Syntax (entered on a single line):

    $ oci lb backend delete --backend-name backend_server_name --backend-set-name backendset_name \
    --load-balancer-id load-balancer_OCID

    Note:

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

    Example:

    $ oci lb backend delete --backend-name 172.16.0.154:80 --backend-set-name PubLB1_BckEndSet \
    --load-balancer-id ocid1.loadbalancer....….….….uniqueID
    Are you sure you want to delete this resource? [y/N]: y