Updated on 2023-11-21 GMT+08:00

Connecting to an Instance Using a Private IP Address

You can use the private IP address to connect to the GeminiDB Redis instance.

This section uses the Linux OS as an example to describe how to connect to a GeminiDB Redis instance using the Redis-cli client.

Precautions

  • The instances must be in the same VPC and subnet as the ECS.
  • The ECS must be in a security group that has access to the instances. For details, see Configuring Security Group Rules.

Prerequisites

An ECS has been created. The following uses a Linux ECS as an example. For details, see Purchasing an ECS in Getting Started with Elastic Cloud Server.

Procedure

  1. Log in to the ECS. For details, see Logging In to an ECS in Getting Started with Elastic Cloud Server.
  2. Obtain the Redis client.

    Method 1

    Run the following command to download the Redis client.

    wget http://download.redis.io/releases/redis-5.0.7.tar.gz

    Method 2

    Download the Redis client installation package and upload it to the ECS.

  3. Decompress the client tool package.

    tar -xzf redis-5.0.7.tar.gz

  4. Connect to the DB instance in the src directory.

    cd redis-5.0.7

    make

    cd src

    ./redis-cli -h <DB_HOST> -p <DB_PORT> -a <DB_PWD>

    Example:

    ./redis-cli -h 192.xx.xx.xx -p 8635 -a <DB_PWD>

    Table 1 Parameter description

    Parameter

    Description

    <DB_HOST>

    The private IP address of the instance to be connected.

    To obtain this IP address, go to the Instance Management page and click the target DB instance name. The IP address can be found in the Private IP Address field under Node Information on the Basic Information page.

    If the instance you purchased has multiple nodes, select the private IP address of any node.

    <DB_PORT>

    Port for accessing the target instance. Configure this parameter based on service requirements.

    To obtain the instance port number, perform the following steps:

    Click the target instance to go to the Basic Information page. In the Network Information area, you can find the database port.

    <DB_PWD>

    Specifies the administrator password set when you buy a GeminiDB Redis instance.

  5. Check the results. If the following information is displayed, the connection is successful.

    IP:port>