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:

  1. 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'
  2. 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:

    1. 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.
    2. Create the load balancer from the active load balancer image:

      # vzmlocal -C image.1.LB_IMAGE_NAME:LB_ID
    3. Move the load balancer to the new Virtuozzo node:

      # vzmigrate NEW_NODE_IPLB_ID --new-name=CUSTOMER_ID.LB_NAME
    4. In the command above, NEW_NODE_IP is the IP address or hostname of the new Virtuozzo node.

  3. Log in to the new Virtuozzo node, and configure the load balancer:

    1. Remove the line VE_TYPE="template" from the /etc/vz/LB_ID/ve.conf file.
    2. 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
    3. When running the commands above, use the settings you got in Step 7 above.

    4. Log in to the load balancer:

      # pctl enter LB_ID
    5. 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.