Configuration
Save your configuration file as /etc/hapee-extras/hapee-gslb.conf
. Example of a simple configuration, with explanations below:
zone example.com
ttl 10
# ORIGIN
record @ SOA ns1.example.com hostmaster.example.com 1 86400 3600 3600 3600 60
record @ NS ns1.example.com
record @ ttl 3600 MX 100 mail1.example.com
# Static
record ns1 ttl 20 A 10.0.0.1
record mail1 ttl 20 A 10.0.0.2
# Dynamic
record www ttl 20 list dc1
answer-list dc1
method single-rr
option httpchk
http-check connect
http-check send uri /health.html hdr host www.example.com
answer-record srv1 20.0.0.1 weight 10
answer-record srv2 20.0.0.2 weight 20
Configuration definitions
Directive | Description |
---|---|
| Defines a zone named "example.com" for storing DNS records associated with this zone. Add your domain name here. |
| Sets Sets the Time to Live (TTL) value for the records in this zone to 10 seconds. |
| Specifies the Start of Authority (SOA) record for the zone. |
| The email address of the domain administrator, serial number (1), refresh interval (86400), retry interval (3600), expiry time (3600), and minimum TTL (60). |
| Defines the Nameserver (NS) record for the zone, indicating that ns1.example.com is the authoritative nameserver for this zone. |
| Sets up a Mail Exchanger (MX) record for the zone, specifying that mail1.example.com should handle email delivery. The 100 value indicates the priority of the MX record, and the ttl 3600 sets the TTL for this record to 3600 seconds. |
| Defines a dynamic record for the hostname. The record will be resolved based on the answer list named 'dc1' with a TTL of 20 seconds. |
| Starts the definition of an answer list named 'dc1' containing the records for the dynamic hostname www.example.com. |
| Specifies that the answer list should be used in round-robin mode, distributing requests across the available records. |
| Enables HTTP health checks for the records in the answer list. |
| Specifies that the health check should establish a connection to the server. |
| Defines the HTTP request to be sent during health checks, including the URI path and the host header. |
| Specifies the 'srv1' records with the respective IP addresses 20.0.0.1 and weights 10 within the dc1 answer list. |
| Specifies the 'srv2' records with the respective IP addresses 20.0.0.2 and weights 20 within the dc1 answer list. |
Next up
DNS round-robin load-balancing