Redis - Connect Redis to vRack
Connect an OVHcloud managed Redis cluster to vrack
Connect an OVHcloud managed Redis cluster to vrack
Last updated March 17th, 2022
This page shows you how to create and use a managed Redis cluster with vRack.
We are going to connect a cloud instance, hosted in a datacenter, to a Redis database, hosted in another datacenter, like this:
This will be, from a configuration point of view, the equivalent of this:
The OVHcloud vRack is a private network solution that enables our customers to route traffic between OVHcloud dedicated servers as well as other OVHcloud services, such as databases. The vRack also allows you to add Public Cloud instances to your private network to create an infrastructure of physical and virtual resources.
Your vRack must be configured to be accessible from all the services in your Public cloud project.
The first step is to create the virtual network that will be used in your vRack.
To proceed, from the
Public cloud tab, click on the
Private Network menu, then click on the
Add Private Network button.
You can define yourself a VLAN ID for your virtual network. Value must be between 2 and 4,000.
Define your own range or let dynamic address distribution if you want to use DHCP.
By default, the 10.0.0.0/16 CIDR address is defined. Different subnets can be added later.
Give a name to your virtual network.
Choose the regions where you want your virtual network to operate.
The subnets addresses are automatically ajusted, depending on the number of regions you choose.
Your vRack is ready!
Create a new Redis database service:
Choose the Business solution.
According the Redis capabilities page, the use of private networks with databases is allowed for Business and Enterprise plans.
Choose the region in which you want to create your database.
Select the instances model.
Give a name to the database.
Select Private from the Network Type list, then select XXXX - my-private-network. The XXX value is the ID of the vRack.
From the Subnetwork list, select the 10.0.0.0/16 - YYY. The YYY value is the name of the datacenter you chose.
The final section will display a summary of your order as well as the API equivalent for creating this database instance with the OVHcloud API.
Wait a few minutes before the end of the creation of all nodes. When this is done, status changes to ready.
Now you can add users and roles to interact with the database.
Users tab, click on the
+ Add user button.
Name the Redis user and give him some rights.
You can follow the official Redis documentation about users and ACL: https://redis.io/topics/acl.
Once the user is created, the password is displayed in plain text. Save it in a password manager as it won't be displayed again.
The last step is to authorize access from your required IPs.
Authorised IPs tab, click on the
+ Add an IP address or IP block (CIDR) button.
The simplest way is to authorize the whole private network, as defined on previous steps.
Check that everything is fine:
That's it! Your managed Redis database is ready to be accessed within the vRack virtual network.
The database is now connected to the virtual network, we can use it from any component that is connected to the same vRack.
If you want to test the access from an existing instance, read this tutorial to connect it to the vRack: Configuring vRack for Public Cloud.
For this tutorial, create a new instance by following the next steps.
Start by selecting a model.
Choose another region than the database one.
Select Debian from the images list.
Adjust the number of instances to be created, give a name, then select the desired virtual network XXXX - my-private-network.
Choose your billing option.
Wait for the Activated status.
We assume that you have an already set SSH key on your project. For more details, read the Creating and connecting to your first Public Cloud instance page.
Connect to the instance via SSH:
Now install the Redis client by installing the Redis server package:
sudo apt-get update && sudo apt-get install redis-server -y
Now connect to the Redis database using the URL retrieved from the OVHcloud Control Panel, with a command such as:
redis-cli --tls -u "rediss://firstname.lastname@example.org:20185"
Authenticate yourself with the AUTH command:
AUTH my-redis-user myRedisUserPassword
Test the overall operation with these sample commands:
redis-2612345abc-abcd1234defg.database.cloud.ovh.net:20185> ping PONG redis-2612345abc-abcd1234defg.database.cloud.ovh.net:20185> SET mykey.test test OK redis-2612345abc-abcd1234defg.database.cloud.ovh.net:20185> GET mykey.test "test"
We would love to help answer questions and appreciate any feedback you may have.
Are you on Discord? Connect to our channel at https://discord.gg/PwPqWUpN8G and interact directly with the team that builds our databases service!
Não hesite em propor-nos sugestões de melhoria para fazer evoluir este manual.
Imagens, conteúdo, estrutura... Não hesite em dizer-nos porquê para evoluirmos em conjunto!
Os seus pedidos de assistência não serão tratados através deste formulário. Para isso, utilize o formulário "Criar um ticket" .
Obrigado. A sua mensagem foi recebida com sucesso.
Aceda ao seu espaço comunitário. Coloque as suas questões, procure informações e interaja com outros membros do OVHcloud Community.Discuss with the OVHcloud community