Skip to main content

Use an external self-managed Redis database with your installation

Harness Self-Managed Enterprise Edition requires you to install a database by default. You can optionally use an external database with your installation. This enables you to separate your data from node execution. To use an external self-managed Redis database with your Harness Self-Managed Enterprise Edition installation, you must ensure that your hardware, software, and network meet the minimum requirements for installation and configuration.

Redis offers an enterprise on-premise solution to deploy an HA solutions that functions like a single server. You can install Redis on your preferred choice of virtual machines and provide the endpoint in your Harness Helm charts. Harness recommends this solution to install Redis in HA mode.

This tutorial describes how to configure an external self-managed Redis database for your installation.

Hardware requirements

Harness recommends a Redis configuration with the following minimum hardware:

  • 3 VMs
  • 8 cores per machine
  • 8GB memory per machine
  • 64GB disk per machine (SSD preferred)
  • 1GB/s minimum network bandwidth

Software requirements

External database setup requires the following software:

  • Supported OS: Ubuntu 20.04 LTS

Prerequisites

The following prerequisites are needed:

  • A Redis Labs account. To sign up, go to the Redis Cloud Console.

  • Redis Enterprise. To download Redis for Ubuntu 20.04, go to Redis enterprise.

  • A public or internal domain name, for example harness-redis-abc.com.

Set up firewall rules

External Redis requires firewall rule setup to add ports to your allowlist.

warning

Example settings used in this tutorial are for instructional purposes only. Replace the examples with your organization's IP requirements. Harness recommends following your organization's standards for firewall rule settings.

To create a firewall rule, do the following:

  1. Select the network you want to use for your Redis nodes, for example Default.

  2. Go to the Firewall tab, and create a new rule using the below configurations.

    ProtocolPortDescription
    ICMP*Redis gossip protocol
    UDP53, 5353Redis DNS
    TCP10000-20000Redis connectivity
    TCP8443Secure (HTTPS) access to the web management UI
  3. For testing purposes, set the source IP ranges to your public IP.

Install Redis

After you configure your firewall rules, you must install Redis. To install Redis, you must create three VMs, create DNS records, configure your Redis cluster, configure your Redis database, and test your connectivity.

Create your VMs

warning

Example passwords used in this tutorial are for instructional purposes only. Replace the examples with your own secure passwords. Harness recommends following your organization's standards for password security, including the use of strong passwords. Strong passwords are:

  • At least 12 characters long. Longer passwords are more secure.
  • Any combination of uppercase letters, lowercase letters, numbers, and symbols.
  • Not a word in the dictionary of any language or the name of a person, place, character, or organization.
  • Unique for each account.

To create your VMs, do the following:

  1. Select the machine type based on the hardware requirements above.

  2. Change the boot disk to Ubuntu 20.04 LTS.

  3. Reserve internal and external static IP addresses for the VM.

  4. SSH into the VM.

  5. Run the following commands.

    wget <redis-download-url>
    tar xf <redis-file-name>
  6. Disable port 53. For more information, go to Ensure port availability in the Redis documentation.

    Output:

    sudo: unable to resolve host <hostname>: Temporary failure in name resolution
  7. Run the following command.

    sudo ./install.sh -y
  8. Check the installation logs for errors.

  9. Repeat the steps to configure your other two VMs.

Create DNS records

To create DNS records, do the following:

  1. Go to the DNS portal of your domain registrar.

  2. Create three type A records with subdomains for the public domain name, for example, node1.harness-redis-abc.com, node2.harness-redis-abc.com, and node3.harness-redis-abc.com.

  3. Add the internal IP and external IP for each VM in their respective A records.

  4. Create one NS record with a different subdomain, for example redis.harness-redis.com.

  5. Add the subdomains of all your nodes, for example node1.harness-redis.com, node2.harness-redis.com, and node3.harness-redis.com.

Configure your Redis cluster

To configure your Redis cluster, do the following:

  1. Open https://<EXTERNAL_IP_OF_NODE1>:8443 in your browser, and then complete the following on the node setup page.

    1. Enable Flash Storage.

    2. Select + next to the IP, add the external IP, and then select Save.

    3. Disable external traffic on the internal IP.

    4. Add the DNS record subdomain in the FQDN field used in the NS record, for example, redis.harness-redis.com.

    5. Create your admin credentials.

    6. Select Create Cluster.

    7. Select Next.

    info

    You can skip the cluster key for now if the page opens. (You can procure a license key from Redis Labs later, if required.)

  2. Open https://<EXTERNAL_IP_OF_NODE2>:8443 in your browser, and then complete the following on the node setup page.

    1. Enable Flash Storage.

    2. Select + next to the IP, add the external IP, and then select Save.

    3. Disable external traffic on the internal IP.

    4. Select Join cluster.

    5. Add the internal IP of your first node.

    6. Enter your admin credentials.

    7. Select Create.

  3. Open https://<EXTERNAL_IP_OF_NODE3>:8443 in your browser, and then complete the following on the node setup page.

    1. Enable Flash Storage.

    2. Select + next to the IP, add the external IP, and then select Save.

    3. Disable external traffic on the internal IP.

    4. Select Join cluster.

    5. Add the internal IP of your first node.

    6. Enter your admin credentials.

    7. Select Create.

Configure your Redis database

To configure your Redis database, do the following:

  1. Open https://<YOUR_NODE1_EXTERNAL_IP>:8443 in your browser.

  2. Select the Databases tab.

  3. Select Single region Redis database.

  4. Select runs on RAM.

  5. Enable replication.

  6. Set the database memory to 2GB.

  7. Enter the database password.

  8. Select Create.

  9. Copy the Internal Endpoint for later use.

Test connectivity

You can test your connectivity using the Redis CLI.

To test your connectivity using, do the following:

  1. Run the following command.

    redis-cli -h <YOUR_INTERNAL_ENDPOINT> -p <port>
  2. Run the following.

    ping

The expected response is pong.

  1. Run the following.

    set foo bar
  2. Run the following.

    get foo

    The expected response is bar.

Configure your Harness environment and Helm chart

After you've tested your connectivity, you're ready to configure your Harness environment.

To configure your Harness environment and Helm chart, do the following:

  • Create a secret in the namespace where harness is installed with following data

    data:
    root-password: <REDIS_PASSWORD>
    root-username: ""
  • Add the following override entries to your newly-installed Harness Redis instance.

    global:
    database:
    redis:
    installed: false
    hosts:
    - <YOUR_INTERNAL_ENDPOINT_AND_PORT>
    secretName: "REDIS_SECRET"
    userKey: "ROOT_USERNAME"
    passwordKey: "ROOT_PASSWORD"