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

Connecting to an Instance Using a Public Domain Name

A public domain name is a domain name used to access websites or web applications on the Internet.

You can use Domain Name Service (DNS) to translate common domain names (for example, www.example.com) into IP addresses (for example, 1.2.3.4) required for network connection. In this way, you can access GeminiDB Redis instances using the resolved IP addresses.

This section uses the Linux OS as an example to describe how to use the public network domain name configured by the DNS service to connect to a GeminiDB Redis instance.

Prerequisites

Procedure

  1. Configure the private domain name for the GeminiDB Redis instance. For details, see Configuring a Public Domain Name.
  2. Log in to the ECS. For details, see Logging In to an ECS in Getting Started with Elastic Cloud Server.
  3. 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.

  4. Decompress the client tool package.

    tar -xzf redis-6.2.0.tar.gz

  5. Open the src directory and connect to the DB instance.

    cd redis-6.2.0

    make

    cd src

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

    Example:

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

    Table 1 Parameter description

    Parameter

    Description

    <DB_Domain_Name>

    The public domain name of the instance to be connected. The public domain name is the one created in 1.

    <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>

    Administrator password set when you buy a GeminiDB Redis instance

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

    Domain_Name:port>