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.
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:
-
Select the network you want to use for your Redis nodes, for example Default.
-
Go to the Firewall tab, and create a new rule using the below configurations.
Protocol Port Description ICMP * Redis gossip protocol UDP 53, 5353 Redis DNS TCP 10000-20000 Redis connectivity TCP 8443 Secure (HTTPS) access to the web management UI -
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
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:
-
Select the machine type based on the hardware requirements above.
-
Change the boot disk to Ubuntu 20.04 LTS.
-
Reserve internal and external static IP addresses for the VM.
-
SSH into the VM.
-
Run the following commands.
wget <redis-download-url>
tar xf <redis-file-name>
-
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
-
Run the following command.
sudo ./install.sh -y
-
Check the installation logs for errors.
-
Repeat the steps to configure your other two VMs.
Create DNS records
To create DNS records, do the following:
-
Go to the DNS portal of your domain registrar.
-
Create three type A records with subdomains for the public domain name, for example,
node1.harness-redis-abc.com
,node2.harness-redis-abc.com
, andnode3.harness-redis-abc.com
. -
Add the internal IP and external IP for each VM in their respective A records.
-
Create one NS record with a different subdomain, for example
redis.harness-redis.com
. -
Add the subdomains of all your nodes, for example
node1.harness-redis.com
,node2.harness-redis.com
, andnode3.harness-redis.com
.
Configure your Redis cluster
To configure your Redis cluster, do the following:
-
Open
https://<EXTERNAL_IP_OF_NODE1>:8443
in your browser, and then complete the following on the node setup page.-
Enable Flash Storage.
-
Select + next to the IP, add the external IP, and then select Save.
-
Disable external traffic on the internal IP.
-
Add the DNS record subdomain in the FQDN field used in the NS record, for example,
redis.harness-redis.com
. -
Create your admin credentials.
-
Select Create Cluster.
-
Select Next.
infoYou can skip the cluster key for now if the page opens. (You can procure a license key from Redis Labs later, if required.)
-
-
Open
https://<EXTERNAL_IP_OF_NODE2>:8443
in your browser, and then complete the following on the node setup page.-
Enable Flash Storage.
-
Select + next to the IP, add the external IP, and then select Save.
-
Disable external traffic on the internal IP.
-
Select Join cluster.
-
Add the internal IP of your first node.
-
Enter your admin credentials.
-
Select Create.
-
-
Open
https://<EXTERNAL_IP_OF_NODE3>:8443
in your browser, and then complete the following on the node setup page.-
Enable Flash Storage.
-
Select + next to the IP, add the external IP, and then select Save.
-
Disable external traffic on the internal IP.
-
Select Join cluster.
-
Add the internal IP of your first node.
-
Enter your admin credentials.
-
Select Create.
-
Configure your Redis database
To configure your Redis database, do the following:
-
Open
https://<YOUR_NODE1_EXTERNAL_IP>:8443
in your browser. -
Select the Databases tab.
-
Select Single region Redis database.
-
Select runs on RAM.
-
Enable replication.
-
Set the database memory to 2GB.
-
Enter the database password.
-
Select Create.
-
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:
-
Run the following command.
redis-cli -h <YOUR_INTERNAL_ENDPOINT> -p <port>
-
Run the following.
ping
The expected response is pong
.
-
Run the following.
set foo bar
-
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"