Skip to main content

Create a Redis Data Source

Add a Redis data source to NineData. You can then use it for Database DevOps, backup and restore, data replication, database comparison, and other supported features. This guide covers Redis deployment architecture, connection mode, credentials, environment settings, SSL settings, and the connection test.

Before you begin

  • The server IP address of NineData has been added to the data source allowlist. The server IP address can be viewed by selecting the target region in Access Region on the Create Datasource page.

    server_ip_address

  • Make sure you have available data source quota; otherwise, the data source cannot be added. You can quickly check your remaining quota at the top-right corner of the NineData console.check_quota

Procedure

  1. Log in to the NineData Console.

  2. On the left navigation pane, click Datasource > Datasource.

  3. Click Datasource tab, and click Create Datasource on the page. In the popup window for selecting the data source type, choose Database > (the type of data source to be added), and configure the parameters based on the table below on the Create Datasource page.
    tip

    If you make a mistake during the operation, you can click the arrow_down icon at the top of the Create Datasource page to make a new selection.

  1. Configure the data source parameters:

    Parameter
    Description
    NameEnter a data source name. Use a meaningful name so you can find and manage it later.
    ConnectionSelect how NineData connects to the data source. Supported methods are IP Address, Gateway, and SSH Tunnel.
    • IP Address: Connect through a public network address.
    • Gateway (Sentinel and Cluster Mode are not currently supported): Use a NineData gateway for private-network access. Connect the host that runs the data source first. For instructions, see Add Gateway.
    • SSH Tunnel (Sentinel and Cluster Mode are not currently supported): Connect through an SSH tunnel.
    Architecture TypeSelect the Redis deployment type.
    • Standalone: Single-node deployment.
    • Sentinel: A high-availability architecture based on primary-replica replication. Sentinel mode includes multiple Redis instances and sentinel processes. If the primary node goes down, Redis Sentinel promotes one replica node as the new primary node.
    • Cluster Mode: Data is distributed across multiple cluster nodes. Redis Cluster handles data sharding and migration between nodes, and each node processes part of the data.
    Configuration items when Connection is IP Address
    • Standalone
      • Host: Enter the public network address and port of the data source.
    • Sentinel
      • Master Name: Enter the master node name defined by the master-name parameter in the Sentinel configuration.
      • Sentinels: Enter the address and port of the sentinel process. Sentinel monitors the primary and replica nodes and handles failover when required. Click Add to add multiple sentinel nodes.
    • Cluster Mode: Enter the address and port of all Redis nodes in the cluster. Click Add to add multiple Redis nodes. Add all nodes here. Missing nodes may cause some cluster-related operations to fail.
    Configuration items when Connection is Gateway
    • Gateway: Select the NineData gateway installed on the host where the data source is located.
    • Host: Enter localhost if the data source is on the same host as the gateway, or enter the internal IP address of the host where the data source is located.
    Configuration items when Connection is SSH Tunnel
    • SSH Host: Enter the public IP address or domain name and SSH port of the server where the target data source is located. The default SSH port is 22.
    • SSH Authentication Method: Select the SSH authentication method.
      • Password: Connect with SSH Username and Password.
        • SSH Username: Enter the login username of the server where the target data source is located.
        • Password: Enter the login password of the server where the target data source is located.
      • Key (recommended): Connect with SSH Username and Key File.
        • SSH Username: Enter the login username of the server where the target data source is located.
        • Key File: Click Upload to upload the private key file, which is a key file without a suffix. If you have not created one, see Generate SSH Tunnel Key File.
        • Password: Enter the password set when the key file was generated. If no password was set during key generation, leave this field blank.
    • Note: After configuring SSH, click Connection Test to test the tunnel. Possible results:
      • Connection Successfully: The SSH tunnel is established.
      • Error message: The connection failed. Troubleshoot the cause based on the error message and try again.
    • Host: Enter localhost if the data source is on the same host as the SSH server, or enter the internal IP address of the host where the data source is located.
    DB AccountThe username of the data source. Some older versions of cloud vendors may have authentication issues. If the account and password are correct but authentication still fails, leave this item blank and enter the account name and password in the format of <username>@<password> or <username>:<password> in DB Password. Different cloud vendors use different formats. For example: example_user@abcdefg or example_user:abcdefg.
    DB PasswordThe password of the data source.
    Access RegionSelect the region closest to your data source location to effectively reduce network latency.
    EnvironmentChoose based on the business purpose of the data source, as an environmental identifier of the data source. Default provides PROD and DEV environments, and supports you to create a custom environment.
    Note: Under the organization mode, the database environment can also be applied to permission policy management. For example, the default Prod Admin role only supports access to data sources in the PROD environment and cannot access data sources in other environments. For more information, see Manage Roles.
    SSLChoose whether to use SSL encryption to access the data source (default: off). If the data source requires SSL-encrypted connections, enable this option; otherwise, the connection fails.
    Use the switch to enable or disable encrypted transmission. Click the > to the left of Encryption to expand detailed configuration.
    • SSL Options: Supports the following two methods.
      • If Available: Detect the server SSL status automatically. If SSL is enabled, NineData connects through SSL first. If SSL is not enabled, NineData uses a non-SSL connection.
      • Require: Always use SSL to connect to the data source. If the server does not support this method or cannot establish an SSL connection for other reasons, the connection fails.
    • Verify Server Certificate (SSL CA): If the server uses a certificate issued by a self-signed CA, upload the root certificate of this CA.
    • Authenticate Client: If the server requires a client certificate, upload the client certificate and key. The server verifies the uploaded information to secure the connection.
    For more SSL configuration methods, see the official documentation: Configure Redis Encrypted Connection.
  2. After you configure all parameters, click Connection Test next to Create Datasource to test connectivity. When Connection Successfully is displayed, click Create Datasource to create the data source. Otherwise, review the connection settings and run the test again.

Result

After the connection test succeeds and you create the data source, it appears in the data source list. You can use it in NineData features that support Redis.

Appendix: Add NineData IP addresses to the Redis database whitelist

When you add a data source located in On-Premise/Other Cloud, add the NineData service IP address to the database whitelist so NineData can access the database.

All versions of Redis can add IP whitelists in the following ways.

  1. Open the Redis configuration file redis.conf with a text editor. This file is usually located at: /etc/redis/redis.conf.

  2. Find the bind parameter and set its value to the IP addresses or address ranges that are allowed to access Redis. Separate multiple IP addresses or address ranges with spaces or commas (,).

    Example:

    bind 121.199.39.25 123.57.58.208
  3. Find the protected-mode parameter and configure its value to no to allow external connections to access Redis.

    Example:

    protected-mode no
  4. Save the configuration file.