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
- 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, for the Console procedure. Refer to Access Azion Console.
- A personal token and the ID of the connector, for the API procedure.
- The Azion CLI installed and authorized, and the ID of the connector, for the CLI procedure.
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.
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.
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.