Redis is a private service and accessible only within the VCN or appropriately peered VCNs.
You can connect to the OCI Redis Clusters using the cluster endpoints provided.
To write to the redis cluster, connect using the Primary endpoint.
To read from the redis cluster, connect using the Replica endpoint.
You may choose a client library your programming language supports to connect to OCI Cache with Redis.
For example, Lettuce or Jedis for Java, redis-py for Python, node-redis for Node.js, go-redis for Go and so on.
You can use redis-cli to connect to Redis cluster. The redis-cli is a command-line based tool connect to your redis clusters which can also be used to get valuable insights from the redis cluster.
To use redis-cli comes included with the Redis package. You need to establish a secure TLS connection between the client/application and redis server. You should use redis-cli version 6 or above so that it supports the --tls switch to establish as secure TLS connection.
By default, redis version 5 is default in the stream on Oracle Linux 8.
See below for Oracle Linux 7/RedHat Linux 7/CentOs 7.
[root@jay ~]# yum module list redis
Last metadata expiration check: 0:06:43 ago on Fri 27 Oct 2023 14:34:46 GMT.
Oracle Linux 8 Application Stream (x86_64)
Name Stream Profiles Summary
redis 5 [d][e] common [d] Redis persistent key-value database
redis 6 common [d] Redis persistent key-value database
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@jay ~]#
To install Redis Version 6, you need to enable redis 6 module stream.
[root@jay ~]# yum module enable redis:6
Last metadata expiration check: 0:10:29 ago on Fri 27 Oct 2023 14:34:46 GMT.
Dependencies resolved.
======================================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================================
Enabling module streams:
redis 6
Transaction Summary
======================================================================================================================================================================================================
Is this ok [y/N]: y
Complete!
[root@jay ~]#
However, if you end up with the following error: “Error: It is not possible to switch enabled streams of a module unless explicitly enabled via configuration option module_stream_switch.”, you need to uninstall previous redis versions and reset the redis module as follows.
[root@jay ~]# yum module enable redis:6
Last metadata expiration check: 0:07:49 ago on Fri 27 Oct 2023 14:34:46 GMT.
Dependencies resolved.
The operation would result in switching of module 'redis' stream '5' to stream '6'
Error: It is not possible to switch enabled streams of a module unless explicitly enabled via configuration option module_stream_switch.
It is recommended to rather remove all installed content from the module, and reset the module using 'yum module reset <module_name>' command. After you reset the module, you can install the other stream.
[root@jay ~]#
[root@jay ~]# yum module reset redis
Last metadata expiration check: 0:10:14 ago on Fri 27 Oct 2023 14:34:46 GMT.
Dependencies resolved.
======================================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================================
Resetting modules:
redis
Transaction Summary
======================================================================================================================================================================================================
Is this ok [y/N]: y
Complete!
[root@jay ~]#
Once redis mode is reset and version 6 module is enabled, you may proceed with installing redis version 6 as follows.
[root@jay ~]# yum module install redis
Last metadata expiration check: 0:11:16 ago on Fri 27 Oct 2023 14:34:46 GMT.
Dependencies resolved.
======================================================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================================================
Installing group/module packages:
redis x86_64 6.2.7-1.module+el8.7.0+20764+cc495aeb ol8_appstream 1.2 M
Installing module profiles:
redis/common
Transaction Summary
======================================================================================================================================================================================================
Install 1 Package
Total download size: 1.2 M
Installed size: 4.3 M
Is this ok [y/N]: y
Downloading Packages:
redis-6.2.7-1.module+el8.7.0+20764+cc495aeb.x86_64.rpm 6.9 MB/s | 1.2 MB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 6.8 MB/s | 1.2 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: redis-6.2.7-1.module+el8.7.0+20764+cc495aeb.x86_64 1/1
Installing : redis-6.2.7-1.module+el8.7.0+20764+cc495aeb.x86_64 1/1
Running scriptlet: redis-6.2.7-1.module+el8.7.0+20764+cc495aeb.x86_64 1/1
Verifying : redis-6.2.7-1.module+el8.7.0+20764+cc495aeb.x86_64 1/1
Installed:
redis-6.2.7-1.module+el8.7.0+20764+cc495aeb.x86_64
Complete!
[root@jay ~]#
On Oracle Linux 7/RHEL 7/CentOs7:
On Oracle Linux 7 / RedHat Linux 7, you should install ‘epel-release-7-14’ and ‘remi’ repositories to get the latest version of Redis. The default repo has only 3.X.X which doesn't support 'tls' in-transit encryption.
# yum -y 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
You should get Redis v7.X.X which has support for 'tls' connections.
You should now be able to connect to Redis cluster using redis-cli:
# redis-cli --tls -h <Redis Endpoint>
[root@jay ~]# redis-cli --tls -h amaaaaaa2ne4d2g6eiu32jva-p.redis.eu-frankfurt-1.oci.oraclecloud.com
amaaaaaa2ne4d2g6eiu32jva-p.redis.eu-frankfurt-1.oci.oraclecloud.com:6379>
amaaaaaa2ne4d2g6eiu32jva-p.redis.eu-frankfurt-1.oci.oraclecloud.com:6379> set key value
OK
amaaaaaa2ne4d2g6eiu32jva-p.redis.eu-frankfurt-1.oci.oraclecloud.com:6379> get key
"value"
amaaaaaa2ne4d2g6eiu32jva-p.redis.eu-frankfurt-1.oci.oraclecloud.com:6379> quit
[root@jay ~]#
No comments:
Post a Comment