Updated on 2024-10-30 GMT+08:00

Connecting to an Instance Using a Load Balancer Address (Recommended)

This section describes how to connect to a GeminiDB Redis instance using a load balancer address on a Linux ECS. Load balancing can improve data reliability and eliminate POFs.

Precautions

  • The target instance 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.

    Scenario 1: If the instance is associated with the default security group, you do not need to configure security group rules.

    Scenario 2: If the instance is not associated with the default security group, check whether the security group rules allow the ECS to connect to the instance.

Prerequisites

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-6.2.0.tar.gz

    Method 2

    Download the Redis client from the address provided in Prerequisites and upload the Redis client installation package to the ECS.

  3. Decompress the client tool package.

    tar -xzf redis-6.2.0.tar.gz

  4. Connect to the instance in the src directory.

    cd redis-6.2.0

    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>

    Load balancer IP address of the instance to be connected.

    After the load balancer IP address is created, click the instance name to go to the Basic Information page and obtain the load balancer IP address in the Connection Information area.

    <DB_PORT>

    Access port corresponding to the load balancer IP address of the instance.

    The procedure is as follows:

    Click the name of the instance to go to the Basic Information page. In the Connection Information area, you can find the access port in field Database Port.

    <DB_PWD>

    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>