Redis Configuration & Health Monitoring
  • 21 Nov 2024
  • Dark
    Light
  • PDF

Redis Configuration & Health Monitoring

  • Dark
    Light
  • PDF

Article summary

Itential Automation Platform (IAP) uses Redis for shared authentication token storage and expiration.

The authentication token function can be performed by the same local Redis for the standalone topology. To achieve an HA topology, Redis sentinels are used to provide master-slave replication for the shared authentication token storage function.

The default settings for the core Redis properties are sufficient for most IAP installations. You should only need to modify the default settings if you are configuring an IAP HA topology or need to configure password authentication in either topology.

Core Redis Properties

The core Redis properties are configured by default to connect to a Redis process running on the same server as IAP. A password may be configured if the Redis server requires authentication.

The following properties are commonly applied to the core Redis configuration.

Property Description
host The host name or IP address of the Redis server. IPv6 and IPv4 addresses are supported.
port The port number for the Redis server. The default port is 6379.
password The password for the Redis server to secure access to the data. It can be provided in clear-text or in encrypted fashion, e.g., $ENCABC1234.
maxRetriesPerRequest The maximum number of connection retries on a lost Redis link. The default is 20.
maxHeartbeatWriteRetries The maximum number of write retries on the lost ability to write data in Redis. The default is 20.

Standalone Redis Configuration

Below is a sample config for a standalone Redis configuration.

{
    ...
    "redisProps": {
        "host": "127.0.0.1",
        "port": 6379,
        "password": "$ENC87eb897b507afc1796db49409dd02e1d848a208ca9d74593",
        "maxRetriesPerRequest": 20,
        "maxHeartbeatWriteRetries": 20
    },
    ...
}

Redis HA Configuration

Below is a sample config for a Redis HA configuration.

{
    "id": "redis",
    "type": "Redis",
    "properties": {
        "name": "mymaster",
        "password": "$ENC87eb897b507afc1796db49409dd02e1d848a208ca9d74593",
        "sentinels": [
            {
                "host": "redis1",
                "port": 26379
            },
            {
                "host": "redis2",
                "port": 26379
            },
            {
                "host": "redis3",
                "port": 26379
            }
        ],
        "maxRetriesPerRequest": 20,
        "maxHeartbeatWriteRetries": 20
    }
}

Health Monitoring

The Redis driver used by IAP inherits most of its configuration parameters from the ioredis library at Github-luin/ioredis. There are some additional customized parameters to help fit the driver into an IAP solution.

These settings are used in Redis health monitoring.

Property Type Default Description
maxRetriesPerRequest Number 20 The maximum number of connection retries on a lost Redis link. IAP will shutdown when the maxRetriesPerRequest limit is reached.
maxHeartbeatWriteRetries Number 20 The maximum number of write retries on the lost ability to write data in Redis. IAP will be shutdown when maxHeartbeatWriteRetries limit is reached.

When the driver discovers Redis connection problems, it immediately starts reconnection attempts via predefined retryStrategy. Parameter maxRetriesPerRequest is a counter for those reconnection attempts. As soon as it reaches the defined value, IAP is shutdown. If the driver is able to get the connection back, the connectionRetries is reset.

The driver also checks the ability of Redis to write data. Heartbeat is fired every predefined heartbeatInterval time which is 2000 ms. When the heartbeat discovers a problem during writing, it triggers a predefined retryHeartbeatWriteStrategy. Parameter maxHeartbeatWriteRetries is a counter for the next write attempts during retryHeartbeatWriteStrategy execution. As soon as it reaches the defined value, IAP is shutdown. If the heartbeat is again able to write data, writeRetries is reset.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.