NavigationContentFooter

Managed Database for Redis™ API

Introduction

Managed Database for Redis™ is a low-latency caching solution. It allows you to easily set up a secure cache and lighten the load on your main database. Based on the in-memory data storage, Managed Database for Redis™ improves your application response time and helps you provide a better experience to your users.

Using Managed Database for Redis™ as a cache optimizes the speed of your requests as copies of the most frequently used data are stored in memory, making them accessible in milliseconds.

Concepts

Refer to our dedicated concepts page to find definitions of the different terms referring to Managed Database for Redis™.

Quickstart

  1. Configure your environment variables.

    Note

    This is an optional step that seeks to simplify your usage of the APIs

    export ACCESS_KEY="<access-key>"
    export SECRET_KEY="<secret-key>"
    export SCW_ZONE="<zone>"
  2. Edit the POST request payload you will use to create your Redis™ Database Instance cluster. Replace the parameters in the following example:

    {
    "project_id":"50e8d5d3-c623-4df8-a5ef-1972a5432001",
    "name":"cluster1",
    "version":"7.0.5",
    "tags":[
    "tag1"
    ],
    "node_type":"RED1-micro",
    "user_name":"redis-user",
    "password":"lxbemloZiPT1l37*",
    "cluster_size": 3,
    "tls_enabled": true
    }
    ParameterDescription
    project_idREQUIRED The ID of the Project you want to create your Database Instance in. To find your Project ID you can list the projects or consult the Scaleway console.
    nameName of the Redis™ Database Instance
    versionREQUIRED Version of the Redis™ engine. To check the list of available versions you can use the folowing endpoint: https://api.scaleway.com/redis/v1/zones/$SCW_ZONE/cluster-versions
    tagsThe list of tags ["tag1", "tag2", ...] that will be associated with the Redis™ Database Instance. Tags can be appended to the query of the List Database Instances call to show a list of the Database Instances using a specific tag. You can also combine tags to list Database Instances that possess all of the appended tags.
    node_typeREQUIRED The node type. To check the list of available node types you can use the folowing endpoint: https://api.scaleway.com/redis/v1/zones/$SCW_ZONE/node-types
    user_nameREQUIRED Identifier of the default user, which is created concurrently with the Redis™ Database Instance
    passwordREQUIRED Password for the default user
    cluster_sizeINTEGER The number of nodes in the Redis™ Database Instance cluster. You can either set it to 1 for a standalone Database Instance, 2 for High Availability, or from 3 to 6, for cluster mode
    tls_enabledBOOLEAN Whether or not to enable TLS certificates
  3. Create a Redis™ Database Instance by running the following command. Make sure you include the payload you edited in the previous step.

    curl -X POST \
    -H "Content-Type: application/json" \
    -H "X-Auth-Token: $SCW_SECRET_KEY" https://api.scaleway.com/redis/v1/zones/$SCW_REGION/clusters \
    -d '{
    "project_id":"50e8d5d3-c623-4df8-a5ef-1972a5432001",
    "name":"cluster1",
    "version":"7.0.5",
    "tags":[
    "tag1"
    ],
    "node_type":"RED1-micro",
    "user_name":"redis-user",
    "password":"lxbemloZiPT1l37*",
    "cluster_size": 2,
    "tls_enabled": true
    }'
  4. List your Redis™ Database Instances.

    curl -X GET
    -H "Content-Type: application/json" \
    -H "X-Auth-Token: $SCW_SECRET_KEY" https://api.scaleway.com/redis/v1/zones/$SCW_ZONE/clusters
  5. Retrieve your Redis™ Database Instance IP and port from the response.

    Note

    In this tutorial, we will use 192.0.2.0 and 6379 as the IP and port, respectively

  6. Connect to your Database Instance with the Redis™ client.

    Note

    You can use only one of your node IP addresses at a time to connect to your Redis™ Database Instance, as the Redis™ CLI does not support cluster mode.

    redis-cli -h 192.0.2.0 -p 6379 --user redis-user --askpass --tls --cacert SSL_redis-cluster1.pem
    Note

    The command above uses TLS to add an extra layer of security to your connection. The TLS certificate is generated automatically if you set tls_enabled to true. The certificates take on the following name structure: SSL_redis-<name-of-your-redis-database-instance>.pem. When using connectors other than redis-cli, you might need to specify the path to your certificate.

    Important

    Scaleway supports TLS1.2 and TLS1.3. If you use older versions of libssl, you might encounter connexion issues when using redis-cli. If this is the case, we recommend you check the libssl versions installed on your local machine and update if necessary.

  7. Enter the database password that you defined upon creation.

You are now connected to your Managed Database for Redis™.

Requirements

To perform the following steps, you must first ensure that:

  • you have an account and are logged into the Scaleway console
  • you have created an API key and that the API key has sufficient IAM permissions to perform the actions described on this page.
  • you have installed curl

Going Further

For more information about Managed Database for Redis™, you can check out the following pages:

  • Managed Database for Redis™ Documentation
  • Managed Database for Redis™ FAQ
  • Scaleway Slack Community join the #database channel
  • Contact our support team.

Redis™ Database Instance

A Redis™ Database Instance, also known as a Redis™ cluster, consists of either one standalone node or a cluster composed of three to six nodes. The cluster uses partitioning to split the keyspace. Each partition is replicated and can be reassigned or elected as the primary when necessary. Standalone mode creates a standalone database provisioned on a single node.

GET
/redis/v1/zones/{zone}/clusters
POST
/redis/v1/zones/{zone}/clusters
GET
/redis/v1/zones/{zone}/clusters/{cluster_id}
PATCH
/redis/v1/zones/{zone}/clusters/{cluster_id}
DELETE
/redis/v1/zones/{zone}/clusters/{cluster_id}
GET
/redis/v1/zones/{zone}/clusters/{cluster_id}/metrics
POST
/redis/v1/zones/{zone}/clusters/{cluster_id}/migrate

Nodes Types

Nodes are the compute units that make up your Redis™ Database Instance. Different node types are available with varying amounts of RAM and vCPU.

GET
/redis/v1/zones/{zone}/node-types

Redis™ engine versions

The Redis™ database engine versions available at Scaleway for your clusters.

GET
/redis/v1/zones/{zone}/cluster-versions

TLS Certificates

Transport Layer Security (TLS) is an Internet security protocol that enables data to be securely exchanged over a network using in transit encryption. If you set the tls_enabled parameter to true when creating or updating a cluster, a TLS certificate will be automatically generated for your Redis™ Database Instance to ensure secure connections.

GET
/redis/v1/zones/{zone}/clusters/{cluster_id}/certificate
POST
/redis/v1/zones/{zone}/clusters/{cluster_id}/renew-certificate

Advanced Settings

Advanced settings allow you to tune the behavior of your Redis™ database engine to better fit your needs. Available settings depend on the version of the Redis™ engine. Note that some settings can only be defined upon the Redis™ engine initialization. These are called init settings. You can find a full list of the settings available in the response body of the list available Redis™ versions endpoint.

Each advanced setting entry has a default value that users can override. The deletion of a setting entry will restore the setting to default value. Some of the defaults values can be different from the engine's defaults, as we optimize them to the Scaleway platform.

POST
/redis/v1/zones/{zone}/clusters/{cluster_id}/settings
PUT
/redis/v1/zones/{zone}/clusters/{cluster_id}/settings
DELETE
/redis/v1/zones/{zone}/clusters/{cluster_id}/settings/{setting_name}

ACL Rules

Network Access Control Lists (ACLs) allow you to manage network inbound traffic by setting up ACL rules.

GET
/redis/v1/zones/{zone}/acls/{acl_id}
DELETE
/redis/v1/zones/{zone}/acls/{acl_id}
POST
/redis/v1/zones/{zone}/clusters/{cluster_id}/acls
PUT
/redis/v1/zones/{zone}/clusters/{cluster_id}/acls

Endpoints

Manage endpoint access to your Redis™ Database Instance through Public or Private Networks

POST
/redis/v1/zones/{zone}/clusters/{cluster_id}/endpoints
PUT
/redis/v1/zones/{zone}/clusters/{cluster_id}/endpoints
GET
/redis/v1/zones/{zone}/endpoints/{endpoint_id}
PATCH
/redis/v1/zones/{zone}/endpoints/{endpoint_id}
DELETE
/redis/v1/zones/{zone}/endpoints/{endpoint_id}
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway