# Health Check

We can enable health checks for gateway nodes at partition level or gateway cluster level.

When the health check is enabled, edge-admin will send a request to the edge-node to check if the edge-node is health. If it does not meet expectations, the node is considered unhealthy.

Note: the network from edge-admin to edge-node should be connectable before enabling health check, otherwise the node will be considered unhealthy by admin due to the bad network.

# Enabling health checks at partition level

Let's try the partition level first. We can configure health checker of all gateway nodes in the same partition, which is the recommended way.

Let's go to the Gateway Network Partitions page, which lists the partitions that already exist (usually, there is only one default partition, or a small number of them).

Next, we edit a partition and select the Basic tab to see the health check switch (which is off by default).

After enabling the health check, we can further configure the health check parameters.

Edge supports three health check modes:

  1. tcp
  2. http
  3. https

means that the edge admin will send such request to the edge node:

  1. tcp connection
  2. http request
  3. https request

For tcp check mode, the node is considered healthy only if the tcp connection is successful. For http/https mode, you can also configure the desired response status code, or the string pattern that the response body needs to contain.

Clicking save will enable the health check.

When the number of consecutive unhealthy checks for a gateway node reaches the configured threshold, the Edge will automatically mark the node as "offline" (the green light in front of the node IP will turn red on the Gateway Cluster page). This means: the node is automatically removed from the DNS and in-cluster caching services.

We can also view the specific logs of the health check:

Here we can see the number of recent successful/failed checks for each node and the reason for the failure.

# Enabling health checks at gateway cluster level

If we want to do some special health check configuration for a particular gateway cluster, we can do that too. Let's go to the Gateway Clusters page, which lists the gateway clusters that already exist.

We click on the edit button for a gateway cluster and we can see that there are three options:

  1. Using the partition configuration (this will be used by default)
  2. Enable (for this gateway cluster, the health check is customised to be enabled)
  3. Disable (disables health checks for this gateway cluster, but does not affect other gateway clusters in the same partition)

For example, let's turn off health checks for this gateway cluster.

Clicking save turns off the health check for this gateway cluster.