3.13. Managing Load Balancers

3.13.1. vinfra service compute load-balancer create

Create a load balancer:

usage: vinfra service compute load-balancer create [--description <description>]
                                                   [--enable | --disable]
                                                   [--address <address>]
                                                   [--floating-ip <floating-ip>]
                                                   [--pools-config <pools>]
                                                   <name> <network>
--description <description>
Load balancer description
--enable
Enable the load balancer.
--disable
Disable the load balancer.
--address <address>
The IP address the load balancer will try to allocate in the network.
--floating-ip <floating-ip>
The floating IP address that will be used to connect to the load balancer from public networks.
--pools-config <pools>
Pool configuration file

Below is an example of a pool configuration file in the YAML format:

- backend_protocol: HTTPS
  backend_protocol_port: 443
  healthmonitor: {delay: 5, max_retries: 3, max_retries_down: 3, timeout: 5, type: PING,
    url_path: /}
  lb_algorithm: ROUND_ROBIN
  members:
  - {address: 192.168.30.49, compute_server_id: 5fd82e2a-3fef-4171-bfa4-67daa99ae64f}
  - {address: 192.168.30.15, compute_server_id: 4f7262d0-2031-4772-9984-2f1066ac166b}
  name: pool1
  protocol: HTTPS
  protocol_port: 443
  sticky_session: False
<name>
Load balancer name
<network>
The ID or name of network the load balancer will operate in.

Example:

# vinfra service compute load-balancer create mylbaas private1 --floating-ip 10.94.129.70
+---------------+--------------------------------------+
| Field         | Value                                |
+---------------+--------------------------------------+
| address       | 192.168.30.230                       |
| amphorae      |                                      |
| created_at    | 2019-11-18T12:59:08.243413           |
| description   |                                      |
| enabled       | True                                 |
| floating_ip   | 10.94.129.70                         |
| ha_enabled    |                                      |
| id            | 941bf637-2d55-40f0-92c0-e65d6567b468 |
| members_count | 0                                    |
| name          | mylbaas                              |
| network_id    | 2b821d00-e428-4a76-b1ae-d181c9f5ae7f |
| pools         | []                                   |
| port_id       | 2d8ab88a-847c-4396-857e-11eaa80e1b24 |
| project_id    | e4e059c67dee4736851df14d4519a5a5     |
| status        | CREATING                             |
| updated_at    |                                      |
+---------------+--------------------------------------+

This command creates a load balancer mylbaas without balancing pools that will operate in the network private with the floating IP address 10.94.129.70.

3.13.2. vinfra service compute load-balancer list

List load balancers:

usage: vinfra service compute load-balancer list

Example:

# vinfra service compute load-balancer list
+--------------------------------------+---------+
| id                                   | name    |
+--------------------------------------+---------+
| 941bf637-2d55-40f0-92c0-e65d6567b468 | mylbaas |
+--------------------------------------+---------+

This command lists load balancers in the compute cluster.

3.13.3. vinfra service compute load-balancer show

Display load balancer details:

usage: vinfra service compute load-balancer show <load-balancer>
<load-balancer>
Load balancer ID or name

Example:

# vinfra service compute load-balancer show mylbaas
+---------------+----------------------------------------------------+
| Field         | Value                                              |
+---------------+----------------------------------------------------+
| address       | 192.168.30.230                                     |
| amphorae      | - active: true                                     |
|               |   compute_id: b0c4793f-e1b1-4251-91c2-94e34787f537 |
|               |   created_at: '2019-11-18T12:59:12.742446'         |
|               |   id: b7b23106-a87b-412d-9ce6-7c69b5594342         |
|               |   image_id: 6d1ba6f9-cf86-4ea4-a32d-f138868a9742   |
|               |   role: STANDALONE                                 |
|               |   status: ALLOCATED                                |
|               |   updated_at: '2019-11-18T13:01:07.601184'         |
| created_at    | 2019-11-18T12:59:08.243413                         |
| description   |                                                    |
| enabled       | True                                               |
| floating_ip   | 10.94.129.70                                       |
| ha_enabled    | False                                              |
| id            | 941bf637-2d55-40f0-92c0-e65d6567b468               |
| members_count | 0                                                  |
| name          | mylbaas                                            |
| network_id    | 2b821d00-e428-4a76-b1ae-d181c9f5ae7f               |
| pools         | []                                                 |
| port_id       | 2d8ab88a-847c-4396-857e-11eaa80e1b24               |
| project_id    | e4e059c67dee4736851df14d4519a5a5                   |
| status        | ACTIVE                                             |
| updated_at    | 2019-11-18T13:01:10.983144                         |
+---------------+----------------------------------------------------+

This command shows the details of the load balancer mylbaas.

3.13.4. vinfra service compute load-balancer stats

Show statistics for a load balancer:

usage: vinfra service compute load-balancer stats <load-balancer>
<load-balancer>
Load balancer ID or name

Example:

# vinfra service compute load-balancer stats mylbaas
+-------+-------------------------------------------------------+
| Field | Value                                                 |
+-------+-------------------------------------------------------+
| stats | active_connections: 0                                 |
|       | bytes_in: 0                                           |
|       | bytes_out: 0                                          |
|       | listeners: null                                       |
|       | loadbalancer_id: 17cfa86f-c374-4ca3-8cd6-f638a5234fe7 |
|       | request_errors: 0                                     |
|       | total_connections: 0                                  |
+-------+-------------------------------------------------------+

This command shows statistics for the load balancer mylbaas.

3.13.5. vinfra service compute load-balancer set

Modify a load balancer:

usage: vinfra service compute load-balancer set [--description <description>]
                                                [--enable | --disable] [--name <name>]
                                                <load-balancer>
--description <description>
Load balancer description
--enable
Enable the load balancer.
--disable
Disable the load balancer.
--name <name>
Load balancer name
<load-balancer>
Load balancer ID or name

Example:

# vinfra service compute load-balancer set mylbaas --disable \
--description "Disabled load balancer"
+---------------+--------------------------------------+
| Field         | Value                                |
+---------------+--------------------------------------+
| address       | 192.168.30.230                       |
| amphorae      |                                      |
| created_at    | 2019-11-18T12:59:08.243413           |
| description   | Disabled load balancer               |
| enabled       | False                                |
| floating_ip   |                                      |
| ha_enabled    |                                      |
| id            | 941bf637-2d55-40f0-92c0-e65d6567b468 |
| members_count | 0                                    |
| name          | mylbaas                              |
| network_id    | 2b821d00-e428-4a76-b1ae-d181c9f5ae7f |
| pools         | []                                   |
| port_id       | 2d8ab88a-847c-4396-857e-11eaa80e1b24 |
| project_id    | e4e059c67dee4736851df14d4519a5a5     |
| status        | DISABLED                             |
| updated_at    | 2019-11-18T13:09:09.151442           |
+---------------+--------------------------------------+

This command disables the load balancer mylbaas and adds a description to it.

3.13.6. vinfra service compute load-balancer pool create

Create a load balancer pool:

usage: vinfra service compute load-balancer pool create --name <name>
                                                        --protocol {HTTP,HTTPS}
                                                        --port <port>
                                                        --algorithm <algorithm>
                                                        --backend-protocol {HTTP,HTTPS}
                                                        --backend-port <backend_port>
                                                        [--certificate-file <cert_file>]
                                                        [--connection-limit <limit>]
                                                        [--description <description>]
                                                        [--healthmonitor type=<type>,
                                                        url_path=<url>[,key=value,...]]
                                                        [--member address=<ip>
                                                        [,key=value,...]]
                                                        [--privatekey-file <key>]
                                                        [--enable-sticky-session |
                                                        --disable-sticky-session]
                                                        [--enable | --disable]
                                                        <load-balancer>
--name <name>
Pool name
--protocol {HTTP,HTTPS}
The protocol for incoming connections
--port <port>
The port for incoming connections
--algorithm <algorithm>
Load balancing algorithm (LEAST_CONNECTIONS, ROUND_ROBIN, or SOURCE_IP)
--backend-protocol {HTTP,HTTPS}
The protocol for destination connections
--backend-port <backend_port>
The port for destination connections
--certificate-file <cert_file>
An x.509 certificate file in the PEM format. Required for TLS-terminated HTTPS->HTTP load balancers.
--connection-limit <limit>
The maximum number of connections permitted for this pool. The default value is -1 (infinite connections).
--description <description>
Pool description
--healthmonitor type=<type>,url_path=<url>[,key=value,...]

Health monitor parameters:

  • type: the health monitor type (HTTP, HTTPS, PING, or TCP)
  • url_path: the URL path to the health monitor
  • comma-separated key=value pairs with keys (optional):
    • delay: the time, in seconds, between sending probes to members.
    • enabled: declares whether the health monitor is enabled or not (true or false).
    • max_retries: the number of successful checks required to change member status to ‘HEALTHY’. Ranges from 1 to 10.
    • max_retries_down: the number of unsuccessful checks required to change member status to ‘UNHEALTHY’. Ranges from 1 to 10.
    • timeout: the maximum time, in seconds, that a monitor waits to connect before it times out. This value must be less than the delay value.
--member address=<ip>[,key=value,...]

Member parameters:

  • address: an IPv4 address of the compute server
  • comma-separated key=value pairs with keys (optional):
    • enabled: declares whether the member is enabled or not (true or false).
    • weight: determines the share of connections that the member services compared to the other pool members. For example, a weight of 10 means that the member handles five times as many connections than a member with a weight of 2. A weight of 0 means that the member does not receive new connections but continues to service existing ones. Ranges from 0 to 256. The default value is 1. This option can be used multiple times.
--privatekey-file <key>
A private TLS key file in the PEM format. Required for TLS-terminated HTTPS->HTTP load balancers.
--enable-sticky-session
Enable session persistence.
--disable-sticky-session
Disable session persistence.
--enable
Enable the pool.
--disable
Disable the pool.
<load-balancer>
Load balancer ID or name

Example:

# vinfra service compute load-balancer pool create mylbaas --name mypool --protocol HTTP \
--port 80 --backend-protocol HTTP --backend-port 80 --algorithm LEAST_CONNECTIONS \
--member address=192.168.31.153, compute_server_id=d51c10a7-6187-4a5a-a838-de5fc78a688a \
--member address=192.168.31.22,compute_server_id=54603109-8963-49f2-8c49-332537c57e90 \
--enable-sticky-session
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| backend_protocol      | HTTP                                 |
| backend_protocol_port | 80                                   |
| certificate           |                                      |
| connection_limit      | -1                                   |
| created_at            | 2019-11-18T13:11:27.982129           |
| description           |                                      |
| enabled               | True                                 |
| healthmonitor         |                                      |
| id                    | fa40e282-b29a-465a-afaa-2c702d2bde17 |
| lb_algorithm          | LEAST_CONNECTIONS                    |
| listener_id           | 66cc714e-af7f-40eb-9db8-67b8b6b6d23c |
| loadbalancer_id       | 941bf637-2d55-40f0-92c0-e65d6567b468 |
| members               | []                                   |
| name                  | mypool                               |
| private_key           |                                      |
| project_id            | e4e059c67dee4736851df14d4519a5a5     |
| protocol              | HTTP                                 |
| protocol_port         | 80                                   |
| status                | CREATING                             |
| sticky_session        | True                                 |
| updated_at            |                                      |
+-----------------------+--------------------------------------+

This command adds a balancing pool mypool to the load balancer mylbaas with the following parameters:

  • “HTTP on port 80 -> HTTP on port 80” forwarding rule
  • the LEAST_CONNECTIONS balancing algorithm
  • two members in the pool
  • enabled sticky session

3.13.7. vinfra service compute load-balancer pool list

List load balancer pools:

usage: vinfra service compute load-balancer pool list

Example:

# vinfra service compute load-balancer pool list
+--------------------------------------+--------+--------------------------------------+
| id                                   | name   | loadbalancer_id                      |
+--------------------------------------+--------+--------------------------------------+
| fa40e282-b29a-465a-afaa-2c702d2bde17 | mypool | 941bf637-2d55-40f0-92c0-e65d6567b468 |
+--------------------------------------+--------+--------------------------------------+

This command lists load balancer pools in the compute cluster.

3.13.8. vinfra service compute load-balancer pool show

Display load balancer pool details:

usage: vinfra service compute load-balancer pool show <pool>
<pool>
Load balancer pool ID or name

Example:

# vinfra service compute load-balancer pool show mypool
+-----------------------+-----------------------------------------------------------+
| Field                 | Value                                                     |
+-----------------------+-----------------------------------------------------------+
| backend_protocol      | HTTP                                                      |
| backend_protocol_port | 80                                                        |
| certificate           |                                                           |
| connection_limit      | -1                                                        |
| created_at            | 2019-11-18T13:11:27.982129                                |
| description           |                                                           |
| enabled               | True                                                      |
| healthmonitor         |                                                           |
| id                    | fa40e282-b29a-465a-afaa-2c702d2bde17                      |
| lb_algorithm          | LEAST_CONNECTIONS                                         |
| listener_id           | 66cc714e-af7f-40eb-9db8-67b8b6b6d23c                      |
| loadbalancer_id       | 941bf637-2d55-40f0-92c0-e65d6567b468                      |
| members               | - address: 192.168.31.153                                 |
|                       |   compute_server_id: d51c10a7-6187-4a5a-a838-de5fc78a688a |
|                       |   created_at: '2019-11-18T13:11:59.681101'                |
|                       |   enabled: true                                           |
|                       |   id: 3fd5dcc5-6e2c-4e22-8d0a-8e94e20a122f                |
|                       |   name: ''                                                |
|                       |   pool_id: null                                           |
|                       |   status: HEALTHY                                         |
|                       |   updated_at: '2019-11-18T13:12:01.467306'                |
|                       |   weight: 1                                               |
|                       | - address: 192.168.31.22                                  |
|                       |   compute_server_id: 54603109-8963-49f2-8c49-332537c57e90 |
|                       |   created_at: '2019-11-18T13:12:10.176853'                |
|                       |   enabled: true                                           |
|                       |   id: ccb645b3-63c7-44f8-b861-b197c85506d4                |
|                       |   name: ''                                                |
|                       |   pool_id: null                                           |
|                       |   status: HEALTHY                                         |
|                       |   updated_at: '2019-11-18T13:12:12.281578'                |
|                       |   weight: 1                                               |
| name                  | mypool                                                    |
| private_key           |                                                           |
| project_id            | e4e059c67dee4736851df14d4519a5a5                          |
| protocol              | HTTP                                                      |
| protocol_port         | 80                                                        |
| status                | ACTIVE                                                    |
| sticky_session        | True                                                      |
| updated_at            | 2019-11-18T13:12:12.305509                                |
+-----------------------+-----------------------------------------------------------+

This command shows the details of the load balancer pool mypool.

3.13.9. vinfra service compute load-balancer pool set

Modify a load balancer pool:

usage: vinfra service compute load-balancer pool set --name <name> --protocol {HTTP,HTTPS}
                                                     --port <port> --algorithm <algorithm>
                                                     --backend-protocol {HTTP,HTTPS}
                                                     --backend-port <backend_port>
                                                     [--certificate-file <cert_file>]
                                                     [--connection-limit <limit>]
                                                     [--description <description>]
                                                     [--healthmonitor type=<type>,
                                                     url_path=<url>[,key=value,...]]
                                                     [--member address=<ip>,
                                                     compute_server_id=<id>
                                                     [,key=value,...]]
                                                     [--privatekey-file <key>]
                                                     [--enable-sticky-session |
                                                     --disable-sticky-session]
                                                     [--enable | --disable]  <pool>
--name <name>
Pool name
--protocol {HTTP,HTTPS}
The protocol for incoming connections
--port <port>
The port for incoming connections
--algorithm <algorithm>
Load balancing algorithm (LEAST_CONNECTIONS, ROUND_ROBIN, or SOURCE_IP)
--backend-protocol {HTTP,HTTPS}
The protocol for destination connections
--backend-port <backend_port>
The port for destination connections
--certificate-file <cert_file>
An x.509 certificate file in the PEM format. Required for TLS-terminated HTTPS->HTTP load balancers.
--connection-limit <limit>
The maximum number of connections permitted for this pool. The default value is -1 (infinite connections).
--description <description>
Pool description
--healthmonitor type=<type>,url_path=<url>[,key=value,...]

Health monitor parameters:

  • type: the health monitor type (HTTP, HTTPS, PING, or TCP)
  • url_path: the URL path to the health monitor
  • comma-separated key=value pairs with keys (optional):
    • delay: the time, in seconds, between sending probes to members.
    • enabled: declares whether the health monitor is enabled or not (true or false).
    • max_retries: the number of successful checks required to change member status to ‘HEALTHY’. Ranges from 1 to 10.
    • max_retries_down: the number of unsuccessful checks required to change member status to ‘UNHEALTHY’. Ranges from 1 to 10.
    • timeout: the maximum time, in seconds, that a monitor waits to connect before it times out. This value must be less than the delay value.
--member address=<ip>,compute_server_id=<id>[,key=value,...]

Member parameters:

  • address: an IPv4 address of the compute server
  • compute_server_id: the compute server UUID
  • comma-separated key=value pairs with keys (optional):
    • enabled: declares whether the member is enabled or not. Can be ‘true’ or ‘false’.
    • weight: determines the share of connections that the member services compared to the other pool members. For example, a weight of 10 means that the member handles five times as many connections than a member with a weight of 2. A weight of 0 means that the member does not receive new connections but continues to service existing ones. Ranges from 0 to 256. The default value is 1. This option can be used multiple times.
--privatekey-file <key>
A private TLS key file in the PEM format. Required for TLS-terminated HTTPS->HTTP load balancers.
--enable-sticky-session
Enable session persistence.
--disable-sticky-session
Disable session persistence.
--enable
Enable the pool.
--disable
Disable the pool.
<pool>
Load balancer pool ID or name

Example:

# vinfra service compute load-balancer pool set mypool --algorithm ROUND_ROBIN \
--member address=192.168.31.153,compute_server_id=d51c10a7-6187-4a5a-a838-de5fc78a688a \
--member address=192.168.31.22,compute_server_id=54603109-8963-49f2-8c49-332537c57e90 \
--member address=192.168.31.51,compute_server_id=5eb49a67-f0ff-44ec-b4e6-105e16e2db07 \
--disable-sticky-session
Operation accepted.

This command changes the parameters for the balancing pool mypool as follows:

  • sets the balancing algorithm to ROUND_ROBIN
  • adds the third member to the pool
  • disables sticky session

3.13.10. vinfra service compute load-balancer pool delete

Delete a load balancer pool:

usage: vinfra service compute load-balancer pool delete <pool>
<pool>
Load balancer pool ID or name

Example:

# vinfra service compute load-balancer pool delete mypool
Operation successful.

This command removes the load balancer pool mypool.

3.13.11. vinfra service compute load-balancer delete

Delete a load balancer:

usage: vinfra service compute load-balancer delete <load-balancer>
<load-balancer>
Load balancer ID or name

Example:

# vinfra service compute load-balancer delete mylbaas
Operation accepted.

This command deletes the load balancer mylbaas.