Recreating Load Balancers
After you find out the necessary information about all load balancers that were hosted on the failed Virtuozzo node, you need to recreate them (see Step 8 above). To do this, complete the following tasks for each load balancer:
-
Find out the private IP addresses of servers attached to the load balancer by running the following command on the IM node:
im=> select private_ip from ve where lb_name='LB_NAME'
-
Log in to the backup node that keeps the active load balancer image (see Step 5 above for details), and create a container based on it to act as the new load balancer:
- Choose an ID for the container (
LB_ID
) that will act as the load balancer. The ID must not be assigned to any other container on the backup node where you are logged in and on the new Virtuozzo node. -
Create the load balancer from the active load balancer image:
# vzmlocal -C image.1.LB_IMAGE_NAME:LB_ID
-
Move the load balancer to the new Virtuozzo node:
# vzmigrate NEW_NODE_IPLB_ID --new-name=CUSTOMER_ID.LB_NAME
In the command above,
NEW_NODE_IP
is the IP address or hostname of the new Virtuozzo node. - Choose an ID for the container (
-
Log in to the new Virtuozzo node, and configure the load balancer:
- Remove the line
VE_TYPE="template"
from the/etc/vz/LB_ID/ve.conf
file. -
Configure the load balancer network settings:
# pctl set LB_ID --onboot yes --save
# pctl set LB_ID --ipadd LB_PRIVATE_IP/NET_MASK --save
# pctl set LB_ID --netif_add eth1 --ifname eth1 --ipadd LB_PUBLIC_IP --save
# pctl set LB_ID --gw LB_GATEWAY --save -
Log in to the load balancer:
# pctl enter LB_ID
-
Open the
/usr/local/sbin/c2u-lb-config
file for editing and specify the servers to use with this load balancer:# /usr/local/sbin/c2u-lb-config LIST_OF_SERVERS_PRIVATE_IPs
LIST_OF_SERVERS_PRIVATE_IPs
in the command above is the list of private space-separated IP addresses assigned to servers that you want to load-balance.
When running the commands above, use the settings you got in Step 7 above.
- Remove the line