> ## Documentation Index
> Fetch the complete documentation index at: https://docs.preprod.world/llms.txt
> Use this file to discover all available pages before exploring further.

# DNS Healthchecks

export const Caution = ({children}) => {
  return <div class="my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border danger-admonition dark:danger-admonition">
      <div class="mt-0.5 w-4">
        <svg width="14" height="14" viewBox="0 0 14 14" fill="rgb(239, 68, 68)" xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 text-sky-500" aria-label="Danger">
          <path fill-rule="evenodd" clip-rule="evenodd" d="M7 1.3C10.14 1.3 12.7 3.86 12.7 7C12.7 10.14 10.14 12.7 7 12.7C5.48908 12.6974 4.0408 12.096 2.97241 11.0276C1.90403 9.9592 1.30264 8.51092 1.3 7C1.3 3.86 3.86 1.3 7 1.3ZM7 0C3.14 0 0 3.14 0 7C0 10.86 3.14 14 7 14C10.86 14 14 10.86 14 7C14 3.14 10.86 0 7 0ZM8 3H6V8H8V3ZM8 9H6V11H8V9Z"></path>
        </svg>
      </div>
      <div class="text-sm prose min-w-0">
        {children}
      </div>
    </div>;
};

Healthchecks keep a site or application available when one or more servers go down. This feature monitors server availability and excludes non-working IPs from DNS responses when issues occur. As a result, traffic is redirected from the problematic server to a working one, and the resource stays available for all users.

<Accordion title="Example of how Healthchecks works">
  This feature is especially important for business areas where the loss of availability means the loss of customers. Consider an online store that serves Europe and the US. The site runs on two servers — a European one and an American one — with Geobalancing routing visitors to the closest server. Customers from Paris and Barcelona are balanced to the European server, while customers from Vancouver and Chicago are balanced to the American one.

  <Frame>
    <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-1.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=b26a6e022a2c9f25edaf8d4e52059622" alt="Healthchecks scheme: both servers work" width="4800" height="2012" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-1.png" />
  </Frame>

  If the European server crashes, visitors balanced to it receive an error instead of the site. While the server is being fixed, customers visit a competitor's site instead.

  <Frame>
    <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-2.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=014db12da7ea3db3fcbe32869995cf0a" alt="Healthchecks scheme: one server is broken" width="4800" height="2012" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-2.png" />
  </Frame>

  With Healthchecks enabled, the next time the European server crashes, Healthchecks tells the DNS server not to include the unavailable IP in responses. All requests are directed to the American server, so the web application stays available — customers can continue making purchases without noticing the outage.

  <Frame>
    <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-3.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=a49b0211ddc7356f870d5b42901eee54" alt="Healthchecks scheme: redirecting requests to a working server" width="4800" height="2012" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-3.png" />
  </Frame>

  When the European server recovers, Healthchecks detects that and restores its IP in DNS responses for users in Europe.
</Accordion>

## Healthchecks mechanism

Healthchecks operate in a continuous poll-detect-respond cycle. The brief overview below covers the essentials; the step-by-step breakdown that follows explains each stage in detail.

**Basic explanation:**

DNS Healthchecks sends regular requests to each configured record to determine whether the server is reachable. A record is excluded from DNS responses when its server stops responding, and restored when it comes back online. By default, round-robin balancing distributes requests across available servers; Geobalancing can also be enabled.

**Detailed explanation:**

<Steps>
  <Step title="Healthchecks send requests to servers">
    DNS Healthchecks sends requests to servers to check their availability. Configure request settings — protocol, frequency, and others — in the Gcore Customer Portal after the feature is enabled.

    The following is an example configuration:

    * Protocol: ICMP
    * Frequency: 1 minute
    * Timeout: 10 seconds

    With this configuration, DNS Healthchecks sends requests to web servers via ICMP every 60 seconds.
  </Step>

  <Step title="Healthchecks classify servers">
    Requests are sent from all Gcore DNS server locations. If web servers respond within the set timeout (e.g., 10 seconds) in 85% of locations, the feature marks them as available. If a web server fails to respond within the timeout in 20% of locations, the feature marks it as unavailable. The gap between these thresholds is intentional — a server must fall below 20% to be marked unavailable, and must recover above 85% to be marked available again, preventing flapping when availability is borderline.
  </Step>

  <Step title="Unavailable records are excluded from DNS responses">
    If a web server is unavailable, Healthchecks marks the corresponding record as unavailable, and the DNS server excludes it from responses.

    <Info>
      If all Healthchecks fail, their A records will be included in the DNS response, while still adhering to other filters like *geo county* or *first\_n*.
    </Info>
  </Step>

  <Step title="Traffic is redirected to available servers">
    The DNS server removes the A record of the unavailable server from its responses. Any requests intended for the unavailable server are redirected to other available servers.

    The load balancing mechanism decides which server responds. By default, DNS Healthchecks use round-robin, but a custom mechanism can be configured. [Dynamic response](/dns/dns-records/configure-weight-balancing-and-geobalancing) covers the available load balancing options.
  </Step>

  <Step title="Recovered servers are restored to DNS responses">
    Healthchecks keep sending requests to web servers. When the web server becomes available and responds, the feature sends the appropriate update to the DNS server, and the web server goes back online for end-users.
  </Step>
</Steps>

<Frame>
  <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-4.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=aaaa0ae205f917e8b5b605362182c4e8" alt="Health Checks scheme" width="3680" height="2012" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-4.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-5.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=9c5c25886f63264877d1e5f3a8927b48" alt="Health Checks scheme" width="3680" height="2012" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-5.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-6.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=0d8dd94ec192cd686d200a102ed361c8" alt="Health Checks scheme" width="4800" height="2012" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-6.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-7.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=2159f953aeac7a8f7f6cf04604f8fd15" alt="Health Checks scheme" width="4800" height="2012" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-7.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-8.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=7a145819c6ef5f4961df6071fe9857a6" alt="Health Checks scheme" width="4800" height="2676" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-8.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-9.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=67e49b9d4b2fed1fa97fb949e5a55dfc" alt="Health Checks scheme" width="4800" height="1988" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/health-checks-9.png" />
</Frame>

## Configure healthchecks

<Steps>
  <Step title="Open the DNS section">
    In the [Gcore Customer Portal](https://portal.gcore.com), navigate to **DNS**.
  </Step>

  <Step title="Open the DNS zone">
    Click the domain name of the DNS zone where Healthchecks will be configured.

    <Frame>
      <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-08.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=3aa93a436fe64cfd58bb8fe943a2e231" alt="Open a DNS zone" width="1318" height="504" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-08.png" />
    </Frame>
  </Step>

  <Step title="Confirm advanced interface mode is enabled">
    In non-advanced mode, the Healthchecks feature isn't available.

    <Caution>
      A Healthcheck picker can be applied only to records of the **A**, **AAAA**, or **CNAME** type.
    </Caution>
  </Step>

  <Step title="Open the record for editing">
    Click the three-dot icon and click **Edit record** in the row of the A, AAAA, or CNAME record.

    <Frame>
      <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-10.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=0fc7b2e34272b2b94696c1c59f5d79c0" alt="Open a Records list/Edit record set page" width="1321" height="603" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-10.png" />
    </Frame>

    The "Records list/Edit record set" page will open. Perform the remaining steps there.

    <Frame>
      <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-20.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=b4e61d893226766a7b241f0594dd210a" alt="Select a Healthchecks picker" width="1021" height="829" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-20.png" />
    </Frame>
  </Step>

  <Step title="Enable Dynamic response" />

  <Step title="Add a Healthcheck picker" />

  <Step title="Open picker settings">
    Click the edit icon when the picker is added to the left column.

    A pop-up will open. The settings differ depending on the protocol: TCP/UDP, ICMP, or HTTP. Select the relevant tab below to complete configuration.

    <Tabs>
      <Tab title="TCP/UDP">
        <Frame>
          <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-30.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=5f79a76dc1e21cdb78492ee8539319fd" alt="Configure a Healthchecks picker: TCP or UDP" width="1400" height="900" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-30.png" />
        </Frame>

        1. Under "Protocol", select **TCP** or **UDP**.
        2. In the "Port" field, specify the connection port (e.g., 80 or 443).
        3. In the "Check Frequency" field, select the interval of checks from the list.
        4. In the "Timeout" field, set the time within which the web servers should give the response before being considered down.
        5. (Optional) In the "Command" field, enter the text that will be sent to the host as plain text, for instance: `GET / HTTP/1.1\n\n`.
        6. (Optional) In the "Expected content regexp" field, enter a regular expression that matches the response body or leave it blank.
        7. Click **Save**.
      </Tab>

      <Tab title="ICMP">
        <Frame>
          <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-40.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=dcde39dc5fc981988369efeb8feb3e60" alt="Configure a Healthchecks picker: ICMP" width="1400" height="900" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-40.png" />
        </Frame>

        1. Under "Protocol", select **ICMP**.
        2. In the "Check Frequency" field, select the interval of checks from the list.
        3. In the "Timeout" field, set the time within which the web servers should give the response before being considered down.
        4. Click **Save**.
      </Tab>

      <Tab title="HTTP">
        <Frame>
          <img src="https://mintcdn.com/gcore-docs/_1o_HfAZkRkFWsIz/images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-50.png?fit=max&auto=format&n=_1o_HfAZkRkFWsIz&q=85&s=939406833c4c9f71bdde7bfbc2574099" alt="Configure a Healthchecks picker: HTTP" width="1400" height="900" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-50.png" />
        </Frame>

        1. In the "Protocol" block, select **HTTP**.
        2. In the "Port" field, specify the connection port (e.g., 80 or 443).
        3. In the "Check Frequency" field, select the interval of checks from the list.
        4. In the "Timeout" field, set the time within which the web servers should give the response before being considered down.
        5. (Optional) In the "Host" field, specify a value of the Host header to be passed during the HTTP request.
        6. In the **Request URL** field, enter the URL that will be requested for checks.
        7. In the **Request Method** block, select the method for checking requests; e.g., GET.
        8. In the "Use TLS" block, select whether TLS should be used.
        9. In the "HTTP status code" field, put the expected HTTP response code or leave it blank if any response is acceptable.
        10. (Optional) In the "Expected content regexp" field, enter a regular expression that matches the response body or leave it blank.
        11. Click **Save**.
      </Tab>
    </Tabs>
  </Step>
</Steps>

Healthchecks begin monitoring the configured address on the next check interval. If the server is unreachable, its record is excluded from DNS responses automatically and restored once it recovers. Recent monitoring events are available in the health check logs section below.

## Enable backup metadata

Backup metadata keeps designated records out of DNS responses as long as at least one non-backup record is healthy. When all primary records fail, backup records take over automatically.

To configure backup metadata, select which record will be used as a backup (Record one in the example), select "backup" from the dropdown list, and enable the toggle.

<Frame>
  <img src="https://mintcdn.com/gcore-docs/xkpzeHgKKKD4ZA-j/images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-60.png?fit=max&auto=format&n=xkpzeHgKKKD4ZA-j&q=85&s=b5a4bab64e0fd19b6d66ca00392edf98" alt="Configure backup metadata" width="1024" height="746" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-60.png" />
</Frame>

By default, DNS Healthchecks use round-robin balancing. [Dynamic response](/dns/dns-records/configure-weight-balancing-and-geobalancing) covers the options for configuring how requests are distributed among available servers.

## Check healthchecks logs

After a DNS cache renewal, Healthchecks will start monitoring availability.

To check for recent monitoring events, open the DNS zone page where Healthchecks is configured. Select the relevant record, click the three-dot icon on the right, and click **Health check logs**.

<Frame>
  <img src="https://mintcdn.com/gcore-docs/xkpzeHgKKKD4ZA-j/images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-70.png?fit=max&auto=format&n=xkpzeHgKKKD4ZA-j&q=85&s=fe0f52484563e2a676cf0dadfddabee4" alt="Check monitoring logs" width="1057" height="674" data-path="images/docs/dns/dns-failover/configure-and-use-dns-failover/healthchecks-70.png" />
</Frame>
