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.
Usage Notes
Redis Cluster GeminiDB Redis instances do not support this function.
Procedure
Configuring a Public Domain Name of the GeminiDB Redis Instance
Domain Name Not Created on Huawei Cloud
If a third-party domain name is used, create a public zone and add record sets to it on the DNS console.
- Log in to the Huawei Cloud console.
- Click Service List and choose Network > Domain Name Service.
- In the navigation pane, choose Public Zones.
Figure 1 Public zones
- In the upper right corner of the page, click Create Public Zone.
- Set the parameters as prompted.
Figure 2 Creating a public zone
Table 1 Public zone parameters
Parameter |
Description |
Example Value |
Domain Name |
Domain name you have registered.
It can include two levels in addition to the top-level domain, for example:
- abc.example.com, the subdomain name of example.com
- abc.example.com.cn, the subdomain name of example.com.cn
For details about the domain name format, see Domain Name Format and DNS Hierarchy. |
example.com |
Enterprise Project |
Enterprise project associated with the public domain name. You can manage public domain names by enterprise project.
NOTE:
This parameter is available and mandatory only when Account Type is set to Enterprise Account.
Configuration notes:
- If you do not manage domain names by enterprise project, select default.
- If you manage domain names by enterprise project, select an existing enterprise project.
|
default |
Tag |
(Optional) Identifier of a resource. Each tag contains a key and a value. You can add a maximum of 20 tags to a domain name.
Key and value naming rules:
Key:
- Cannot be left blank.
- Must be unique for each resource.
- Can contain a maximum of 128 characters.
- Can contain letters, digits, spaces, and special characters _.:=+-@ but cannot start or end with a space or start with _sys_.
Value:
- Can contain a maximum of 255 characters.
- Can contain letters, digits, spaces, and special characters _.:=+-@ but cannot start or end with a space.
|
example_key1
example_value1 |
Description |
(Optional) Description of the zone, which cannot exceed 255 characters |
This is a zone example. |
- Click OK.
After the domain name is created, you can view it in the domain name list on the Public Zones page.
Adding a Record Set for a Domain Name
After creating a public domain name, configure a record set for it so that you can access instances using the domain name.
- Click the name of the public domain name you created. On the displayed page, click Add Record Set in the upper right corner.
Figure 3 Adding a record set
- In the displayed Add Record Set dialog box, set parameters as prompted.
Figure 4 Adding a record set
For details about how to configure parameters, see Adding Record Sets for a Public Zone.
- Click OK.
- Switch back to the Record Sets page.
- View the created record set in the record set list. If the status of the record set is Normal, the record set is added successfully.
Logging In to an ECS and Connecting an Instance to the Redis Client
- Log in to the ECS. For details, see Logging In to an ECS in Getting Started with Elastic Cloud Server.
- 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.
- Decompress the client package.
tar -xzf redis-6.2.0.tar.gz
- Connect to the instance in the src directory.
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 6379 -a <DB_PWD>
Table 2 Parameter description
Parameter |
Description |
<DB_Domain_Name> |
Public domain name of the instance to be connected. The public domain name is the one created in Configuring a Public Domain Name of the GeminiDB Redis Instance. |
<DB_PORT> |
Port for accessing the target instance. Configure this parameter based on service requirements.
To obtain the port number, perform the following steps:
Click the instance name to go to the Basic Information page. In the Connection Information area, you can see the instance port. |
<DB_PWD> |
Administrator password set when you buy a GeminiDB Redis instance |
- Check the results. If the following information is displayed, the connection is successful.
Domain_Name:port>