vinfra service compute load-balancer pool create
Create a load balancer pool:
usage: vinfra service compute load-balancer pool create --protocol
{HTTP,HTTPS,TCP,UDP}
--port <port>
--algorithm <algorithm>
--backend-protocol
{HTTP,HTTPS,TCP,UDP}
--backend-port <backend-port>
[--certificate-file <cert-file>]
[--connection-limit <limit>]
[--description <description>]
[--healthmonitor type=<type>,
url_path=<url>[,key=value,…]]
[--member address=<ip>
[,enabled=<bool>, weight=<int>]]
[--privatekey-file <key>]
[--enable-sticky-session |
--disable-sticky-session]
[--enable | --disable]
[--name <name>] <load-balancer>
--protocol {HTTP,HTTPS,TCP,UDP}- The protocol for incoming connections
--port <port>- The port for incoming connections
--algorithm <algorithm>- Load balancing algorithm (
LEAST_CONNECTIONS,ROUND_ROBIN, orSOURCE_IP) --backend-protocol {HTTP,HTTPS,TCP,UDP}- 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,TCP, orUDP)url_path: the URL path to the health monitor- comma-separated
key=valuepairs with keys (optional):delay: the time, in seconds, between sending probes to members.enabled: declares whether the health monitor is enabled or not (trueorfalse).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 thedelayvalue.
--member address=<ip>[,enabled=<bool>,weight=<int>]-
Member parameters:
address=<ip>: an IPv4 address of the virtual machineenabled=<bool>: declares whether the member is enabled or not. Can be ‘true’ or ‘false’.weight=<int>: 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.
--name <name>- Pool name
<load-balancer>- Load balancer ID or name
Example:
# vinfra service compute load-balancer pool create mylbaas --protocol HTTP \ --port 80 --backend-protocol HTTP --backend-port 80 --name mypool \ --algorithm LEAST_CONNECTIONS --member address=192.168.31.153 \ --member address=192.168.31.22 --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_CONNECTIONSbalancing algorithm - two members in the pool
- enabled sticky session