Route to Multiple Services
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.
Web server installation¶
-
Install a web server (example:
apache
): -
Start the web server:
-
Check if the web server is running:
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 alb-demo1.pt35.cmp.loc.icdc.io systemd[1]: Starting The Apache HTTP Server... May 25 10:34:11 alb-demo1.pt35.cmp.loc.icdc.io systemd[1]: Started The Apache HTTP Server. May 25 10:34:11 alb-demo1.pt35.cmp.loc.icdc.io httpd[103004]: Server configured, listening on: port 80
Auxiliary commands for running the web server¶
- Reload configuration (when changing configuration files):
- Restart the web server:
-
Checking the operation of the web server: Add any text to the
/var/www/html/index.html
file, for example: “Hello from alb-demo1.pt35.cmp.loc.icdc.io”:
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:
-
Create a new web route
alb-demo.pt35.cmp.loc.io
: -
In the
Target services
, in theWeight
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.