Add a backup origin to a connector
Keep a standby origin out of daily traffic, and let it receive requests only when every primary address of the connector fails.
You add a standby origin to a connector as a Backup address of Load Balancer, from Azion Console, the API, or the Azion CLI. To spread live traffic across several origins with weights instead, refer to Balance traffic across multiple origins.
A Backup address stands by out of daily traffic, and it receives requests only when every Primary address fails. Primary addresses are always preferred, so the standby carries no traffic while the primary answers. Load Balancer has no health check: no probe and no interval, so nothing tests an address between requests.
- A rule’s Set Connector behavior sends the request to the connector, which has Load Balancer on.
- While a Primary address answers, it receives every request, and the Backup address receives none.
- When every Primary address fails, the Backup address receives the request.
- The client receives the response from the address that served it, with no DNS change.
Prerequisites
Console
- A connector of type
httpthat reaches your primary origin, and a rule whose Set Connector behavior sends requests to it. To create both, refer to Connectors quickstart. - A standby origin that holds the same content as the primary and is set up the same way for the application.
- Access to Azion Console. Refer to Access Azion Console.
The examples use primary.example.com for the primary origin, standby.example.com for the standby, and www.example.com for the domain. Replace them with yours.
Add the standby as a backup address
A connector holds one address until Load Balancer is on, and up to 15 addresses with it on. The method is Round Robin or Least Connections, because IP Hash refuses a Backup address with 28005. Every address is Primary unless you set it otherwise.
Max Retries sets the retry attempts when a connection to the origin fails, from 0 to 20. Connection Timeout limits the wait for that connection, from 1 to 300 seconds, and Read/Write Timeout limits the wait for data on an open connection, from 1 to 600 seconds. The client waits through every retry before it receives an answer. The Console fills in 3, 30, and 60. The API and the CLI give a key the body leaves out 0, 60, and 120, so a connector without max_retries does not retry a failed connection. The examples set the Console values in every interface.
Console
To add the backup address in Azion Console:
Access Azion Console > Connectors, and select the connector of your primary origin.
In Modules, turn on Load Balancer. The form fills in Max Retries, Connection Timeout, and Read/Write Timeout.
In Load Balancer Configuration, set Method to Round Robin.
Enter 3 in Max Retries, 30 in Connection Timeout, and 60 in Read/Write Timeout.
Under Address Management, on primary.example.com, set Server Role to Primary.
In the new Address, enter standby.example.com, without a protocol or a port.
Set Server Role to Backup, and keep Active turned on.
The Console shows Connector has been updated.
The connector holds the primary origin and the standby, and the rule that names it needs no change. A connector change reaches Azion’s distributed infrastructure over several minutes, and data centers apply it at different times.
Both addresses receive the same Host header, path prefix, and protocol from the connector. When the standby answers under another name than the primary, set Host to ${host}, which sends the host the client requested. For the connection options, refer to Connector settings.
In the Keep an application online when an origin fails use case, this section takes these values:
| Setting | API key in config | Value |
|---|---|---|
| Method | method | round_robin |
| Max Retries | max_retries | 1 |
| Connection Timeout | connection_timeout | 10 |
| Read/Write Timeout | read_write_timeout | 60 |
The connector holds the primary origin and the standby, and the rule that names app-origin needs no change.
In the Route users to regional origins use case, this section takes these values:
| Setting | Value |
|---|---|
| Addresses | us.origin.example.com with Server Role Primary, and eu.origin.example.com with Backup |
| Method | Round Robin |
| Max Retries | 1. One retry bounds how long a user waits through a failing connection |
| Connection Timeout | 10 seconds. It stops a request from waiting the 60-second API default on an origin that accepts no connection |
| Read/Write Timeout | 60 seconds |
origin-us holds the default region’s origin and a backup in Europe, and origin-eu holds only its European origin.
Confirm the standby takes over
The check takes the primary out of service, so run it in a maintenance window. It reads Upstream Addr in the HTTP Requests data source of Real-Time Events, which holds the IP address and port of the server a request was sent to.
To confirm the failover:
Stop the web server on primary.example.com, or block the connections from Azion at its firewall.
The command prints the status code of each response. Send it several times.
Access Azion Console > Products menu > Observe > Real-Time Events, and select HTTP Requests in Data Sources.
In Filter by, enter host='www.example.com', and select Refresh.
The newest records carry the IP address of standby.example.com in Upstream Addr.
The standby serves the requests while the primary is down. Once the primary answers again, it takes the requests back, because Primary addresses are always preferred over Backup addresses. A data center that has not received a change yet can still answer as before, so repeat the search until the records agree. For the filter syntax, refer to Filter events.
When your origins set a response header that names them, a second method reads that header in the response instead of Upstream Addr in Real-Time Events. Send several requests through your domain:
In the Keep an application online when an origin fails use case, expect:
- The primary serves while it answers. Every response to several requests for
https://www.example.com/carriesx-origin-site: primary. Under HTTP/2, header names arrive in lower case. - The standby takes over when the primary fails. Stop the web server on
primary.example.com, or block the connections from Azion at its firewall. Send the request again, several times. The responses carryx-origin-site: standby, with no DNS change on your side. - The primary takes the traffic back. Start the web server on
primary.example.comagain, and send the request several times. The responses carryx-origin-site: primaryagain, because Primary addresses are always preferred over Backup addresses.
In the Route users to regional origins use case, expect:
- The default region falls back, and Europe does not. In a maintenance window, stop the web server on
us.origin.example.comand repeat the request from outside Europe. The responses carryx-origin-region: eu. Start it again. A European origin outage, by design, shows the European users an error instead of a response from another region.