A private domain name is a domain name that takes effect in a VPC. Domain Name Service (DNS) associates private domain names with private IP addresses and translates domain name for Huawei Cloud services within a VPC. For more information about private domain names, see Private Domain Name.
You can use DNS to translate a common domain name (for example, example.com) into a private IP address (for example, 192.168.1.1), which is used to access the GeminiDB Redis instance.
This section uses Linux as an example to describe how to connect to a GeminiDB Redis instance using the private domain name configured by DNS.
Usage Notes
- The target instance and ECS must be in the same VPC and subnet.
- The instance security group must allow access from the ECS.
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.
Procedure
Configuring a Private Domain Name of the GeminiDB Redis Instance
Creating a Private Domain Name
- Log in to the DNS console.
- On the displayed page, click Private Zones.
Figure 1 Private zones
- Click Create Private Zone.
Figure 2 Creating a private zone
- Set parameters as prompted.
Figure 3 Create Private Zone
Table 1 Parameter description
|
Parameter |
Description |
Example Value |
|
Domain Name |
Domain name of a private zone
You can enter a top-level domain that complies with the domain naming rules.
For details about the domain name format, see Domain Name Format and DNS Hierarchy. |
example.com |
|
Region |
Region where a tenant is located |
CN East-Shanghai1 |
|
VPC |
The VPC associated with the private domain name must be the same as the VPC where the GeminiDB Redis instance is located. Otherwise, the private domain name cannot be resolved. |
- |
|
Enterprise Project |
Enterprise project associated with the private domain name. You can manage private 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 the following special characters: _.:/=+-@
|
example_key1
example_value1 |
|
Description |
(Optional) Description of the zone, which cannot exceed 255 characters |
This is a zone example. |
- Click OK. On the Private Zones page, view the created private domain name in the zone list.
If the status of the private domain name is
Normal, the domain name has been successfully created.
Figure 4 Private domain name status
Adding a Record Set for a Domain Name
After creating a private domain name, configure a record set for it so that you can access instances using the domain name.
- Click the private domain name you created. On the displayed page, click Add Record Set in the upper right corner.
Figure 5 Adding a record set
- In the displayed Add Record Set dialog box, set parameters as prompted.
Value: Enter the load balancer IP address.
Figure 6 Adding a record set
For details about how to configure parameters, see Adding Record Sets for a Private 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
- 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 6379 -a <DB_PWD>
Table 2 Parameter description
|
Parameter |
Description |
|
<DB_Domain_Name> |
Private domain name of the instance to be connected. The private domain name is the one created in Configuring a Private 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>
Other Methods for Connecting to an Instance over a Private Network