OCI Redis: How to provision & Use it with Redis-cli on OCI
Architecture
Pre-requisites
I will provision an Oracle Linux VM in the Private Subnet and a Public Load Balancer Infront of it, so that I can access the VM via LB.
Provisioning
We will provision OCI Redis in a Private subnet and this creates a separate security list for OCI Redis alone and attaches this to the Private Subnet on which we are provisioning OCI Redis cluster.
NOTE: Do not delete this new security List it creates
Navigate to Databases → Redis → Clusters and click on Clusters.
Click on “Create cluster”
- Configure the Cluster
2. Configure nodes → Mention the number of nodes and the Memory Per node in OCI Redis Cluster
3. Configure Networking → Select the VCN & Subnet where OCI Redis Cluster is to be provisioned
4. Review the config and click on “Create Cluster”
5. This completes provisioning of OCI Redis Cluster with 3 nodes and 16GB Memory per node. This gives your endpoints for Primary, replica and each every node.
6. Now that OCI Redis is provisioned, let us install a Redis-Client on the Application VM to connect to the provisioned Redis.
a. connect to the private VM where redis-cli is to be configured.
b. sudo to the root user to start with installation and run the below set of commands to download the packages, install redis-cli and enable it.
sudo su -
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum — enablerepo=remi install redis
rpm -qi redis
systemctl enable — now redis
This completes installing redis-cli on the Application VM.
Testing
Now to test the redis-cli I will try connecting to one of the nodes.
command to connect to oci redis endpoint is
redis-cli — tls -h <endpoint>
Now, let us try pub-sub using OCI Redis
NOTE: The OLE Version considered is Autonomous 7.9 for all the above installations of redis-cli
!!Happy Reading!!