Setting up traffic balancing between several Compute services

The user needs to order another service in Compute and configure it like the first service:

  • install a web server;
  • configure Firewall rules.
  1. Web server installation
  • Install a web server (example: apache):
sudo yum install -y httpd
  • Start the web server:
sudo systemctl enable httpd —now
  • Check if the web server is running:
sudo systemctl status httpd

Command output (example):

 httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2022-05-25 10:34:11 +03; 7s ago
     Docs: man:httpd.service(8)
Main PID: 103004 (httpd)
   Status: "Started, listening on: port 80"
    Tasks: 213 (limit: 23512)
   Memory: 26.4M
   CGroup: /system.slice/httpd.service
           ├─103004 /usr/sbin/httpd -DFOREGROUND
           ├─103005 /usr/sbin/httpd -DFOREGROUND
           ├─103006 /usr/sbin/httpd -DFOREGROUND
           ├─103007 /usr/sbin/httpd -DFOREGROUND
           └─103008 /usr/sbin/httpd -DFOREGROUND
May 25 10:34:11 systemd[1]: Starting The Apache HTTP Server...
May 25 10:34:11 systemd[1]: Started The Apache HTTP Server.
May 25 10:34:11 httpd[103004]: Server configured, listening on: port 80

Auxiliary commands for running the web server:

Reload configuration (when changing configuration files):

sudo systemctl reload httpd

Restart the web server:

sudo systemctl restart httpd
  • Checking the operation of the web server: Add any text to the /var/www/html/index.html file,
    for example: “Hello from”.
 [root@alb-demo1 ~]# curl http://localhost
 Hello from
  1. Configuring the Firewall system

By default, the system firewall blocks all HTTP and HTTPS traffic that comes from the outside on ports 80 and 443. To disable blocking, you need to add the HTTP and HTTPS services to the firewall rules.
To do this, you need to run the commands:

 sudo firewall-cmd —permanent —zone=public —add-service=http
 sudo firewall-cmd —permanent —zone=public —add-service=https

In order for the rules to apply, you need to reload the firewall configuration:
sudo firewall-cmd —reload

Check that the rules are set:

sudo firewall-cmd —list-all
 public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  services: cockpit dhcpv6-client http https ssh
  forward: no
  masquerade: no
  rich rules: 
  1. Create a new web route

  1. In the Target services, in the Weight fields, you need to specify in what proportions the traffic will be divided between the services (in this case, 1 to 1). Thus, you can divide the traffic between a large number of services.