Create a rule for TCP or UDP traffic
Create a rule for TCP or UDP traffic
Control panel
OpenStack CLI
-
В control panels go to Cloud platform → Balancers.
-
Open the tab Balancers → balancer page.
-
Click Create a rule.
-
Select the protocol for receiving traffic — TCP or UDP.
-
For the selected protocol, the default port on which the balancer will listen to traffic will be automatically selected — change it if necessary.
-
Select a target group or create a new target group suitably protocol.
-
Optional: change connection settings To do this, open the block Advanced rule settings and specify:
- for incoming requests to the balancer — specify the connection timeout and maximum connections;
- for requests from the balancer to servers — specify the connection timeout, inactivity timeout and TCP packet waiting timeout.
-
Click Create.
-
Create a rule for the balancer:
openstack loadbalancer listener create \
--name <listener_name> \
--protocol <protocol> \
--protocol-port <port> \
<loadbalancer>Specify:
<listener_name>
— NAME OF RULE;<protocol_name>
— protocol name, TCP or UDP;<port>
— port number;<loadbalancer>
— ID or name of the load balancer. The list can be viewed viaopenstack loadbalancer list
-
Create a task force:
openstack loadbalancer pool create \
--name <pool_name> \
--lb-algorithm <algorithm> \
--listener <listener_name> \
--protocol <protocol_name>Specify:
<pool_name>
— the name of the target group;<algorithm>
— algorithm name:ROUND_ROBIN
orLEAST_CONNECTIONS
<listener_name>
— NAME OF RULE;<protocol_name>
— protocol name.
-
Add the server to the target group:
openstack loadbalancer member create \
--subnet-id <subnet_uuid> \
--address <server_ip_address> \
--protocol-port <port> \
<pool_name>Specify:
<subnet_uuid>
— The ID of a server's private or public subnet can be viewed withopenstack subnet list
<server_ip_address>
— The IP address of the server from the specified subnet.