How is a Backend Service added; which information is required?
Short answer
A Backend Service is added from the Load Balancer → Backend Services → Add form or with the lb backend add command in WEB-CLI. The required fields in the form are Backend Service Name and Address (an IP address or domain name, and a port); Route Table comes as DEFAULT by default, and Health Check comes as No Check by default. The added Backend Service does not receive traffic on its own; it must be bound to the Default Backend Services list of a vService (or to a Backend Group).
Problem: Introducing the Server to TR7
For TR7 to distribute traffic to a server, it must know that server: its address, the port it serves on, the route table through which it is reached, how its health is to be checked and how the connection is to be established. This definition is the Backend Service. Unless the definition is made and bound to a vService, no traffic goes to the server.
Solution: Two Methods
The two methods create the same record; one works from the panel, the other from the command line.
| Your situation | Suitable method |
|---|---|
| I want to add it from the panel, via the form | Method 1: Backend Services form |
| I want to add it from the command line or with a script | Method 2: WEB-CLI |
Method 1: Backend Services Form Recommended
- How it works The form creates the Backend Service record; settings such as health check, SSL and SNAT are optionally given in the same form. The record is then added to the vService's list.
- Where it is openedLoad Balancer → Backend Services → Add
- Requirement The address and port of the server; if the server is on a network other than the default one, the route table and interface IP for that network
- vService type HTTP, L7 TCP and Network
Step-by-Step Configuration
The Configuration Menu is opened with the TR7 logo at the bottom left; Load Balancer → Backend Services → Add is clicked (how to add).
Backend Service Name is entered. The name is required and unique; if it is left empty, the "Required field" warning appears, and if it is used in another record, the "Name is used" warning appears.
The IP address (IPv4 or IPv6) or domain name of the server and the port are entered in the Address field (e.g. 192.0.2.21 · 8080). In the add form, the address field is multi-line: a separate Backend Service is created for each line, all settings other than the name and address are copied in common, and from the second line onward the names are given the (2), (3) suffix. If the same IP:port is entered on two lines, the "Elements must be unique" warning appears.
Route Table is DEFAULT by default. If the server is on a separate network that cannot be reached from the interfaces in the DEFAULT table, the route table of that network is selected. If this table does not exist yet, a route table is first created on the Network → Route Tables screen, then an IP is given to the interface on that network on the Network → Interfaces screen; for the cases in which a separate table is needed: Can my backends be on different networks / in different route tables?
A profile is selected in the Health Check field. The default value is No Check; in this case TR7 cannot tell that the server has gone down and continues to send traffic to it. When a profile is selected, Enable HC Logs appears below it; its default value is on.
If there is no suitable profile, the profile form is opened with the add button in the drop-down list, without leaving the form (the same form is also opened with Load Balancer → Profiles → Health Checks → Add). Name is required and unique; the default value of Check Type is HTTP, and it cannot be changed after saving. Period and Timeout come with the value 1 s, Required Successes with 3 and Required Failures with 2. When the profile is saved, it is selected automatically in the Health Check field. For choosing the values: How should I set the Period, Timeout, Required Successes and Required Failures values?
If needed, Backup Service, Maintenance Mode and SSL Service are turned on; when the Details switch is turned on, the Use Frontend Port, SNAT, health check address, Cookie Content, Connection Limit, Weight and Proxy settings appear. All of these are optional; the fields left empty work with the default behavior.
The Add button at the bottom of the form is clicked. The record appears in the Backend Services list.
On the Load Balancer → Load Balancer vService List screen, the relevant vService is selected and Edit is clicked. If there is no vService yet, it is created first (What are the most basic steps to set up my first vService?).
In the Default Backend Services field, the "Add backend services" list is opened and the Backend Service saved in step 8 is checked. On a Network vService, only the Backend Services in the same route table as the vService appear in the list. If the same record is added to the list twice, the "Duplicated backend services" warning appears.
Save is clicked. While Clustering is on and Manual Sync Mode is off (default), the Backend Service and vService change is transferred to the peer device automatically; if Manual Sync Mode is on, it is sent manually with Synchronize.
Verification
The new row appears in the Backend Services list; the Address column shows IP : port, and the Health column shows the health indicator.
Health: OK (Off if no profile is assigned)The Used in tab is checked in the preview panel that opens when the Backend Service is clicked in the list. The tab appears only if the record is used in at least one place.
The vService it is bound to is listedMethod 2: WEB-CLI
- How it works The
lb backend addcommand creates the Backend Service record; optional settings are added with fields prefixed with--. The record is bound to the vService's list withlb service update. - Where it is opened TR7 WEB-CLI →
lb backend - Requirement WEB-CLI access; the address and port of the server
- vService type HTTP, L7 TCP and Network
Step-by-Step Configuration
If the profile to be bound to the Backend Service does not exist, it is created first. The required fields are checkType and name, and they are written without a prefix, in this order:
lb hc add checkType http name web-hcThe existing profiles are seen with lb hc list.
The five required fields are written without a prefix and in this order: name, v-device, namespace, addr.ip, addr.port. Host for v-device and 1 (DEFAULT route table) for namespace are the default values; the command still asks for them, and they can be selected from the list with Tab. Optional fields are added with the -- prefix only after the required fields; the name of the profile is written in the --hc field:
lb backend add name web-1 v-device Host namespace 1 addr.ip 192.0.2.21 addr.port 8080 --hc web-hcOther settings such as weight can also be added to the same line (e.g. --weight 30; 1–256).
The binding command writes to the list by index and replaces the existing record at the given index. Therefore, the defaultBackendList field of the vService is displayed first; the vService ID is written in place of <vService> (Tab lists them; they also appear in the lb service list output):
lb service show <vService>If there is no record in the list, .0 is used; for example, if there are two records (.0 and .1), .2, the first empty index, is used; the name of the Backend Service is written as the value (Binding to a vService):
lb service update id <vService> --defaultBackendList.2 web-1If a filled index is written, the Backend Service at that index is removed from the list and web-1 takes its place. In a cluster, the change is transferred to the peer device according to the rule in Method 1.
Verification
The new record appears in the lb backend list output; it is also present in the Backend Services list in the panel.
web-1 in the listThe defaultBackendList field in the lb service show <vService> output is checked.
Previous records in place, web-1 in the listCommon Mistakes
- Not binding the Backend Service to a vService. The record is created but does not receive traffic; the Used in tab does not appear in the preview.
- Leaving Health Check as No Check. TR7 does not notice that the server has gone down and continues to send traffic to it.
- Writing to a filled index in WEB-CLI. A filled index such as
--defaultBackendList.0removes the Backend Service there from the list; for adding, the first empty index is found first withlb service show. - Entering TR7's own addresses.
127.0.0.0/8,::1,localhost,169.254.0.0/16,0.0.0.0/8,198.51.100.0/24and241.0.0.x/241.0.1.xare in TR7's internal use; a Backend Service pointing to these addresses is disabled in the configuration and does not receive traffic. - Selecting a different route table on a Network vService. Only the Backend Services in its own route table appear in the list of a Network vService; if the record is not in the list, the Route Table field is checked.
- Turning on SSL Service while the server speaks plain HTTP. The connection cannot be established; SSL Service is turned on only if the server expects TLS.
How it is done in the documentation
