127
GaussDB NoSQL Getting Started Issue 09 Date 2020-10-30 HUAWEI TECHNOLOGIES CO., LTD.

Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started

Issue 09

Date 2020-10-30

HUAWEI TECHNOLOGIES CO., LTD.

Page 2: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. i

Copyright © Huawei Technologies Co., Ltd. 2020. All rights reserved.

No part of this document may be reproduced or transmitted in any form or by any means without prior

written consent of Huawei Technologies Co., Ltd.

Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.

All other trademarks and trade names mentioned in this document are the property of their respective

holders.

Notice

The purchased products, services and features are stipulated by the contract made between Huawei and

the customer. All or part of the products, services and features described in this document may not be

within the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,

information, and recommendations in this document are provided "AS IS" without warranties, guarantees or

representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in the

preparation of this document to ensure accuracy of the contents, but all statements, information, and

recommendations in this document do not constitute a warranty of any kind, express or implied.

Huawei Technologies Co., Ltd.

Address: Huawei Industrial Base

Bantian, Longgang

Shenzhen 518129

People's Republic of China

Website: https://e.huawei.com

Page 3: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started Contents

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. ii

Contents

1 Logging In to the GaussDB NoSQL Console...................................................................... 1

2 Getting Started with GaussDB(for Cassandra) .................................................................. 2

2.1 Instance Connection Methods .............................................................................................................................................. 2

2.2 Connecting to a GaussDB(for Cassandra) Instance Through DAS ................................................................................... 3

2.2.1 Step 1: Buy a GaussDB(for Cassandra) Instance ............................................................................................................ 3

2.2.2 Step 2: Connect to a GaussDB(for Cassandra) Instance Through DAS ........................................................................ 9

2.3 Connecting to a GaussDB(for Cassandra) Instance Over Private Networks .................................................................. 10

2.3.1 Step 1: Buy a GaussDB(for Cassandra) Instance .......................................................................................................... 10

2.3.2 Step 2: Configure Security Group Rules ........................................................................................................................ 16

2.3.3 Step 3: Connect to a GaussDB(for Cassandra) Instance Over Private Networks........................................................ 19

2.4 Connecting to a GaussDB(for Cassandra) Instance Over Public Networks ................................................................... 24

2.4.1 Step 1: Buy a GaussDB(for Cassandra) Instance .......................................................................................................... 24

2.4.2 Step 2: Bind an EIP.......................................................................................................................................................... 30

2.4.3 Step 3: Configure Security Group Rules ........................................................................................................................ 32

2.4.4 Step 4: Connect to a GaussDB(for Cassandra) Instance Over Public Networks ......................................................... 34

3 Getting Started with GaussDB(for Mongo) ...................................................................... 40

3.1 Instance Connection Methods ............................................................................................................................................ 40

3.2 Connecting to a Cluster Instance Over Private Networks ................................................................................................ 41

3.2.1 Step 1: Buy a GaussDB(for Mongo) Cluster Instance .................................................................................................. 41

3.2.2 Step 2: Configure Security Group Rules ........................................................................................................................ 47

3.2.3 Step 3: Connect to a GaussDB(for Mongo) Cluster Instance Over Private Networks................................................ 49

3.3 Connecting to a Replica Set Instance Over Private Networks ......................................................................................... 51

3.3.1 Step 1: Buy a GaussDB(for Mongo) Replica Set Instance ........................................................................................... 51

3.3.2 Step 2: Configure Security Group Rules ........................................................................................................................ 57

3.3.3 Step 3: Connect to a GaussDB(for Mongo) Replica Set Instance Over Private Networks......................................... 59

3.4 Connecting to a Cluster Instance Over Public Networks ................................................................................................. 60

3.4.1 Step 1: Buy a GaussDB(for Mongo) Cluster Instance .................................................................................................. 60

3.4.2 Step 2: Bind an EIP.......................................................................................................................................................... 67

3.4.3 Step 3: Configure Security Group Rules ........................................................................................................................ 69

3.4.4 Step 4: Connect to a GaussDB(for Mongo) Cluster Instance Over Public Networks ................................................. 71

3.5 Connecting to a Replica Set Instance Over Public Networks .......................................................................................... 76

3.5.1 Step 1: Buy a GaussDB(for Mongo) Replica Set Instance ........................................................................................... 76

Page 4: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started Contents

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. iii

3.5.2 Step 2: Bind an EIP.......................................................................................................................................................... 82

3.5.3 Step 3: Configure Security Group Rules ........................................................................................................................ 84

3.5.4 Step 4: Connect to a GaussDB(for Mongo) Replica Set Instance Over Public Networks .......................................... 86

4 Getting Started with GaussDB(for Influx)........................................................................ 92

4.1 Instance Connection Methods ............................................................................................................................................ 92

4.2 Connecting to a GaussDB(for Influx) Instance Over Private Networks ......................................................................... 93

4.2.1 Step 1: Buy a GaussDB(for Influx) Instance ................................................................................................................. 93

4.2.2 Step 2: Configure Security Group Rules ........................................................................................................................ 98

4.2.3 Step 3: Connect to a GaussDB(for Influx) Instance Over Private Networks.............................................................100

4.3 Connecting to a GaussDB(for Influx) Instance Over Public Networks ........................................................................102

4.3.1 Step 1: Buy a GaussDB(for Influx) Instance ...............................................................................................................102

4.3.2 Step 2: Bind an EIP........................................................................................................................................................107

4.3.3 Step 3: Configure Security Group Rules ......................................................................................................................109

4.3.4 Step 4: Connect to a GaussDB(for Influx) Instance Over Public Networks .............................................................. 111

5 Getting Started with GaussDB(for Redis) ...................................................................... 113

5.1 Connecting to a GaussDB(for Redis) Instance Over Private Networks ........................................................................ 113

5.1.1 Step 1: Buy a GaussDB(for Redis) Instance ................................................................................................................ 113

5.1.2 Step 2: Connect to a GaussDB(for Redis) Instance Over Private Networks ............................................................. 119

A Change History ................................................................................................................. 122

Page 5: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 1 Logging In to the GaussDB NoSQL Console

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 1

1 Logging In to the GaussDB NoSQL Console

Prerequisites

You have registered a cloud account for logging in to the GaussDB NoSQL management

console.

If you do not have a cloud account, register an account at the official website. After the

registration, your account has permissions to access GaussDB NoSQL, as well as all other

cloud services.

Procedure

Step 1 Open HUAWEI CLOUD official website

Step 2 Click Console on the upper right of the page. The HUAWEI CLOUD management console

login page is displayed.

Step 3 Enter account information as prompted and click Log In.

The login is successful.

Step 4 Click in the upper left corner and select a region and a project.

Step 5 In the service list, choose Database > GaussDB NoSQL.

----End

Page 6: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 2

2 Getting Started with GaussDB(for Cassandra)

2.1 Instance Connection Methods GaussDB(for Cassandra) can be accessed through Data Admin Service (DAS), private

networks, and public networks.

By default, you have the permissions required for remote login. It is recommended that you

use the DAS service to connect to DB instances. DAS is secure and convenient. For details,

see Step 2: Connect to a GaussDB(for Cassandra) Instance Through DAS.

Table 2-1 Connection methods

Method IP Address Scenario Description

DAS Not required DAS provides a GUI that allows

you to perform operations using

a convenient console. SQL

execution, advanced database

management, and intelligent

O&M are all available to make

database management simple,

secure, and intelligent.

Easy to use, secure,

advanced, and

intelligent

Recommended

Private

network

Private IP

address

A private IP address is provided

by default.

If your applications are

deployed on ECS and located

in the same region, AZ, and

VPC subnet as the DB

instance, you are advised to

use a private IP address to

connect to the DB instance.

By default, GaussDB(for

Cassandra) cannot be

accessed through ECSs that

are not in the same security

group. If the ECS is not in

the same group, you need to

High security and good

performance

Page 7: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 3

Method IP Address Scenario Description

add an inbound rule to the

GaussDB(for Cassandra)

security group to enable

access.

The default GaussDB(for

Cassandra) port is 8635, but

this port can be modified if

necessary.

Public

network

EIP If your applications are

running on an ECS that is in

a different region from the

one where the GaussDB(for

Cassandra) instance is

located, you are advised to

use an EIP to connect the

ECS to your GaussDB(for

Cassandra) instances.

If your applications are

deployed on another cloud

platform, EIP is

recommended.

Low security

For faster

transmission and

improved security,

you are advised to

migrate your

applications to an

ECS that is in the

same subnet as your

GaussDB(for

Cassandra) instance

and use a private IP

address to access

the instance.

2.2 Connecting to a GaussDB(for Cassandra) Instance Through DAS

2.2.1 Step 1: Buy a GaussDB(for Cassandra) Instance

This section describes how to buy a DB instance that is compatible with Cassandra APIs.

By default, each tenant can have up to 50 GaussDB(for Cassandra) instances. To apply for a

higher quota, see Quota Management.

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Logging In to the GaussDB NoSQL Console

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications, and click

Next.

Page 8: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 4

Figure 2-1 Billing mode and basic information

Table 2-2 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use.

Yearly/Monthly

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based

on the service price.

− If you will no longer use the instance for a long time after

it expires, you can change the billing mode from

yearly/monthly to pay-per-use. For details, see Changing

the Billing Mode from Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the

system deducts the fees incurred from your account based

on the service duration.

− If you want to use a DB instance at a low cost for a long

period of time, you can change its billing mode from

pay-per-use to yearly/monthly. For details, see Changing

the Billing Mode from Pay-per-Use to Yearly/Monthly.

Table 2-3 Basic information

Parameter Description

Region The region where the tenant is located.

Page 9: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 5

Parameter Description

NOTICE

Select the region nearest where you will be accessing the DB from so latency can be kept to a minimum and response time will be faster. Also, products deployed in different regions cannot communicate with each other through a private network and you cannot change the region of an instance after buying the instance.

DB Instance Name The name can be the same as an existing instance name and have

4 to 64 characters. It must start with a letter and can contain only

uppercase letters, lowercase letters, numbers, hyphens (-), and

underscores (_).

After the DB instance is created, you can change its name. For

details, see Changing a DB Instance Name.

Compatible API Cassandra

DB Instance Type Cluster

DB Engine Version 3.11

CPU Type x86

The x86-based CPU architecture uses Complex Instruction Set

Computing (CISC). Each instruction can be used to execute

low-level hardware operations. The number of instructions is

large, and the length of each instruction is different. Executing

these instructions is complex and time-consuming.

Kunpeng

The Kunpeng-based CPU architecture uses Reduced

Instruction Set Computing (RISC). RISC is a microprocessor

that executes fewer types of computer instructions than CISC

but at a higher speed. RISC simplifies computer architecture

and improves running speed. Compared with x86-based CPU

architecture, Kunpeng-based CPU architecture has a more

balanced performance and power consumption ratio.

Kunpeng-based CPU architecture features high density, low

power consumption, and high cost-effectiveness for

heavy-workload services.

AZ An AZ is a part of a region with its own independent power

supplies and networks. AZs are physically isolated but can

communicate through an internal network connection.

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one

AZ.

If you want to deploy an instance across AZs for disaster

recovery, select three AZs. In this deployment mode, the

nodes are evenly distributed in the three AZs.

If you need to deploy an instance in three AZs, choose Service

Tickets > Create Service Ticket in the upper right corner of the

management console and submit the application.

Page 10: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 6

Figure 2-2 Specifications and storage

Table 2-4 Specifications and storage

Parameter Description

Instance Specifications The CPU and memory of a DB instance.

Different performance specifications support different numbers

of connections and maximum IOPSs. Select CPU and memory

specifications based on your service requirements.

After a DB instance is created, you can change its CPU and

memory. For details, see Changing a DB Instance Class.

Nodes The number of nodes ranges from 3 to 12. Select the number of

nodes based on the site requirements.

After a DB instance is created, you can add nodes. For details,

see Adding Nodes.

Storage Space Storage space depends on the instance specifications. The

minimum storage space is 100 GB, and the storage space you set

must be an integer. You can select a minimum of 1 GB at a time.

After a DB instance is created, you can scale up its storage

space. For details, see Scaling Up Storage Space.

Page 11: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 7

Figure 2-3 Network and database configuration

Table 2-5 Network

Parameter Description

VPC The virtual network where your DB instances are located. A

VPC isolates networks for different services. You can select an

existing VPC or create a VPC.

If no VPC is available, the system creates one for you by default.

For details on how to create a subnet, see the "Creating a VPC"

section in the Virtual Private Cloud User Guide.

NOTE

After the GaussDB(for Cassandra) instance is created, the VPC where the instance resides cannot be changed.

If you want to connect to a GaussDB(for Cassandra) instance through an ECS over an internal network, the GaussDB(for Cassandra) instance and the ECS must be in the same VPC. If they are not in the same VPC, you can create a VPC peering connection to enable access.

Subnet A subnet provides dedicated network resources that are logically

isolated from other networks for network security.

Security Group A security group controls access between GaussDB NoSQL

instances and other services. When you select a security group,

you must ensure that it allows the client to access DB instances.

If there are no security groups available, the system allocates

resources to you by default.

SSL Secure Sockets Layer (SSL) certificates set up encrypted

connections between clients and servers, preventing data from

being tampered with or stolen during transmission.

You can enable SSL to improve data security. After a DB

instance is created, you can connect to it using SSL.

Page 12: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 8

Table 2-6 Database configuration

Parameter Description

Administrator The default administrator account is rwuser.

Administrator

Password

Set a password for the administrator. The password:

Must be 8 to 32 characters long.

Must be a combination of uppercase letters, lowercase letters,

numbers, and the following special characters:

~!@#%^*-_=+?

For security reasons, you must select a strong password. The

system will verify the password strength.

Keep this password secure. If you lose it, the system cannot

retrieve it.

Confirm Password Enter the administrator password again.

Parameter Template A parameter template contains engine configuration values that

can be applied to one or more instances.

After a DB instance is created, you can modify parameters to

better meet your service requirements. For details, see Modifying

a Parameter Template.

Enterprise Project This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and

grouping of cloud resources and users. The default project is

default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management

User Guide.

Table 2-7 Tags

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each DB instance can have up to 20

tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key

can include up to 36 characters, including numbers, letters,

underscores (_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), periods (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the

Tags tab. In addition, you can add, modify, and delete tags for

existing instances. For details, see Tag.

Page 13: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 9

Table 2-8 Required duration

Parameter Description

Required

Duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 On the Instance Management page, you can view and manage your DB instances.

Creating a DB instance takes about 5 to 9 minutes. During the process, the instance

status displayed in the DB instance list is Creating.

After the creation is complete, the status changes to Available.

You can click in the upper right corner of the page to refresh the DB instance

statuses.

During creation, an automated backup policy is enabled by default. A full backup is

automatically triggered after a DB instance is created.

----End

2.2.2 Step 2: Connect to a GaussDB(for Cassandra) Instance Through DAS

Scenarios

DAS enables you to manage DB instances from a web-based console, simplifying database

management and improving efficiency. You can connect and manage instances through DAS.

By default, you have the permissions required for remote login. It is recommended that you

use the DAS service to log in to DB instances. DAS is secure and convenient.

Page 14: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 10

Procedure

Step 1 On the Instance Management page, locate the target DB instance and click Log In in the

Operation column.

Figure 2-4 Logging in to the database

Alternatively, click the target DB instance on the Instance Management page. On the

displayed Basic Information page, click Log In in the upper right corner of the page.

Figure 2-5 Logging in to the database

Step 2 On the displayed login page, enter the administrator username and password and click Log

In.

For details about how to manage databases through DAS, see GaussDB(for Cassandra) Data

Management.

----End

2.3 Connecting to a GaussDB(for Cassandra) Instance Over Private Networks

2.3.1 Step 1: Buy a GaussDB(for Cassandra) Instance

This section describes how to buy a DB instance that is compatible with Cassandra APIs.

By default, each tenant can have up to 50 GaussDB(for Cassandra) instances. To apply for a

higher quota, see Quota Management.

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Log in to the GaussDB NoSQL console.

Page 15: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 11

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications, and click

Next.

Figure 2-6 Billing mode and basic information

Table 2-9 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use.

Yearly/Monthly

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based

on the service price.

− If you will no longer use the instance for a long time after

it expires, you can change the billing mode from

yearly/monthly to pay-per-use. For details, see Changing

the Billing Mode from Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the

system deducts the fees incurred from your account based

on the service duration.

− If you want to use a DB instance at a low cost for a long

period of time, you can change its billing mode from

pay-per-use to yearly/monthly. For details, see Changing

the Billing Mode from Pay-per-Use to Yearly/Monthly.

Page 16: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 12

Table 2-10 Basic information

Parameter Description

Region The region where the tenant is located.

NOTICE

Select the region nearest where you will be accessing the DB from so latency can be kept to a minimum and response time will be faster. Also, products deployed in different regions cannot communicate with each other through a private network and you cannot change the region of an instance after buying the instance.

DB Instance Name The name can be the same as an existing instance name and have

4 to 64 characters. It must start with a letter and can contain only

uppercase letters, lowercase letters, numbers, hyphens (-), and

underscores (_).

After the DB instance is created, you can change its name. For

details, see Modifying the DB Instance Name.

Compatible API Cassandra

DB Instance Type Cluster

DB Engine Version 3.11

CPU Type x86

The x86-based CPU architecture uses Complex Instruction Set

Computing (CISC). Each instruction can be used to execute

low-level hardware operations. The number of instructions is

large, and the length of each instruction is different. Executing

these instructions is complex and time-consuming.

Kunpeng

The Kunpeng-based CPU architecture uses Reduced

Instruction Set Computing (RISC). RISC is a microprocessor

that executes fewer types of computer instructions than CISC

but at a higher speed. RISC simplifies computer architecture

and improves running speed. Compared with x86-based CPU

architecture, Kunpeng-based CPU architecture has a more

balanced performance and power consumption ratio.

Kunpeng-based CPU architecture features high density, low

power consumption, and high cost-effectiveness for

heavy-workload services.

AZ An AZ is a part of a region with its own independent power

supplies and networks. AZs are physically isolated but can

communicate through an internal network connection.

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one

AZ.

If you want to deploy an instance across AZs for disaster

recovery, select three AZs. In this deployment mode, the

nodes are evenly distributed in the three AZs.

If you need to deploy an instance in three AZs, choose Service

Tickets > Create Service Ticket in the upper right corner of the

Page 17: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 13

Parameter Description

management console and submit the application.

Figure 2-7 Specifications and storage

Table 2-11 Specifications and storage

Parameter Description

Instance Specifications The CPU and memory of a DB instance.

Different performance specifications support different numbers

of connections and maximum IOPSs. Select CPU and memory

specifications based on your service requirements.

After a DB instance is created, you can change its CPU and

memory. For details, see Changing a DB Instance Class.

Nodes The number of nodes ranges from 3 to 12. Select the number of

nodes based on the site requirements.

After a DB instance is created, you can add nodes. For details,

see Adding Nodes.

Storage Space Storage space depends on the instance specifications. The

minimum storage space is 100 GB, and the storage space you set

must be an integer. You can select a minimum of 1 GB at a time.

After a DB instance is created, you can scale up its storage

space. For details, see Scaling Up Storage Space.

Page 18: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 14

Figure 2-8 Network and database configuration

Table 2-12 Network

Parameter Description

VPC The virtual network where your DB instances are located. A

VPC isolates networks for different services. You can select an

existing VPC or create a VPC.

If no VPC is available, the system creates one for you by default.

For details on how to create a subnet, see the "Creating a VPC"

section in the Virtual Private Cloud User Guide.

NOTE

After the GaussDB(for Cassandra) instance is created, the VPC where the instance resides cannot be changed.

If you want to connect to a GaussDB(for Cassandra) instance through an ECS over an internal network, the GaussDB(for Cassandra) instance and the ECS must be in the same VPC. If they are not in the same VPC, you can create a VPC peering connection to enable access.

Subnet A subnet provides dedicated network resources that are logically

isolated from other networks for network security.

Security Group A security group controls access between GaussDB NoSQL

instances and other services. When you select a security group,

you must ensure that it allows the client to access DB instances.

If there are no security groups available, the system allocates

resources to you by default.

SSL Secure Sockets Layer (SSL) certificates set up encrypted

connections between clients and servers, preventing data from

being tampered with or stolen during transmission.

You can enable SSL to improve data security. After a DB

instance is created, you can connect to it using SSL.

Page 19: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 15

Table 2-13 Database configuration

Parameter Description

Administrator The default administrator account is rwuser.

Administrator

Password

Set a password for the administrator. The password:

Must be 8 to 32 characters long.

Must be a combination of uppercase letters, lowercase letters,

numbers, and the following special characters:

~!@#%^*-_=+?

For security reasons, you must select a strong password. The

system will verify the password strength.

Keep this password secure. If you lose it, the system cannot

retrieve it.

Confirm Password Enter the administrator password again.

Parameter Template A parameter template contains engine configuration values that

can be applied to one or more instances.

After a DB instance is created, you can modify parameters to

better meet your service requirements. For details, see Modifying

a Parameter Template.

Enterprise Project This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and

grouping of cloud resources and users. The default project is

default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management

User Guide.

Table 2-14 Tags

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each DB instance can have up to 20

tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key

can include up to 36 characters, including numbers, letters,

underscores (_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), periods (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the

Tags tab. In addition, you can add, modify, and delete tags for

existing instances. For details, see Tag.

Page 20: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 16

Table 2-15 Required duration

Parameter Description

Required

Duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 On the Instance Management page, you can view and manage your DB instances.

Creating a DB instance takes about 5 to 9 minutes. During the process, the instance

status displayed in the DB instance list is Creating.

After the creation is complete, the status changes to Available.

You can click in the upper right corner of the page to refresh the DB instance

statuses.

During creation, an automated backup policy is enabled by default. A full backup is

automatically triggered after a DB instance is created.

----End

2.3.2 Step 2: Configure Security Group Rules

Scenarios

The following describes how to set security groups.

If the ECS and DB instance are in the same security group, they can communicate with

each other by default. No security group rule needs to be configured. Go to Step 3:

Connect to a GaussDB(for Cassandra) Instance Over Private Networks.

If the ECS and DB instance are in different security groups, you need to configure

security group rules for them, separately.

Page 21: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 17

Precautions The default security group rule allows all outgoing data packets. ECSs and GaussDB

NoSQL instances in the same security group can access each other. After a security

group is created, you can create different rules for that security group, which allows you

to control access to the GaussDB NoSQL instances that in it.

By default, you can create up to 500 security group rules. However, too many rules

increase network latency for initial access, so it is recommended that you add no more

than 50 rules for each security group.

To access the GaussDB NoSQL instances in a security group from a source outside of

that group, you need to create an inbound rule.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner and select a region and a project.

Step 3 Click Service List. Under Network, click Virtual Private Cloud.

Step 4 In the navigation pane on the left, choose Access Control > Security Groups.

Step 5 On the Security Groups page, click the security group name.

Step 6 On the Inbound Rules tab, click Add Rule. In the displayed Add Inbound Rule dialog box,

set required parameters to add inbound rules. On the Outbound Rules tab, click Add Rule.

In the displayed Add Outbound Rule dialog box, set required parameters to add outbound

rules.

Figure 2-9 Add Inbound Rule

Page 22: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 18

Figure 2-10 Add Outbound Rule

Step 7 In the displayed dialog box, set required parameters.

Table 2-16 Parameter description

Parameter Description Value Example

Protocol The network protocol required for access. You can allow

all protocols or specify a specific protocol, TCP, UDP,

ICMP, and SSH.

TCP

Port Specifies the port that allows the access to ECSs or

external devices.

8635

Source/Desti

nation

Specifies the supported IP address and security group that

the rule applies to.

IP address: The IP address or subnet that the rule

applies to. Single IP addresses must be expressed using

slash notation.

− Single IP address: xxx.xxx.xxx.xxx/32 (IPv4)

− Subnet: xxx.xxx.xxx.0/24

− All IP addresses: 0.0.0.0/0

Security Group: A security group that access will be

allowed from. ECSs in this security group will be

granted access to GaussDB NoSQL the instance in the

current security group

192.168.1

0.0/24

default

Step 8 Click OK.

----End

Page 23: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 19

2.3.3 Step 3: Connect to a GaussDB(for Cassandra) Instance Over Private Networks

Scenarios

This section uses the Linux operating system as an example to describe how to connect an

ECS to a GaussDB(for Cassandra) instance over private networks.

You can use a common connection or establish a secure connection with SSL if necessary.

Constraints The DB instances must be in the same VPC subnet as the ECS.

The ECS must be allowed in a security group that has access to the DB instances.

− If the security group that the target DB instance belongs to is the default security

group, you do not need to configure security group rules.

− If the security group that the target DB instance belongs to is not the default

security group, check whether the security group rules allow the ECS to connect to

the DB instance. For details, see section Step 2: Configure Security Group Rules.

If the security group rules allow the access from the ECS, the ECS can connect to

the DB instance.

If the security group rule does not allow the access from the ECS, you need to add

an inbound rule to the security group.

The default port of the GaussDB(for Cassandra) instance is 8635.

Prerequisites Create an ECS running Linux. For details, see the section Purchasing an ECS in the

Getting Started with Elastic Cloud Server.

The DB instances must be in the same VPC subnet as the ECS.

Download different client installation packages based on the instance CPU type. For x86,

click here. For Kunpeng, click here.

To establish an SSL connection, you need to download the SSL certificate.

Using the Cassandra Client Tool to Connect to a DB Instance (Non-SSL Mode)

Step 1 Log in to the ECS. For details, see the section Logging In to an ECS in the Getting Started

with Elastic Cloud Server.

Step 2 Upload the Cassandra client installation package to ECS.

Step 3 Obtain the client tool cqlsh.

Step 4 Connect to the DB instance in the directory where the cqlsh tool is located.

cqlsh <DB_HOST> <DB_PORT> -u <DB_USER>

Example:

Page 24: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 20

cqlsh 192.168.1.8 8635 -u rwuser

DB_HOST indicates the private IP address of the node to be connected. Obtain the value from the

Private IP Address column in the node list on the Basic Information page.

DB_PORT: indicates the port number. The default value is 8635 and cannot be changed.

DB_USER indicates the database account name. The default value is rwuser.

Step 5 Check the connection result. If the following information is displayed, the connection is

successful.

rwuser@cqlsh>

----End

Using the Cassandra Client Tool to Connect to a DB Instance (SSL Mode)

Step 1 Log in to the ECS. For details, see the section Logging In to an ECS in the Getting Started

with Elastic Cloud Server.

Step 2 Upload the Cassandra client installation package to ECS.

Step 3 Upload the SSL certificate to the ECS.

Step 4 Obtain the client tool cqlsh.

Step 5 Connect to the DB instance in the directory where the cqlsh tool is located.

export SSL_CERTFILE=/<PATH_OF_SSL_CERT_FILE>

export SSL_VERSION=TLSv1_2

cqlsh <DB_HOST> <DB_PORT> -u <DB_USER>

Example:

cqlsh 192.168.1.8 8635 --ssl -u rwuser

PATH_OF_SSL_CERT_FILE is the SSL file path.

DB_HOST indicates the private IP address of the node to be connected. Obtain the value from the Private IP Address column in the node list on the Basic Information page.

DB_PORT: indicates the port number. The default value is 8635 and cannot be changed.

DB_USER indicates the database account name. The default value is rwuser.

Step 6 If the following information is displayed, the connection is successful.

rwuser@cqlsh>

----End

Follow-up Operations

After logging in to the GaussDB(for Cassandra) instance, you can perform the following

operations:

Run the HELP command to view all supported commands.

Page 25: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 21

Figure 2-11 Viewing all supported commands

HELP <COMMAND>: This command queries the usage of a command. Example:

HELP DESC

Keyspace syntax

− Create a keyspace. Example:

CREATE KEYSPACE IF NOT EXISTS nosql WITH replication = {'class':

'SimpleStrategy', 'replication_factor': '3'};

Set the keyspace name to nosql, replication to SimpleStrategy, and number of

replicas to 3.

− DESC <keyspace_name>: This command verifies the creation result.

Figure 2-12 Verifying the result

− use <keyspace_name>: This command switches to the keyspace you created.

Figure 2-13 Switching the keyspace

− DROP KEYSPACE <keyspace_name>: This command deletes the keyspace you

created.

Page 26: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 22

Figure 2-14 Deleting the keyspace

Table syntax

− Create a table. Example:

CREATE TABLE nosql_table(user_id int, age int, user_name text, PRIMARY

KEY(user_id));

The table name is nosql_table, and the following three columns are defined:

user_id, age, and user_name. user_id is of the int type and indicates the user ID.

age is of the int type and indicates the age of a user. user_name is of the text type

and indicates the user name. The primary key is user_id.

− DESC <table_name>: This command verifies the creation result.

Figure 2-15 Verifying the result

− Insert data into the table. Example:

INSERT INTO nosql_table (user_id, age, user_name) VALUES (1, 10, 'user1');

INSERT INTO nosql_table (user_id, age, user_name) VALUES (2, 20, 'user2');

INSERT INTO nosql_table (user_id, age, user_name) VALUES (3, 30, 'user3');

− SELECT * FROM <table_name>: This command queries table data.

Page 27: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 23

Figure 2-16 Querying data

− Add a column to the table. Example

ALTER TABLE nosql_table ADD gender text;

− Insert data to the added column. Example:

UPDATE nosql.nosql_table SET gender = 'male' WHERE user_id = 1;

UPDATE nosql.nosql_table SET gender = 'male' WHERE user_id = 2;

UPDATE nosql.nosql_table SET gender = 'female' WHERE user_id = 3;

Figure 2-17 Viewing the results

− Delete data in a keyspace. Example:

Delete the age data of the user whose ID is 1.

DELETE age FROM nosql.nosql_table WHERE user_id=1;

Figure 2-18 Deleting data

Delete the entire record of the user whose ID is 2.

DELETE FROM nosql.nosql_table WHERE user_id=2;

Page 28: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 24

Figure 2-19 Deleting a record

− Clear all records in the table. Example:

TRUNCATE nosql.nosql_table;

Figure 2-20 Deleting all records

− Delete the entire table. Example:

DROP TABLE nosql.nosql_table;

Figure 2-21 Deleting the table

2.4 Connecting to a GaussDB(for Cassandra) Instance Over Public Networks

2.4.1 Step 1: Buy a GaussDB(for Cassandra) Instance

This section describes how to buy a DB instance that is compatible with Cassandra APIs.

By default, each tenant can have up to 50 GaussDB(for Cassandra) instances. To apply for a

higher quota, see Quota Management.

Page 29: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 25

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Log in to the GaussDB NoSQL console.

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications, and click

Next.

Figure 2-22 Billing mode and basic information

Table 2-17 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use.

Yearly/Monthly

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based

on the service price.

− If you will no longer use the instance for a long time after

it expires, you can change the billing mode from

yearly/monthly to pay-per-use. For details, see Changing

the Billing Mode from Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the

system deducts the fees incurred from your account based

on the service duration.

Page 30: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 26

Parameter Description

− If you want to use a DB instance at a low cost for a long

period of time, you can change its billing mode from

pay-per-use to yearly/monthly. For details, see Changing

the Billing Mode from Pay-per-Use to Yearly/Monthly.

Table 2-18 Basic information

Parameter Description

Region The region where the tenant is located.

NOTICE

Select the region nearest where you will be accessing the DB from so latency can be kept to a minimum and response time will be faster. Also, products deployed in different regions cannot communicate with each other through a private network and you cannot change the region of an instance after buying the instance.

DB Instance Name The name can be the same as an existing instance name and have

4 to 64 characters. It must start with a letter and can contain only

uppercase letters, lowercase letters, numbers, hyphens (-), and

underscores (_).

After the DB instance is created, you can change its name. For

details, see Modifying the DB Instance Name.

Compatible API Cassandra

DB Instance Type Cluster

DB Engine Version 3.11

CPU Type x86

The x86-based CPU architecture uses Complex Instruction Set

Computing (CISC). Each instruction can be used to execute

low-level hardware operations. The number of instructions is

large, and the length of each instruction is different. Executing

these instructions is complex and time-consuming.

Kunpeng

The Kunpeng-based CPU architecture uses Reduced

Instruction Set Computing (RISC). RISC is a microprocessor

that executes fewer types of computer instructions than CISC

but at a higher speed. RISC simplifies computer architecture

and improves running speed. Compared with x86-based CPU

architecture, Kunpeng-based CPU architecture has a more

balanced performance and power consumption ratio.

Kunpeng-based CPU architecture features high density, low

power consumption, and high cost-effectiveness for

heavy-workload services.

AZ An AZ is a part of a region with its own independent power

supplies and networks. AZs are physically isolated but can

communicate through an internal network connection.

Page 31: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 27

Parameter Description

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one

AZ.

If you want to deploy an instance across AZs for disaster

recovery, select three AZs. In this deployment mode, the

nodes are evenly distributed in the three AZs.

If you need to deploy an instance in three AZs, choose Service

Tickets > Create Service Ticket in the upper right corner of the

management console and submit the application.

Figure 2-23 Specifications and storage

Table 2-19 Specifications and storage

Parameter Description

Instance Specifications The CPU and memory of a DB instance.

Different performance specifications support different numbers

of connections and maximum IOPSs. Select CPU and memory

specifications based on your service requirements.

After a DB instance is created, you can change its CPU and

memory. For details, see Changing a DB Instance Class.

Nodes The number of nodes ranges from 3 to 12. Select the number of

nodes based on the site requirements.

After a DB instance is created, you can add nodes. For details,

see Adding Nodes.

Storage Space Storage space depends on the instance specifications. The

minimum storage space is 100 GB, and the storage space you set

must be an integer. You can select a minimum of 1 GB at a time.

After a DB instance is created, you can scale up its storage

space. For details, see Scaling Up Storage Space.

Page 32: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 28

Figure 2-24 Network and database configuration

Table 2-20 Network

Parameter Description

VPC The virtual network where your DB instances are located. A

VPC isolates networks for different services. You can select an

existing VPC or create a VPC.

If no VPC is available, the system creates one for you by default.

For details on how to create a subnet, see the "Creating a VPC"

section in the Virtual Private Cloud User Guide.

NOTE

After the GaussDB(for Cassandra) instance is created, the VPC where the instance resides cannot be changed.

If you want to connect to a GaussDB(for Cassandra) instance through an ECS over an internal network, the GaussDB(for Cassandra) instance and the ECS must be in the same VPC. If they are not in the same VPC, you can create a VPC peering connection to enable access.

Subnet A subnet provides dedicated network resources that are logically

isolated from other networks for network security.

Security Group A security group controls access between GaussDB NoSQL

instances and other services. When you select a security group,

you must ensure that it allows the client to access DB instances.

If there are no security groups available, the system allocates

resources to you by default.

SSL Secure Sockets Layer (SSL) certificates set up encrypted

connections between clients and servers, preventing data from

being tampered with or stolen during transmission.

You can enable SSL to improve data security. After a DB

instance is created, you can connect to it using SSL.

Page 33: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 29

Table 2-21 Database configuration

Parameter Description

Administrator The default administrator account is rwuser.

Administrator

Password

Set a password for the administrator. The password:

Must be 8 to 32 characters long.

Must be a combination of uppercase letters, lowercase letters,

numbers, and the following special characters:

~!@#%^*-_=+?

For security reasons, you must select a strong password. The

system will verify the password strength.

Keep this password secure. If you lose it, the system cannot

retrieve it.

Confirm Password Enter the administrator password again.

Parameter Template A parameter template contains engine configuration values that

can be applied to one or more instances.

After a DB instance is created, you can modify parameters to

better meet your service requirements. For details, see Modifying

a Parameter Template.

Enterprise Project This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and

grouping of cloud resources and users. The default project is

default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management

User Guide.

Table 2-22 Tags

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each DB instance can have up to 20

tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key

can include up to 36 characters, including numbers, letters,

underscores (_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), periods (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the

Tags tab. In addition, you can add, modify, and delete tags for

existing instances. For details, see Tag.

Page 34: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 30

Table 2-23 Required duration

Parameter Description

Required

Duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 On the Instance Management page, you can view and manage your DB instances.

Creating a DB instance takes about 5 to 9 minutes. During the process, the instance

status displayed in the DB instance list is Creating.

After the creation is complete, the status changes to Available.

You can click in the upper right corner of the page to refresh the DB instance

statuses.

During creation, an automated backup policy is enabled by default. A full backup is

automatically triggered after a DB instance is created.

----End

2.4.2 Step 2: Bind an EIP

Scenarios

After you create a GaussDB(for Cassandra) instance, you can bind an EIP to it to allow

external access. If later you want to prohibit external access, you can also unbind the EIP from

the DB instance.

Page 35: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 31

Precautions Before accessing a database, you need to apply for an EIP on the VPC console. Then,

add an inbound rule to allow the IP addresses or IP address ranges of ECSs. For details,

see section Step 3: Configure Security Group Rules.

To change the EIP that has been bound to a node, you need to unbind it from the node

first.

Binding an EIP

Step 1 On the Instance Management page, click the target GaussDB(for Cassandra) instance.

Step 2 On the Basic Information page, in the Node Information area, locate the target node and

click Bind EIP in the Operation column.

Figure 2-25 Binding an EIP

Step 3 In the displayed dialog box, all available unbound EIPs are listed. Select the required EIP and

click OK. If no available EIPs are displayed, click View EIP and create an EIP on the VPC

console.

Figure 2-26 Selecting an EIP

Step 4 In the EIP column, view the EIP that is successfully bound.

Page 36: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 32

To unbind the EIP from the DB instance, see Unbinding an EIP.

----End

Unbinding an EIP

Step 1 On the Instance Management page, click the target GaussDB(for Cassandra) instance.

Step 2 On the Basic Information page, in the Node Information area, locate the target node and

click Unbind EIP in the Operation column.

Figure 2-27 Unbinding an EIP

Step 3 In the displayed dialog box, click Yes.

To bind an EIP to the DB instance again, see Binding an EIP.

----End

2.4.3 Step 3: Configure Security Group Rules

Scenarios

This section describes how to create a security group to enable specific IP addresses and ports

to access GaussDB NoSQL instances.

Precautions

The default security group rule allows all outgoing data packets. ECSs and GaussDB NoSQL

instances in the same security group can access each other. After a security group is created,

you can create different rules for that security group, which allows you to control access to the

GaussDB NoSQL instances that in it.

By default, you can create up to 500 security group rules. However, too many rules increase

network latency for initial access, so it is recommended that you add no more than 50 rules

for each security group.

To access the GaussDB NoSQL instances in a security group from a source outside of that

group, you need to create an inbound rule.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner and select a region and a project.

Step 3 Click Service List. Under Network, click Virtual Private Cloud.

Page 37: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 33

Step 4 In the navigation pane on the left, choose Access Control > Security Groups.

Step 5 On the Security Groups page, click the security group name.

Step 6 On the Inbound Rules tab, click Add Rule. In the displayed Add Inbound Rule dialog box,

set required parameters to add inbound rules. On the Outbound Rules tab, click Add Rule.

In the displayed Add Outbound Rule dialog box, set required parameters to add outbound

rules.

Figure 2-28 Add Inbound Rule

Figure 2-29 Add Outbound Rule

Step 7 In the displayed dialog box, set required parameters.

Table 2-24 Parameter description

Parameter

Description Value Example

Protocol The network protocol required for access. You can allow all TCP

Page 38: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 34

Parameter

Description Value Example

protocols or specify a specific protocol, TCP, UDP, ICMP,

and SSH.

Port Specifies the port that allows the access to ECSs or external

devices.

8635

Source/D

estination

Specifies the supported IP address and security group that the

rule applies to.

IP address: The IP address or subnet that the rule applies

to. Single IP addresses must be expressed using slash

notation.

− Single IP address: xxx.xxx.xxx.xxx/32 (IPv4)

− Subnet: xxx.xxx.xxx.0/24

− All IP addresses: 0.0.0.0/0

Security Group: A security group that access will be

allowed from. ECSs in this security group will be granted

access to GaussDB NoSQL the instance in the current

security group

192.168.1

0.0/24

default

Step 8 Click OK.

----End

2.4.4 Step 4: Connect to a GaussDB(for Cassandra) Instance Over Public Networks

Scenarios

You can use an ECS or local device to connect to a GaussDB NoSQL instance over a public

network.

This section describes how to use a Linux ECS to connect to a GaussDB(for Cassandra)

instance over a public network.

You can use a common connection or establish a secure connection with SSL if necessary.

Prerequisites Bind an EIP to the GaussDB(for Cassandra) instance node and set security group rules.

Create an ECS running Linux. For details, see the section Purchasing an ECS in the

Getting Started with Elastic Cloud Server.

Download different client installation packages based on the instance CPU type. For x86,

click here. For Kunpeng, click here.

To establish an SSL connection, you need to download the SSL certificate.

Page 39: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 35

Connecting to a DB Instance Through a Cassandra Client (Non-SSL Mode)

Step 1 Log in to the ECS. For details, see the section Logging In to an ECS in the Getting Started

with Elastic Cloud Server

Step 2 Upload the Cassandra client installation package to ECS.

Step 3 Obtain the client tool cqlsh.

Step 4 Connect to the DB instance in the directory where the cqlsh tool is located.

cqlsh <DB_HOST> <DB_PORT> -u <DB_USER>

Example:

cqlsh 192.168.1.8 8635 -u rwuser

DB_HOST indicates the EIP of the node to be connected. Obtain the value from the EIP column in

the node list on the Basic Information page.

DB_PORT: indicates the port number. The default value is 8635 and cannot be changed.

DB_USER indicates the database account name. The default value is rwuser.

Step 5 If the following information is displayed, the connection is successful.

rwuser@cqlsh>

----End

Using the Cassandra Client Tool to Connect to a DB Instance (SSL Connection)

Step 1 Log in to the ECS. For details, see the section Logging In to an ECS in the Elastic Cloud

Server Getting Started.

Step 2 Upload the Cassandra client installation package to ECS.

Step 3 Upload the SSL certificate to the ECS.

Step 4 Obtain the client tool cqlsh.

Step 5 Connect to the DB instance in the directory where the cqlsh tool is located.

export SSL_CERTFILE=/<PATH_OF_SSL_CERT_FILE>

export SSL_VERSION=TLSv1_2

cqlsh <DB_HOST> <DB_PORT> -u <DB_USER>

Example:

cqlsh 192.168.1.8 8635 --ssl -u rwuser

PATH_OF_SSL_CERT_FILE is the SSL file path.

DB_HOST indicates the EIP of the node to be connected. Obtain the value from the EIP column in the node list on the Basic Information page.

DB_PORT: indicates the port number. The default value is 8635 and cannot be changed.

DB_USER indicates the database account name. The default value is rwuser.

Step 6 If the following information is displayed, the connection is successful.

Page 40: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 36

rwuser@cqlsh>

----End

Follow-up Operations

After logging in to the GaussDB(for Cassandra) instance, you can perform the following

operations:

Run the HELP command to view all supported commands.

Figure 2-30 Viewing all supported commands

HELP <COMMAND>: This command queries the usage of a command. Example:

HELP DESC

Keyspace syntax

− Create a keyspace. Example:

CREATE KEYSPACE IF NOT EXISTS nosql WITH replication = {'class':

'SimpleStrategy', 'replication_factor': '3'};

Set the keyspace name to nosql, replication to SimpleStrategy, and number of

replicas to 3.

− DESC <keyspace_name>: This command verifies the creation result.

Figure 2-31 Verifying the result

− use <keyspace_name>: This command switches to the keyspace you created.

Page 41: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 37

Figure 2-32 Switching the keyspace

− DROP KEYSPACE <keyspace_name>: This command deletes the keyspace you

created.

Figure 2-33 Deleting the keyspace

Table syntax

− Create a table. Example:

CREATE TABLE nosql_table(user_id int, age int, user_name text, PRIMARY

KEY(user_id));

The table name is nosql_table, and the following three columns are defined:

user_id, age, and user_name. user_id is of the int type and indicates the user ID.

age is of the int type and indicates the age of a user. user_name is of the text type

and indicates the user name. The primary key is user_id.

− DESC <table_name>: This command verifies the creation result.

Figure 2-34 Verifying the result

− Insert data into the table. Example:

INSERT INTO nosql_table (user_id, age, user_name) VALUES (1, 10, 'user1');

INSERT INTO nosql_table (user_id, age, user_name) VALUES (2, 20, 'user2');

INSERT INTO nosql_table (user_id, age, user_name) VALUES (3, 30, 'user3');

− SELECT * FROM <table_name>: This command queries table data.

Page 42: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 38

Figure 2-35 Querying data

− Add a column to the table. Example

ALTER TABLE nosql_table ADD gender text;

− Insert data to the added column. Example:

UPDATE nosql.nosql_table SET gender = 'male' WHERE user_id = 1;

UPDATE nosql.nosql_table SET gender = 'male' WHERE user_id = 2;

UPDATE nosql.nosql_table SET gender = 'female' WHERE user_id = 3;

Figure 2-36 Viewing the results

− Delete data in a keyspace. Example:

Delete the age data of the user whose ID is 1.

DELETE age FROM nosql.nosql_table WHERE user_id=1;

Figure 2-37 Deleting data

Delete the entire record of the user whose ID is 2.

DELETE FROM nosql.nosql_table WHERE user_id=2;

Page 43: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 2 Getting Started with GaussDB(for Cassandra)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 39

Figure 2-38 Deleting a record

− Clear all records in the table. Example:

TRUNCATE nosql.nosql_table;

Figure 2-39 Deleting all records

− Delete the entire table. Example:

DROP TABLE nosql.nosql_table;

Figure 2-40 Deleting the table

Page 44: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 40

3 Getting Started with GaussDB(for Mongo)

3.1 Instance Connection Methods GaussDB(for Mongo) supports databases connections over public and private networks.

Table 3-1 Connection methods

Method

IP Address

Scenario Description

Private

network

Private IP

address

A private IP address is provided by

default.

If your applications are deployed on

an ECS and located in the same

region, AZ, and VPC subnet as the

DB instance, you are advised to use a

private IP address to connect to the

DB instance.

By default, GaussDB(for Mongo)

cannot be accessed through ECSs that

are not in the same security group. If

the ECS is not in the same group, you

need to add an inbound rule to the

GaussDB(for Mongo) security group

to enable access.

The default GaussDB(for Mongo) port

is 8635, but this port can be modified

if necessary.

High security and good

performance

Public

network

EIP If your applications are running on an

ECS that is in a different region from

the one where the GaussDB(for

Mongo) instance is located, you are

advised to use an EIP to connect the

ECS to your GaussDB(for Mongo)

instances.

If your applications are deployed on

Low security

For faster

transmission and

improved security,

you are advised to

migrate your

applications to an

ECS that is in the

Page 45: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 41

Method

IP Address

Scenario Description

another cloud platform, EIP is

recommended.

same subnet as

your GaussDB(for

Mongo) instance

and use a private IP

address to access

the instance.

3.2 Connecting to a Cluster Instance Over Private Networks

3.2.1 Step 1: Buy a GaussDB(for Mongo) Cluster Instance

Scenarios

This section describes how to buy a cluster instance that is compatible with MongoDB APIs.

You can customize your cluster instance with appropriate computing capability and storage

space based on service requirements.

By default, each tenant can have up to 50 GaussDB(for Mongo) instances. To apply for a

higher quota, see Quota Management.

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Log in to the GaussDB NoSQL console.

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications and click

Next.

Page 46: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 42

Figure 3-1 Billing mode and basic information

Table 3-2 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use.

Yearly/Monthly

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based on

the service price.

− If you will no longer use the instance for a long time after it

expires, you can change the billing mode from yearly/monthly

to pay-per-use. For details, see Changing the Billing Mode from

Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the system

deducts the fees incurred from your account based on the

service duration.

− If you want to use a DB instance at a low cost for a long period

of time, you can change its billing mode from pay-per-use to

yearly/monthly. For details, see Changing the Billing Mode

from Pay-per-Use to Yearly/Monthly.

Table 3-3 Basic information

Parameter Description

Region The region where the tenant is located.

Page 47: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 43

Parameter Description

NOTE

DB instances in different regions cannot communicate with each other through a private network, and once you buy a DB instance, you cannot change the region of it. Therefore, exercise caution when selecting a region.

DB Instance

Name

The name can be the same as an existing instance name and have 4 to

64 characters. It must start with a letter and can contain only uppercase

letters, lowercase letters, numbers, hyphens (-), and underscores (_).

After the DB instance is created, you can change its name. For details,

see Modifying the DB Instance Name.

Compatible API MongoDB

DB Instance

Type

Cluster

DB Engine

Version

3.4

4.0

CPU Type x86

The x86-based CPU architecture uses Complex Instruction Set

Computing (CISC). Each instruction can be used to execute

low-level hardware operations. The number of instructions is large,

and the length of each instruction is different. Executing these

instructions is complex and time-consuming.

Kunpeng

The Kunpeng-based CPU architecture uses Reduced Instruction Set

Computing (RISC). RISC is a microprocessor that executes fewer

types of computer instructions than CISC but at a higher speed.

RISC simplifies computer architecture and improves running speed.

Compared with x86-based CPU architecture, Kunpeng-based CPU

architecture has a more balanced performance and power

consumption ratio.

Kunpeng-based CPU architecture features high density, low power

consumption, and high cost-effectiveness for heavy-workload

services.

AZ An AZ is a part of a region with its own independent power supplies

and networks. AZs are physically isolated but can communicate

through an internal network connection.

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one AZ.

If you want to deploy an instance across AZs for disaster recovery,

select three AZs. In this deployment mode, the nodes are evenly

distributed in the three AZs.

If you need to deploy an instance in three AZs, choose Service

Tickets > Create Service Ticket in the upper right corner of the

management console and submit the application.

Page 48: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 44

Figure 3-2 Instance class and storage space

Table 3-4 Specifications and storage

Parameter Description

shard Class For details about the CPU and memory of a shard, see DB Instance

Specifications.

Nodes You can store data on shards and connect to them directly.

The number of shard ranges from 2 to 12.

Storage Space The upper limit of the storage space depends on the shard class and

quantity.

NOTE

For details about the maximum storage space of different shard classes, see DB Instance Specifications.

Figure 3-3 Network and database configuration

Table 3-5 Network

Parameter Description

Page 49: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 45

Parameter Description

VPC The VPC to which GaussDB(for Mongo) belongs isolates networks for

different services. It allows user to manage and configure internal

networks and change network configuration, simplifying network

management. You need to create or select the required VPC. For details on

how to create a VPC, see section "Creating a VPC" in the Virtual Private

Cloud User Guide.

If no VPC is available, GaussDB(for Mongo) allocates resources to you by

default.

NOTE

After the GaussDB(for Mongo) instance is created, the VPC where the instance resides cannot be changed.

If you want to connect to an instance through an ECS over an internal network, the instance and the ECS must be in the same VPC. If they are not in the same VPC, you can create a VPC peering connection to enable access.

Subnet A subnet provides dedicated network resources that are logically isolated

from other networks for network security.

Security

Group

A security group controls access between GaussDB(for Mongo) and other

services for security.

If no security group is available, GaussDB(for Mongo) allocates resources

to you by default.

NOTE

Ensure that the security group rule you set allows clients to access DB instances. For example, select the TCP protocol with inbound direction, input the default port number 8635, and enter a subnet IP address or select a security group that the DB instance belongs to.

Table 3-6 Database configuration

Parameter Description

Administrator The default account is rwuser.

Administrator

Password

The password is a string of 8 to 32 characters. It must be a combination

of uppercase letters, lowercase letters, digits, and special characters.

You can also use the following special characters: ~!@#%^*-_=+?

The system cannot save you password. Keep the password secure.

Confirm

Password

The value of this parameter must be the same as the Administrator

Password.

Parameter

Template

A parameter template contains engine configuration values that can be

applied to one or more instances.

After a DB instance is created, you can modify its parameters to better

meet your service requirements. For details, see Modifying a Parameter

Template.

NOTICE

If you use a custom parameter template when creating an instance, the following specification-related parameters in the custom template are not applied to the instance. Instead, the default values are used.

Page 50: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 46

Parameter Description

mongos.net.maxIncomingConnections

shard.net.maxIncomingConnections

Enterprise

Project

This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and grouping

of cloud resources and users. The default project is default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management User

Guide.

Table 3-7 Tags

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each DB instance can have up to 20 tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key can

include up to 36 characters, including numbers, letters, underscores

(_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), dots (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the Tags

tab. In addition, you can add, modify, and delete tags for existing

instances. For details, see Tag.

Table 3-8 Required duration

Parameter Description

Required

Duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Table 3-9 Quantity

Parameter Description

Quantity GaussDB(for Mongo) instances can be created in batches. Up to 50 DB

instances can be created at a time.

Page 51: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 47

DB instance performance is determined by how you configure it during the creation. The hardware configuration items that can be selected include the shard class and storage space.

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 After a DB instance is created, you can view and manage it on the Instance Management

page.

After the creation is complete, the status changes to Available.

----End

3.2.2 Step 2: Configure Security Group Rules

Scenarios

This section describes how to create a security group to enable specific IP addresses and ports

to access GaussDB NoSQL instances.

Precautions

The default security group rule allows all outgoing data packets. ECSs and GaussDB NoSQL

instances in the same security group can access each other. After a security group is created,

you can create different rules for that security group, which allows you to control access to the

GaussDB NoSQL instances that in it.

By default, you can create up to 500 security group rules. However, too many rules increase

network latency for initial access, so it is recommended that you add no more than 50 rules

for each security group.

To access the GaussDB NoSQL instances in a security group from a source outside of that

group, you need to create an inbound rule.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner and select a region and a project.

Step 3 Click Service List. Under Network, click Virtual Private Cloud.

Page 52: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 48

Step 4 In the navigation pane on the left, choose Access Control > Security Groups.

Step 5 On the Security Groups page, click the security group name.

Step 6 On the Inbound Rules tab, click Add Rule. In the displayed Add Inbound Rule dialog box,

set required parameters to add inbound rules. On the Outbound Rules tab, click Add Rule.

In the displayed Add Outbound Rule dialog box, set required parameters to add outbound

rules.

Figure 3-4 Add Inbound Rule

Figure 3-5 Add Outbound Rule

Step 7 In the displayed dialog box, set required parameters.

Table 3-10 Parameter description

Parameter

Description Value Example

Protocol The network protocol required for access. You can allow all TCP

Page 53: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 49

Parameter

Description Value Example

protocols or specify a specific protocol, TCP, UDP, ICMP,

and SSH.

Port Specifies the port that allows the access to ECSs or external

devices.

8635

Source/D

estination

Specifies the supported IP address and security group that the

rule applies to.

IP address: The IP address or subnet that the rule applies

to. Single IP addresses must be expressed using slash

notation.

Example:

− Single IP address: xxx.xxx.xxx.xxx/32 (IPv4)

− Subnet: xxx.xxx.xxx.0/24

− All IP addresses: 0.0.0.0/0

Security Group: A security group that access will be

allowed from. ECSs in this security group will be granted

access to the GaussDB NoSQL instance in the current

security group

192.168.1

0.0/24

default

Step 8 Click OK.

----End

3.2.3 Step 3: Connect to a GaussDB(for Mongo) Cluster Instance Over Private Networks

Scenarios

This section describes how to connect to a GaussDB(for Mongo) cluster instance through an

ECS over private networks.

Different OS scenarios: The following uses Linux ECS and Window client as an example.

Constraints The DB instances must be in the same VPC subnet as the ECS.

The ECS must be allowed in a security group that has access to the DB instances.

− If the security group that the target DB instance belongs to is the default security

group, you do not need to configure security group rules.

− If the security group that the target DB instance belongs to is not the default

security group, check whether the security group rules allow the ECS to connect to

the DB instance. For details, see section Step 2: Configure Security Group Rules.

If the security group rules allow the access from the ECS, the ECS can connect to

the DB instance.

Page 54: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 50

If the security group rule does not allow the access from the ECS, you need to add

an inbound rule to the security group.

The default port of the GaussDB(for Mongo) instance is 8635.

Prerequisites

1. You have created and logged in to an ECS. For details, see Purchasing an ECS and

Logging In to an ECS.

2. You have installed the MongoDB client on the ECS.

For details on how to install a MongoDB client, see How Can I Install a MongoDB

Client?

Procedure

Step 1 Connect to the ECS.

Step 2 Connect to the DB instance in the directory where the MongoDB client is located.

In Linux, for example, run the following command:

./mongo --host <DB_HOST> --port <DB_PORT> -u <DB_USER> -p

--authenticationDatabase admin

Enter the password of the database account as prompted:

Enter password:

DB_HOST indicates the IP address of the remotely connected DB instance. Obtain the value from

the Private IP Address column in the node list on the Basic Information page.

DB_PORT indicates the port number. Obtain the value from Database Port in the Basic Information area on the Basic Information page.

DB_USER indicates the database account name. The default value is rwuser.

Example:

./mongo --host 192.168.141.85 --port 8635 -u rwuser -p --authenticationDatabase admin

Step 3 Check the connection result. If the following information is displayed, the connection is

successful.

mongos>

----End

Page 55: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 51

3.3 Connecting to a Replica Set Instance Over Private Networks

3.3.1 Step 1: Buy a GaussDB(for Mongo) Replica Set Instance

Scenarios

This section describes how to buy a replica set instance that is compatible with MongoDB

APIs. You can customize your replica set instance with appropriate computing capability and

storage space based on service requirements.

By default, each tenant can have up to 50 GaussDB(for Mongo) instances. To apply for a

higher quota, see Quota Management.

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Log in to the GaussDB NoSQL console.

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications and click

Next.

Figure 3-6 Billing mode and basic information

Table 3-11 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use.

Yearly/Monthly

Page 56: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 52

Parameter Description

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based on

the service price.

− If you will no longer use the instance for a long time after it

expires, you can change the billing mode from yearly/monthly

to pay-per-use. For details, see Changing the Billing Mode from

Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the system

deducts the fees incurred from your account based on the

service duration.

− If you want to use a DB instance at a low cost for a long period

of time, you can change its billing mode from pay-per-use to

yearly/monthly. For details, see Changing the Billing Mode

from Pay-per-Use to Yearly/Monthly.

Table 3-12 Basic information

Parameter Description

Region The region where the tenant is located.

NOTICE

Select the region nearest where you will be accessing the DB from so latency can be kept to a minimum and response time will be faster. Also, products deployed in different regions cannot communicate with each other through a private network and you cannot change the region of a DB after creating the instance.

DB Instance Name The name can be the same as an existing instance name and have 4

to 64 characters. It must start with a letter and can contain only

uppercase letters, lowercase letters, numbers, hyphens (-), and

underscores (_).

After the DB instance is created, you can change its name. For

details, see Modifying the DB Instance Name.

Compatible API MongoDB

DB Instance Type Replica set

DB Engine Version 4.0

AZ An AZ is a part of a region with its own independent power

supplies and networks. AZs are physically isolated but can

communicate through an internal network connection.

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one AZ.

Page 57: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 53

Parameter Description

If you want to deploy an instance across AZs for disaster

recovery, select three AZs. In this deployment mode, the nodes

are evenly distributed in the three AZs.

Figure 3-7 Specifications and storage

Table 3-13 Specifications and storage

Parameter Description

Instance

Specifications

The CPU and memory of a DB instance.

Different performance specifications support different numbers of

connections and maximum IOPSs. Select CPU and memory

specifications based on your service requirements.

Storage Space Storage space depends on the instance specifications. The

minimum storage space is 100 GB, and the storage space you set

must be an integer.

Page 58: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 54

Figure 3-8 Network and database configuration

Table 3-14 Network

Parameter Description

VPC The virtual network where your DB instances are located. A VPC

isolates networks for different services. You can select an existing

VPC or create a VPC.

If no VPC is available, the system creates one for you by default.

For details on how to create a subnet, see the "Creating a VPC"

section in the Virtual Private Cloud User Guide.

Subnet A subnet provides dedicated network resources that are logically

isolated from other networks for network security.

Subnets are only valid within a given AZ. You need to enable

DHCP for subnets where you plan to create DB instances and

cannot disable DHCP during instance creation.

Security Group A security group controls access between GaussDB NoSQL

instances and other services. When you select a security group,

you must ensure that it allows the client to access DB instances.

If there are no security groups available, the system allocates

resources to you by default.

Table 3-15 Database configuration

Parameter Description

Administrator The default administrator account is rwuser.

Page 59: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 55

Parameter Description

Administrator

Password

Set a password for the administrator. The password:

Must be 8 to 32 characters long.

Must be a combination of uppercase letters, lowercase letters,

numbers, and the following special characters: ~!@#%^*-_=+?

For security reasons, you must select a strong password. The

system will verify the password strength.

Keep this password secure. If you lose it, the system cannot retrieve

it.

Confirm Password Enter the administrator password again.

Parameter

Template

A parameter template contains engine configuration values that can

be applied to one or more instances.

After a DB instance is created, you can modify its parameters to

better meet your service requirements. For details, see Modifying a

Parameter Template.

NOTICE

If you use a custom parameter template when creating an instance, the following specification-related parameter in the custom template is not applied to the instance. Instead, the default values are used.

replica.net.maxIncomingConnections

Enterprise Project This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and

grouping of cloud resources and users. The default project is

default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management

User Guide.

Table 3-16 Tags

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each DB instance can have up to 20

tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key can

include up to 36 characters, including numbers, letters,

underscores (_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), dots (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the

Tags tab. In addition, you can add, modify, and delete tags for

Page 60: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 56

Parameter Description

existing instances. For details, see Tag.

Table 3-17 Required duration

Parameter Description

Required

Duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Table 3-18 Quantity

Parameter Description

Quantity GaussDB(for Mongo) instances can be created in batches. Up to 50 DB

instances can be created at a time.

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 On the Instance Management page, you can view and manage your DB instances.

Creating a DB instance takes about 5 to 9 minutes. During the process, the instance

status displayed in the DB instance list is Creating.

After the creation is complete, the status changes to Available.

You can click in the upper right corner of the page to refresh the DB instance

statuses.

During creation, an automated backup policy is enabled by default. A full backup is

automatically triggered after a DB instance is created.

----End

Page 61: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 57

3.3.2 Step 2: Configure Security Group Rules

Scenarios

This section describes how to create a security group to enable specific IP addresses and ports

to access GaussDB NoSQL instances.

Precautions

The default security group rule allows all outgoing data packets. ECSs and GaussDB NoSQL

instances in the same security group can access each other. After a security group is created,

you can create different rules for that security group, which allows you to control access to the

GaussDB NoSQL instances that in it.

By default, you can create up to 500 security group rules. However, too many rules increase

network latency for initial access, so it is recommended that you add no more than 50 rules

for each security group.

To access the GaussDB NoSQL instances in a security group from a source outside of that

group, you need to create an inbound rule.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner and select a region and a project.

Step 3 Click Service List. Under Network, click Virtual Private Cloud.

Step 4 In the navigation pane on the left, choose Access Control > Security Groups.

Step 5 On the Security Groups page, click the security group name.

Step 6 On the Inbound Rules tab, click Add Rule. In the displayed Add Inbound Rule dialog box,

set required parameters to add inbound rules. On the Outbound Rules tab, click Add Rule.

In the displayed Add Outbound Rule dialog box, set required parameters to add outbound

rules.

Page 62: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 58

Figure 3-9 Add Inbound Rule

Figure 3-10 Add Outbound Rule

Step 7 In the displayed dialog box, set required parameters.

Table 3-19 Parameter description

Parameter

Description Value Example

Protocol The network protocol required for access. You can allow all

protocols or specify a specific protocol, TCP, UDP, ICMP,

and SSH.

TCP

Port Specifies the port that allows the access to ECSs or external

devices.

8635

Source/D

estination

Specifies the supported IP address and security group that the

rule applies to.

IP address: The IP address or subnet that the rule applies

192.168.1

0.0/24

default

Page 63: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 59

Parameter

Description Value Example

to. Single IP addresses must be expressed using slash

notation.

Example:

− Single IP address: xxx.xxx.xxx.xxx/32 (IPv4)

− Subnet: xxx.xxx.xxx.0/24

− All IP addresses: 0.0.0.0/0

Security Group: A security group that access will be

allowed from. ECSs in this security group will be granted

access to the GaussDB NoSQL instance in the current

security group

Step 8 Click OK.

----End

3.3.3 Step 3: Connect to a GaussDB(for Mongo) Replica Set Instance Over Private Networks

Scenarios

This section describes how to connect to a GaussDB(for Mongo) replica set instance through

an ECS over private networks.

Different OS scenarios: The following uses Linux ECS and Window client as an example.

Constraints The DB instances must be in the same VPC subnet as the ECS.

The ECS must be allowed in a security group that has access to the DB instances.

− If the security group that the target DB instance belongs to is the default security

group, you do not need to configure security group rules.

− If the security group that the target DB instance belongs to is not the default

security group, check whether the security group rules allow the ECS to connect to

the DB instance. For details, see section Step 2: Configure Security Group Rules.

If the security group rules allow the access from the ECS, the ECS can connect to

the DB instance.

If the security group rule does not allow the access from the ECS, you need to add

an inbound rule to the security group.

The default port of the GaussDB(for Mongo) instance is 8635.

Prerequisites

1. You have created and logged in to an ECS. For details, see Purchasing an ECS and

Logging In to an ECS.

2. You have installed the MongoDB client on the ECS.

Page 64: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 60

For details on how to install a MongoDB client, see How Can I Install a MongoDB

Client?

Procedure

Step 1 Connect to the ECS.

Step 2 Connect to the DB instance in the directory where the MongoDB client is located.

In Linux, for example, run the following command:

./mongo

'mongodb://rwuser:****@<DB_HOST1>:<DB_PORT1>,<DB_HOST2>:<DB_PORT2>,

<DB_HOST3><DB_PORT3>/test?authSource=admin&replicaSet=replica'

If a DB instance is connected using a connection address, add single quotation marks ('') before and

after the connection address.

You can click the instance name to obtain the connection information from the Network

Information area on the Basic Information page.

DB_HOST indicates the private IP address of the node in the instance.

DB_PORT indicates the port of the DB instance. The default value is 8635.

**** indicates the password of the database account. If you use the connection address to connect to a DB instance:

If the password contains the percent sign (%), change % to %25.

If the password contains the at sign (@), change @ to %40.

Example:

./mongo

'mongodb://rwuser:****@192.168.0.196:8635,192.168.0.67:8635,192.168.0.32:8635/test?

authSource=admin&replicaSet=replica'

Step 3 Check the connection result. If the following information is displayed, the connection is

successful.

replica:PRIMARY>

----End

3.4 Connecting to a Cluster Instance Over Public Networks

3.4.1 Step 1: Buy a GaussDB(for Mongo) Cluster Instance

Scenarios

This section describes how to buy a cluster instance that is compatible with MongoDB APIs.

You can customize your cluster instance with appropriate computing capability and storage

space based on service requirements.

By default, each tenant can have up to 50 GaussDB(for Mongo) instances. To apply for a

higher quota, see Quota Management.

Page 65: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 61

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Log in to the GaussDB NoSQL console.

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications and click

Next.

Figure 3-11 Billing mode and basic information

Table 3-20 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use.

Yearly/Monthly

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based on

the service price.

− If you will no longer use the instance for a long time after it

expires, you can change the billing mode from yearly/monthly

to pay-per-use. For details, see Changing the Billing Mode from

Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the system

deducts the fees incurred from your account based on the

service duration.

Page 66: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 62

Parameter Description

− If you want to use a DB instance at a low cost for a long period

of time, you can change its billing mode from pay-per-use to

yearly/monthly. For details, see Changing the Billing Mode

from Pay-per-Use to Yearly/Monthly.

Table 3-21 Basic information

Parameter Description

Region The region where the tenant is located.

NOTE

DB instances in different regions cannot communicate with each other through a private network, and once you buy a DB instance, you cannot change the region of it. Therefore, exercise caution when selecting a region.

DB Instance

Name

The name can be the same as an existing instance name and have 4 to

64 characters. It must start with a letter and can contain only uppercase

letters, lowercase letters, numbers, hyphens (-), and underscores (_).

After the DB instance is created, you can change its name. For details,

see Modifying the DB Instance Name.

Compatible API MongoDB

DB Instance

Type

Cluster

DB Engine

Version

3.4

4.0

CPU Type x86

The x86-based CPU architecture uses Complex Instruction Set

Computing (CISC). Each instruction can be used to execute

low-level hardware operations. The number of instructions is large,

and the length of each instruction is different. Executing these

instructions is complex and time-consuming.

Kunpeng

The Kunpeng-based CPU architecture uses Reduced Instruction Set

Computing (RISC). RISC is a microprocessor that executes fewer

types of computer instructions than CISC but at a higher speed.

RISC simplifies computer architecture and improves running speed.

Compared with x86-based CPU architecture, Kunpeng-based CPU

architecture has a more balanced performance and power

consumption ratio.

Kunpeng-based CPU architecture features high density, low power

consumption, and high cost-effectiveness for heavy-workload

services.

AZ An AZ is a part of a region with its own independent power supplies

and networks. AZs are physically isolated but can communicate

through an internal network connection.

Page 67: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 63

Parameter Description

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one AZ.

If you want to deploy an instance across AZs for disaster recovery,

select three AZs. In this deployment mode, the nodes are evenly

distributed in the three AZs.

If you need to deploy an instance in three AZs, choose Service

Tickets > Create Service Ticket in the upper right corner of the

management console and submit the application.

Figure 3-12 Instance class and storage space

Table 3-22 Specifications and storage

Parameter Description

shard Class For details about the CPU and memory of a shard, see DB Instance

Specifications.

Nodes You can store data on shards and connect to them directly.

The number of shard ranges from 2 to 12.

Storage Space The upper limit of the storage space depends on the shard class and

quantity.

NOTE

For details about the maximum storage space of different shard classes, see DB Instance Specifications.

Page 68: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 64

Figure 3-13 Network and database configuration

Table 3-23 Network

Parameter Description

VPC The VPC to which GaussDB(for Mongo) belongs isolates networks for

different services. It allows user to manage and configure internal

networks and change network configuration, simplifying network

management. You need to create or select the required VPC. For details on

how to create a VPC, see section "Creating a VPC" in the Virtual Private

Cloud User Guide.

If no VPC is available, GaussDB(for Mongo) allocates resources to you by

default.

NOTE

After the GaussDB(for Mongo) instance is created, the VPC where the instance resides cannot be changed.

If you want to connect to an instance through an ECS over an internal network, the instance and the ECS must be in the same VPC. If they are not in the same VPC, you can create a VPC peering connection to enable access.

Subnet A subnet provides dedicated network resources that are logically isolated

from other networks for network security.

Security

Group

A security group controls access between GaussDB(for Mongo) and other

services for security.

If no security group is available, GaussDB(for Mongo) allocates resources

to you by default.

NOTE

Ensure that the security group rule you set allows clients to access DB instances. For example, select the TCP protocol with inbound direction, input the default port number 8635, and enter a subnet IP address or select a security group that the DB instance belongs to.

Page 69: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 65

Table 3-24 Database configuration

Parameter Description

Administrator The default account is rwuser.

Administrator

Password

The password is a string of 8 to 32 characters. It must be a combination

of uppercase letters, lowercase letters, digits, and special characters.

You can also use the following special characters: ~!@#%^*-_=+?

The system cannot save you password. Keep the password secure.

Confirm

Password

The value of this parameter must be the same as the Administrator

Password.

Parameter

Template

A parameter template contains engine configuration values that can be

applied to one or more instances.

After a DB instance is created, you can modify its parameters to better

meet your service requirements. For details, see Modifying a Parameter

Template.

NOTICE

If you use a custom parameter template when creating an instance, the following specification-related parameters in the custom template are not applied to the instance. Instead, the default values are used.

mongos.net.maxIncomingConnections

shard.net.maxIncomingConnections

Enterprise

Project

This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and grouping

of cloud resources and users. The default project is default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management User

Guide.

Table 3-25 Tags

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each DB instance can have up to 20 tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key can

include up to 36 characters, including numbers, letters, underscores

(_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), dots (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the Tags

tab. In addition, you can add, modify, and delete tags for existing

instances. For details, see Tag.

Page 70: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 66

Table 3-26 Required duration

Parameter Description

Required

Duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Table 3-27 Quantity

Parameter Description

Quantity GaussDB(for Mongo) instances can be created in batches. Up to 50 DB

instances can be created at a time.

DB instance performance is determined by how you configure it during the creation. The hardware configuration items that can be selected include the shard class and storage space.

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 After a DB instance is created, you can view and manage it on the Instance Management

page.

After the creation is complete, the status changes to Available.

----End

Page 71: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 67

3.4.2 Step 2: Bind an EIP

Scenarios

After you create a GaussDB(for Mongo) instance, you can bind an EIP to it to allow external

access. If later you want to prohibit external access, you can also unbind the EIP from the DB

instance.

Precautions Before accessing a database, you need to apply for an EIP on the VPC console. Then,

add an inbound rule to allow the IP addresses or IP address ranges of ECSs. For details,

see section Step 3: Configure Security Group Rules.

To change the EIP that has been bound to a node, you need to unbind it from the node

first.

Binding an EIP

Step 1 On the Instance Management page, click the target instance.

Step 2 On the Basic Information page, in the Node Information area, locate the target node and

click Bind EIP in the Operation column.

Figure 3-14 Binding an EIP

Step 3 In the displayed dialog box, all available unbound EIPs are listed. Select the required EIP and

click OK. If no available EIPs are displayed, click View EIP and create an EIP on the VPC

console.

Page 72: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 68

Figure 3-15 Selecting an EIP

Step 4 In the EIP column, view the EIP that is successfully bound.

To unbind the EIP from the DB instance, see Unbinding an EIP.

----End

Unbinding an EIP

Step 1 On the Instance Management page, click the target instance.

Step 2 On the Basic Information page, in the Node Information area, locate the target node and

click Unbind EIP in the Operation column.

Figure 3-16 Unbinding an EIP

Step 3 In the displayed dialog box, click Yes.

To bind an EIP to the DB instance again, see Binding an EIP.

----End

Page 73: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 69

3.4.3 Step 3: Configure Security Group Rules

Scenarios

This section describes how to create a security group to enable specific IP addresses and ports

to access GaussDB NoSQL instances.

Precautions

The default security group rule allows all outgoing data packets. ECSs and GaussDB NoSQL

instances in the same security group can access each other. After a security group is created,

you can create different rules for that security group, which allows you to control access to the

GaussDB NoSQL instances that in it.

By default, you can create up to 500 security group rules. However, too many rules increase

network latency for initial access, so it is recommended that you add no more than 50 rules

for each security group.

To access the GaussDB NoSQL instances in a security group from a source outside of that

group, you need to create an inbound rule.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner and select a region and a project.

Step 3 Click Service List. Under Network, click Virtual Private Cloud.

Step 4 In the navigation pane on the left, choose Access Control > Security Groups.

Step 5 On the Security Groups page, click the security group name.

Step 6 On the Inbound Rules tab, click Add Rule. In the displayed Add Inbound Rule dialog box,

set required parameters to add inbound rules. On the Outbound Rules tab, click Add Rule.

In the displayed Add Outbound Rule dialog box, set required parameters to add outbound

rules.

Page 74: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 70

Figure 3-17 Add Inbound Rule

Figure 3-18 Add Outbound Rule

Step 7 In the displayed dialog box, set required parameters.

Table 3-28 Parameter description

Parameter

Description Value Example

Protocol The network protocol required for access. You can allow all

protocols or specify a specific protocol, TCP, UDP, ICMP,

and SSH.

TCP

Port Specifies the port that allows the access to ECSs or external

devices.

8635

Source/D

estination

Specifies the supported IP address and security group that the

rule applies to.

IP address: The IP address or subnet that the rule applies

192.168.1

0.0/24

default

Page 75: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 71

Parameter

Description Value Example

to. Single IP addresses must be expressed using slash

notation.

Example:

− Single IP address: xxx.xxx.xxx.xxx/32 (IPv4)

− Subnet: xxx.xxx.xxx.0/24

− All IP addresses: 0.0.0.0/0

Security Group: A security group that access will be

allowed from. ECSs in this security group will be granted

access to the GaussDB NoSQL instance in the current

security group

Step 8 Click OK.

----End

3.4.4 Step 4: Connect to a GaussDB(for Mongo) Cluster Instance Over Public Networks

Scenarios

This section describes how to connect to a GaussDB(for Mongo) cluster instance using the

MongoDB client and Robo 3T over public networks.

Different OS scenarios: The following uses Linux ECS and Window client as an example.

Prerequisites

1. Bind an EIP to the GaussDB(for Mongo) cluster instance and set security group rules to

ensure that the EIP can be accessed through the ECS or Robo 3T. For details, see Step 2:

Bind an EIP and Step 3: Configure Security Group Rules.

2. Install the MongoDB client or Robo 3T.

MongoDB client

a. You have created and logged in to an ECS. For details, see Purchasing an ECS and

Logging In to an ECS.

b. Install the MongoDB client on the ECS.

For details on how to install a MongoDB client, see How Can I Install a MongoDB

Client?

If you use a connection address to connect to a cluster instance, download the MongoDB client of version later than 4.0.

Robo 3T

Install Robo 3T. For details, see How Can I Install Robo 3T?

Page 76: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 72

Using Robo 3T to Connect to a DB Instance

Step 1 Run the installed Robo 3T. On the displayed dialog box, click Create.

Figure 3-19 Connections

Step 2 In the Connection Settings dialog box, set the parameters of the new connection.

1. On the Connection tab, enter the name of the new connection in the Name text box and

enter the EIP and database port that are bound to the GaussDB(for Mongo) cluster

instance in the Address text box.

Page 77: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 73

Figure 3-20 Connection

2. On the Authentication tab, set Database to admin, User Name to rwuser, and

Password to the administrator password you set during the creation of the cluster

instance.

Figure 3-21 Authentication

3. Click Save.

Page 78: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 74

Step 3 On the MongoDB Connections page, click Connect to connect to the GaussDB(for Mongo)

cluster instance.

Figure 3-22 Connections

Step 4 If the GaussDB(for Mongo) cluster instance is successfully connected, the page shown in

Figure 3-23 is displayed.

Figure 3-23 Connection succeeded

----End

Page 79: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 75

Using MongoDB Client to Connect to the DB Instance

Step 1 Connect to the ECS.

Step 2 Connect to the DB instance in the directory where the MongoDB client is located.

Method 1: Using Linux commands

./mongo --host <DB_HOST> --port <DB_PORT> -u <DB_USER> -p

--authenticationDatabase admin

Enter the password of the database account as prompted:

Enter password:

Example:

./mongo --host 10.154.217.191 --port 8635 -u rwuser -p --authenticationDatabase

admin

Method 2: Connecting to the instance through a public network on the management

console

./mongo

'mongodb://rwuser:****@<DB_HOST>:<DB_PORT>/test?authSource=admin'

DB_HOST indicates the IP address of the remotely connected DB instance. Obtain the value from

the EIP column in the node list on the Basic Information page.

DB_PORT indicates the port number. Obtain the value from Database Port in the Basic

Information area on the Connections page.

DB_USER indicates the database account name. The default value is rwuser.

**** indicates the password of the database account.

If the password contains the percent sign (%), change % to %25.

If the password contains the at sign (@), change @ to %40.

Example:

./mongo 'mongodb://rwuser:****@10.154.217.191/test?authSource=admin '

Single quotation marks are used in the preceding commands to avoid login failures caused by special characters.

Step 3 Check the connection result. If the following information is displayed, the connection is

successful.

mongos>

----End

Page 80: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 76

3.5 Connecting to a Replica Set Instance Over Public Networks

3.5.1 Step 1: Buy a GaussDB(for Mongo) Replica Set Instance

Scenarios

This section describes how to buy a replica set instance that is compatible with MongoDB

APIs. You can customize your replica set instance with appropriate computing capability and

storage space based on service requirements.

By default, each tenant can have up to 50 GaussDB(for Mongo) instances. To apply for a

higher quota, see Quota Management.

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Log in to the GaussDB NoSQL console.

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications and click

Next.

Figure 3-24 Billing mode and basic information

Table 3-29 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use.

Yearly/Monthly

Page 81: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 77

Parameter Description

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based on

the service price.

− If you will no longer use the instance for a long time after it

expires, you can change the billing mode from yearly/monthly

to pay-per-use. For details, see Changing the Billing Mode from

Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the system

deducts the fees incurred from your account based on the

service duration.

− If you want to use a DB instance at a low cost for a long period

of time, you can change its billing mode from pay-per-use to

yearly/monthly. For details, see Changing the Billing Mode

from Pay-per-Use to Yearly/Monthly.

Table 3-30 Basic information

Parameter Description

Region The region where the tenant is located.

NOTICE

Select the region nearest where you will be accessing the DB from so latency can be kept to a minimum and response time will be faster. Also, products deployed in different regions cannot communicate with each other through a private network and you cannot change the region of a DB after creating the instance.

DB Instance Name The name can be the same as an existing instance name and have 4

to 64 characters. It must start with a letter and can contain only

uppercase letters, lowercase letters, numbers, hyphens (-), and

underscores (_).

After the DB instance is created, you can change its name. For

details, see Modifying the DB Instance Name.

Compatible API MongoDB

DB Instance Type Replica set

DB Engine Version 4.0

AZ An AZ is a part of a region with its own independent power

supplies and networks. AZs are physically isolated but can

communicate through an internal network connection.

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one AZ.

Page 82: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 78

Parameter Description

If you want to deploy an instance across AZs for disaster

recovery, select three AZs. In this deployment mode, the nodes

are evenly distributed in the three AZs.

Figure 3-25 Specifications and storage

Table 3-31 Specifications and storage

Parameter Description

Instance

Specifications

The CPU and memory of a DB instance.

Different performance specifications support different numbers of

connections and maximum IOPSs. Select CPU and memory

specifications based on your service requirements.

Storage Space Storage space depends on the instance specifications. The

minimum storage space is 100 GB, and the storage space you set

must be an integer.

Page 83: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 79

Figure 3-26 Network and database configuration

Table 3-32 Network

Parameter Description

VPC The virtual network where your DB instances are located. A VPC

isolates networks for different services. You can select an existing

VPC or create a VPC.

If no VPC is available, the system creates one for you by default.

For details on how to create a subnet, see the "Creating a VPC"

section in the Virtual Private Cloud User Guide.

Subnet A subnet provides dedicated network resources that are logically

isolated from other networks for network security.

Subnets are only valid within a given AZ. You need to enable

DHCP for subnets where you plan to create DB instances and

cannot disable DHCP during instance creation.

Security Group A security group controls access between GaussDB NoSQL

instances and other services. When you select a security group,

you must ensure that it allows the client to access DB instances.

If there are no security groups available, the system allocates

resources to you by default.

Table 3-33 Database configuration

Parameter Description

Administrator The default administrator account is rwuser.

Page 84: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 80

Parameter Description

Administrator

Password

Set a password for the administrator. The password:

Must be 8 to 32 characters long.

Must be a combination of uppercase letters, lowercase letters,

numbers, and the following special characters: ~!@#%^*-_=+?

For security reasons, you must select a strong password. The

system will verify the password strength.

Keep this password secure. If you lose it, the system cannot retrieve

it.

Confirm Password Enter the administrator password again.

Parameter

Template

A parameter template contains engine configuration values that can

be applied to one or more instances.

After a DB instance is created, you can modify its parameters to

better meet your service requirements. For details, see Modifying a

Parameter Template.

NOTICE

If you use a custom parameter template when creating an instance, the following specification-related parameter in the custom template is not applied to the instance. Instead, the default values are used.

replica.net.maxIncomingConnections

Enterprise Project This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and

grouping of cloud resources and users. The default project is

default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management

User Guide.

Table 3-34 Tags

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each DB instance can have up to 20

tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key can

include up to 36 characters, including numbers, letters,

underscores (_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), dots (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the

Tags tab. In addition, you can add, modify, and delete tags for

Page 85: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 81

Parameter Description

existing instances. For details, see Tag.

Table 3-35 Required duration

Parameter Description

Required

Duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Table 3-36 Quantity

Parameter Description

Quantity GaussDB(for Mongo) instances can be created in batches. Up to 50 DB

instances can be created at a time.

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 On the Instance Management page, you can view and manage your DB instances.

Creating a DB instance takes about 5 to 9 minutes. During the process, the instance

status displayed in the DB instance list is Creating.

After the creation is complete, the status changes to Available.

You can click in the upper right corner of the page to refresh the DB instance

statuses.

During creation, an automated backup policy is enabled by default. A full backup is

automatically triggered after a DB instance is created.

----End

Page 86: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 82

3.5.2 Step 2: Bind an EIP

Scenarios

After you create a GaussDB(for Mongo) instance, you can bind an EIP to it to allow external

access. If later you want to prohibit external access, you can also unbind the EIP from the DB

instance.

Precautions Before accessing a database, you need to apply for an EIP on the VPC console. Then,

add an inbound rule to allow the IP addresses or IP address ranges of ECSs. For details,

see section Step 3: Configure Security Group Rules.

To change the EIP that has been bound to a node, you need to unbind it from the node

first.

Binding an EIP

Step 1 On the Instance Management page, click the target instance.

Step 2 On the Basic Information page, in the Node Information area, locate the target node and

click Bind EIP in the Operation column.

Figure 3-27 Binding an EIP

Step 3 In the displayed dialog box, all available unbound EIPs are listed. Select the required EIP and

click OK. If no available EIPs are displayed, click View EIP and create an EIP on the VPC

console.

Page 87: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 83

Figure 3-28 Selecting an EIP

Step 4 In the EIP column, view the EIP that is successfully bound.

To unbind the EIP from the DB instance, see Unbinding an EIP.

----End

Unbinding an EIP

Step 1 On the Instance Management page, click the target instance.

Step 2 On the Basic Information page, in the Node Information area, locate the target node and

click Unbind EIP in the Operation column.

Figure 3-29 Unbinding an EIP

Step 3 In the displayed dialog box, click Yes.

To bind an EIP to the DB instance again, see Binding an EIP.

----End

Page 88: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 84

3.5.3 Step 3: Configure Security Group Rules

Scenarios

This section describes how to create a security group to enable specific IP addresses and ports

to access GaussDB NoSQL instances.

Precautions

The default security group rule allows all outgoing data packets. ECSs and GaussDB NoSQL

instances in the same security group can access each other. After a security group is created,

you can create different rules for that security group, which allows you to control access to the

GaussDB NoSQL instances that in it.

By default, you can create up to 500 security group rules. However, too many rules increase

network latency for initial access, so it is recommended that you add no more than 50 rules

for each security group.

To access the GaussDB NoSQL instances in a security group from a source outside of that

group, you need to create an inbound rule.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner and select a region and a project.

Step 3 Click Service List. Under Network, click Virtual Private Cloud.

Step 4 In the navigation pane on the left, choose Access Control > Security Groups.

Step 5 On the Security Groups page, click the security group name.

Step 6 On the Inbound Rules tab, click Add Rule. In the displayed Add Inbound Rule dialog box,

set required parameters to add inbound rules. On the Outbound Rules tab, click Add Rule.

In the displayed Add Outbound Rule dialog box, set required parameters to add outbound

rules.

Page 89: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 85

Figure 3-30 Add Inbound Rule

Figure 3-31 Add Outbound Rule

Step 7 In the displayed dialog box, set required parameters.

Table 3-37 Parameter description

Parameter

Description Value Example

Protocol The network protocol required for access. You can allow all

protocols or specify a specific protocol, TCP, UDP, ICMP,

and SSH.

TCP

Port Specifies the port that allows the access to ECSs or external

devices.

8635

Source/D

estination

Specifies the supported IP address and security group that the

rule applies to.

IP address: The IP address or subnet that the rule applies

192.168.1

0.0/24

default

Page 90: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 86

Parameter

Description Value Example

to. Single IP addresses must be expressed using slash

notation.

Example:

− Single IP address: xxx.xxx.xxx.xxx/32 (IPv4)

− Subnet: xxx.xxx.xxx.0/24

− All IP addresses: 0.0.0.0/0

Security Group: A security group that access will be

allowed from. ECSs in this security group will be granted

access to the GaussDB NoSQL instance in the current

security group

Step 8 Click OK.

----End

3.5.4 Step 4: Connect to a GaussDB(for Mongo) Replica Set Instance Over Public Networks

Scenarios

This section describes how to connect to a replica set instance using the MongoDB client and

Robo 3T over public networks.

You can directly perform operations on the primary and secondary nodes. Primary nodes are

used for processing read and write requests. Secondary nodes replicate data from the primary

and are used for processing read requests only.

Different OS scenarios: The following uses Linux ECS and Window client as an example.

Prerequisites

1. Bind an EIP to the GaussDB(for Mongo) replica set instance and set security group rules

to ensure that the EIP can be accessed through the ECS or Robo 3T. For details, see Step

2: Bind an EIP and Step 3: Configure Security Group Rules

2. Install the MongoDB client or Robo 3T.

MongoDB client

a. You have created and logged in to an ECS. For details, see Purchasing an ECS and

Logging In to an ECS.

b. Install the MongoDB client on the ECS.

For details on how to install a MongoDB client, see How Can I Install a MongoDB

Client?

Robo 3T

Install Robo 3T. For details, see How Can I Install Robo 3T?

Page 91: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 87

Using Robo 3T to Connect to a DB Instance

Step 1 Run the installed Robo 3T. On the displayed dialog box, click Create.

Figure 3-32 Connections

Step 2 In the Connection Settings dialog box, set the parameters of the new connection.

1. On the Connection tab, enter the name of the new connection in the Name text box and

enter the EIP and database port that are bound to the replica set instance in the Address

text box.

Page 92: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 88

Figure 3-33 Connection

2. On the Authentication tab, set Database to admin, User Name to rwuser, and

Password to the administrator password you set during the creation of the replica set

instance.

Figure 3-34 Authentication

3. Click Save.

Step 3 On the MongoDB Connections page, click Connect to connect to the replica set instance.

Page 93: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 89

Figure 3-35 Connections

Step 4 If the replica set instance is successfully connected, the page shown in Figure 3-36 is

displayed.

Figure 3-36 Connection succeeded

----End

Page 94: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 90

Using MongoDB Client to Connect to the DB Instance

Step 1 Connect to the ECS.

Step 2 Connect to a GaussDB(for Mongo) instance.

Method 1: Using Linux commands

./mongo --host <DB_HOST> --port <DB_PORT> -u <DB_USER> -p

--authenticationDatabase admin

Enter the password of the database account as prompted:

Enter password:

Example:

./mongo --host 192.168.1.6 --port 8635 -u rwuser -p --authenticationDatabase admin

Method 2: Using the public connection address

./mongo

'mongodb://rwuser:****@<DB_HOST>:<DB_PORT>/test?authSource=admin&re

plicaSet=replica'

DB_HOST indicates the IP address of the remotely connected DB instance. Obtain the value from

the EIP column in the node list on the Connections page.

DB_PORT indicates the port number. Obtain the value from Database Port in the Basic

Information area on the Connections page.

DB_USER indicates the database account name. The default value is rwuser.

**** indicates the password of the database account.

If the password contains the percent sign (%), change % to %25.

If the password contains the at sign (@), change @ to %40.

Example:

− Connect to a single node:

./mongo

'mongodb://rwuser:****@10.154.217.180:8635/test?authSource=admin'

− Connect to multiple nodes:

./mongo

'mongodb://rwuser:****@10.154.217.180:8635,10.154.218.160:8635,10.154.217

.191:8635/test?authSource=admin&replicaSet=replica'

Single quotation marks are used in the preceding commands to avoid login failures caused by special characters.

In contrast to directly connecting to the primary node, this connection mode provides

higher data read/write performance and avoids write errors after a primary/standby

switchover. For details, see Connecting to a Replica Set Instance for Read and Write

Separation and High Availability in the Document Database Service Best Practices.

Step 3 Check the connection result. If the following information is displayed, the connection is

successful.

Result from connecting the primary node in a replica set:

replica:PRIMARY>

Result from connecting the secondary node in a replica set:

replica:SECONDARY>

Page 95: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 3 Getting Started with GaussDB(for Mongo)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 91

----End

Page 96: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 92

4 Getting Started with GaussDB(for Influx)

4.1 Instance Connection Methods GaussDB(for Influx) supports database connections through private and public networks.

Table 4-1 Connection methods

Method IP Address Scenario Description

Private

network

Private IP

address

A private IP address is provided

by default.

If your applications are

running on an ECS that is in

the same region, AZ, and

VPC subnet as your

GaussDB(for Influx) instance,

you are advised to use a

private IP address to connect

the ECS to your instance.

By default, GaussDB(for

Influx) is not accessible from

an ECS in a different security

group. You need to add an

inbound rule to the

GaussDB(for Influx) security

group.

The default GaussDB(for

Influx) port is 8635, but this

port can be modified if

necessary.

High security and good

performance

Public

network

EIP If your applications are

running on an ECS that is in a

different region from the one

where the GaussDB(for

Influx) instance is located,

you are advised to use an EIP

to connect the ECS to your

GaussDB(for Influx)

Low security

For faster

transmission and

improved security,

you are advised to

migrate your

applications to an

ECS that is in the

Page 97: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 93

Method IP Address Scenario Description

instances.

If your applications are

deployed on another cloud

platform, EIP is

recommended.

same subnet as your

GaussDB(for

Influx) instance and

use a private IP

address to access

the instance.

4.2 Connecting to a GaussDB(for Influx) Instance Over Private Networks

4.2.1 Step 1: Buy a GaussDB(for Influx) Instance

This section describes how to buy a DB instance that is compatible with InfluxDB APIs.

By default, each tenant can have up to 50 GaussDB(for Influx) instances. To apply for a

higher quota, see Quota Management.

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Log in to the GaussDB NoSQL console.

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications and click

Next.

Figure 4-1 Billing mode and basic information

Page 98: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 94

Table 4-2 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use.

Yearly/Monthly

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based on

the service price.

− If you will no longer use the instance for a long time after it

expires, you can change the billing mode from yearly/monthly

to pay-per-use. For details, see Changing the Billing Mode

from Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the system

deducts the fees incurred from your account based on the

service duration.

− If you want to use a DB instance at a low cost for a long period

of time, you can change its billing mode from pay-per-use to

yearly/monthly. For details, see Changing the Billing Mode

from Pay-per-Use to Yearly/Monthly.

Table 4-3 Basic information

Parameter Description

Region A region where the tenant is located. It can be changed in the upper

left corner.

NOTICE

Select the region nearest where you will be accessing the DB from so latency can be kept to a minimum and response time will be faster. Also, products deployed in different regions cannot communicate with each other through a private network and you cannot change the region of a DB after creating the instance.

DB Instance Name The name can be the same as an existing instance name. It must start

with a letter and consist of 4 to 64 characters. Only letters, numbers,

hyphens (-), and underscores (_) are allowed.

After the DB instance is created, you can change its name. For

details, see Modifying the DB Instance Name.

Compatible API InfluxDB

DB Instance Type Cluster

DB Engine Version 1.7

AZ An AZ is a part of a region with its own independent power supplies

and networks. AZs are physically isolated but can communicate

Page 99: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 95

Parameter Description

through an internal network connection.

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one AZ.

If you want to deploy an instance across AZs for disaster

recovery, select three AZs. In this deployment mode, the nodes

are evenly distributed in the three AZs.

If you need to deploy an instance in three AZs, choose Service

Tickets > Create Service Ticket in the upper right corner of the

management console and submit the application.

Figure 4-2 Specifications and storage

Table 4-4 Specifications and storage

Parameter Description

Instance

Specifications

For details about the DB instance specifications, see DB Instance

Specifications.

Different performance specifications support different numbers of

connections and maximum IOPSs. Select CPU and memory

specifications based on your service requirements.

Nodes The number of nodes depends on the actual environment.

Storage Space The minimum storage space is 100 GB and must be an integer.

You can add a minimum of 1 GB at a time.

Page 100: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 96

Figure 4-3 Network and database configuration

Table 4-5 Network

Parameter Description

VPC The virtual network where your DB instances are located. A VPC

isolates networks for different services. You can select an existing

VPC or create a VPC.

If no VPC is available, the system creates one for you by default.

For details on how to create a subnet, see the "Creating a VPC"

section in the Virtual Private Cloud User Guide.

NOTE

After the GaussDB(for Influx) instance is created, the VPC where the instance resides cannot be changed.

If you want to connect to a GaussDB(for Influx) instance through an ECS over an internal network, the GaussDB(for Influx) instance and the ECS must be in the same VPC. If they are not in the same VPC, you can create a VPC peering connection to enable access.

Subnet A subnet provides dedicated network resources that are logically

isolated from other networks for network security.

Security Group A security group controls access between GaussDB(for Influx)

instances and other services. When you select a security group,

you must ensure that it allows the client to access DB instances.

If there are no security groups available, the system allocates

resources to you by default.

Table 4-6 Database configuration

Parameter Description

Administrator The default administrator account is rwuser.

Administrator Set a password for the administrator. The password:

Page 101: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 97

Parameter Description

Password Must be 8 to 32 characters long.

Must be a combination of uppercase letters, lowercase letters,

numbers, and the following special characters: ~!@#%^*-_=+?

For security reasons, you must select a strong password. The

system will verify the password strength.

Keep this password secure. If you lose it, the system cannot

retrieve it.

Confirm Password Enter the administrator password again.

Enterprise Project This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and

grouping of cloud resources and users. The default project is

default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management

User Guide.

Table 4-7 Tag

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each DB instance can have up to 20 tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key can

include up to 36 characters, including numbers, letters, underscores

(_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), dots (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the Tags

tab. In addition, you can add, modify, and delete tags for existing

instances. For details, see Tag.

Table 4-8 Required duration

Parameter Description

Required

duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Page 102: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 98

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 On the Instance Management page, you can view and manage your DB instances.

After the creation is complete, the status changes to Available.

You can click in the upper right corner of the page to refresh the DB instance

statuses.

After a DB instance is created, the default database port is 8635 and cannot be changed.

----End

4.2.2 Step 2: Configure Security Group Rules

Scenarios

The following describes how to set security groups.

If the ECS and DB instance are in the same security group, they can communicate with

each other by default. No security group rule needs to be configured. Go to Step 3:

Connect to a GaussDB(for Cassandra) Instance Over Private Networks.

If the ECS and DB instance are in different security groups, you need to configure

security group rules for them, separately.

Precautions The default security group rule allows all outgoing data packets. ECSs and GaussDB

NoSQL instances in the same security group can access each other. After a security

group is created, you can create different rules for that security group, which allows you

to control access to the GaussDB NoSQL instances that in it.

By default, you can create up to 500 security group rules. However, too many rules

increase network latency for initial access, so it is recommended that you add no more

than 50 rules for each security group.

To access the GaussDB NoSQL instances in a security group from a source outside of

that group, you need to create an inbound rule.

Procedure

Step 1 Log in to the management console.

Page 103: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 99

Step 2 Click in the upper left corner and select a region and a project.

Step 3 Click Service List. Under Network, click Virtual Private Cloud.

Step 4 In the navigation pane on the left, choose Access Control > Security Groups.

Step 5 On the Security Groups page, click the security group name.

Step 6 On the Inbound Rules tab, click Add Rule. In the displayed Add Inbound Rule dialog box,

set required parameters to add inbound rules. On the Outbound Rules tab, click Add Rule.

In the displayed Add Outbound Rule dialog box, set required parameters to add outbound

rules.

Figure 4-4 Add Inbound Rule

Figure 4-5 Add Outbound Rule

Step 7 In the displayed dialog box, set required parameters.

Page 104: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 100

Table 4-9 Parameter description

Parameter Description Value Example

Protocol The network protocol required for access. You can allow

all protocols or specify a specific protocol, TCP, UDP,

ICMP, and SSH.

TCP

Port Specifies the port that allows the access to ECSs or

external devices.

8635

Source/Desti

nation

Specifies the supported IP address and security group that

the rule applies to.

IP address: The IP address or subnet that the rule

applies to. Single IP addresses must be expressed using

slash notation.

− Single IP address: xxx.xxx.xxx.xxx/32 (IPv4)

− Subnet: xxx.xxx.xxx.0/24

− All IP addresses: 0.0.0.0/0

Security Group: A security group that access will be

allowed from. ECSs in this security group will be

granted access to GaussDB NoSQL the instance in the

current security group

192.168.1

0.0/24

default

Step 8 Click OK.

----End

4.2.3 Step 3: Connect to a GaussDB(for Influx) Instance Over Private Networks

Scenarios

This section uses the Linux operating system as an example to describe how to connect an

ECS to a GaussDB(for Influx) instance over private networks.

Constraints The DB instances must be in the same VPC subnet as the ECS.

The ECS must be allowed in a security group that has access to the DB instances.

− If the security group that the target DB instance belongs to is the default security

group, you do not need to configure security group rules.

− If the security group that the target DB instance belongs to is not the default

security group, check whether the security group rules allow the ECS to connect to

the DB instance. For details, see section Step 2: Configure Security Group Rules.

If the security group rules allow the access from the ECS, the ECS can connect to

the DB instance.

If the security group rule does not allow the access from the ECS, you need to add

an inbound rule to the security group.

Page 105: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 101

The default port of the GaussDB(for Influx) instance is 8635 and cannot be changed.

Prerequisites Create an ECS running Linux. For details, see the section Purchasing an ECS in the

Getting Started with Elastic Cloud Server.

The DB instances must be in the same VPC subnet as the ECS.

Download the InfluxDB client. The following uses the Linux 64-bit client as an example.

Procedure

Step 1 Log in to the ECS. For details, see the section Logging In to an ECS in the Elastic Cloud

Server Getting Started.

Step 2 Upload the InfluxDB client installation package to ECS.

Step 3 Decompress the client tool package.

tar -xzf influxdb-1.7.9-static_linux_amd64.tar.gz

Step 4 Connect to the DB instance in the directory where the influx tool is located.

1. Run the following command to go to the InfluxDB directory:

cd influxdb-1.7.9-1

2. Run the following command to connect to the InfluxDB shell:

./influx -ssl -unsafeSsl -host <DB_HOST> -port <DB_PORT>

Example:

./influx -ssl -unsafeSsl -host 192.168.1.201 -port 8635

3. Run the following command for authentication:

auth

Enter the user name and password as prompted. The prompted information is similar as

follows:

username:<DB_USER>

password:<DB_PWD>

DB_USER indicates the administrator name. The default value is rwuser.

DB_PWD: indicates the administrator password.

DB_HOST indicates the private IP address of the node to be connected. Obtain the value from the Private IP Address column in the node list on the Basic Information page.

If you purchase an instance with multiple nodes, select the private IP address of any node.

Page 106: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 102

Figure 4-6 Obtaining the private IP address

DB_PORT: indicates the port number. The default value is 8635 and cannot be changed.

Step 5 After the identity verification is successful, run the following command:

show databases

If the following information is displayed, the connection is successful.

name: databases

name

----

_internal

----End

4.3 Connecting to a GaussDB(for Influx) Instance Over Public Networks

4.3.1 Step 1: Buy a GaussDB(for Influx) Instance

This section describes how to buy a DB instance that is compatible with InfluxDB APIs.

By default, each tenant can have up to 50 GaussDB(for Influx) instances. To apply for a

higher quota, see Quota Management.

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Log in to the GaussDB NoSQL console.

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications and click

Next.

Page 107: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 103

Figure 4-7 Billing mode and basic information

Table 4-10 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use.

Yearly/Monthly

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based on

the service price.

− If you will no longer use the instance for a long time after it

expires, you can change the billing mode from yearly/monthly

to pay-per-use. For details, see Changing the Billing Mode

from Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the system

deducts the fees incurred from your account based on the

service duration.

− If you want to use a DB instance at a low cost for a long period

of time, you can change its billing mode from pay-per-use to

yearly/monthly. For details, see Changing the Billing Mode

from Pay-per-Use to Yearly/Monthly.

Table 4-11 Basic information

Parameter Description

Region A region where the tenant is located. It can be changed in the upper

left corner.

NOTICE

Page 108: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 104

Parameter Description

Select the region nearest where you will be accessing the DB from so latency can be kept to a minimum and response time will be faster. Also, products deployed in different regions cannot communicate with each other through a private network and you cannot change the region of a DB after creating the instance.

DB Instance Name The name can be the same as an existing instance name. It must start

with a letter and consist of 4 to 64 characters. Only letters, numbers,

hyphens (-), and underscores (_) are allowed.

After the DB instance is created, you can change its name. For

details, see Modifying the DB Instance Name.

Compatible API InfluxDB

DB Instance Type Cluster

DB Engine Version 1.7

AZ An AZ is a part of a region with its own independent power supplies

and networks. AZs are physically isolated but can communicate

through an internal network connection.

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one AZ.

If you want to deploy an instance across AZs for disaster

recovery, select three AZs. In this deployment mode, the nodes

are evenly distributed in the three AZs.

If you need to deploy an instance in three AZs, choose Service

Tickets > Create Service Ticket in the upper right corner of the

management console and submit the application.

Figure 4-8 Specifications and storage

Table 4-12 Specifications and storage

Parameter Description

Instance

Specifications

For details about the DB instance specifications, see DB Instance

Specifications.

Page 109: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 105

Parameter Description

Different performance specifications support different numbers of

connections and maximum IOPSs. Select CPU and memory

specifications based on your service requirements.

Nodes The number of nodes depends on the actual environment.

Storage Space The minimum storage space is 100 GB and must be an integer.

You can add a minimum of 1 GB at a time.

Figure 4-9 Network and database configuration

Table 4-13 Network

Parameter Description

VPC The virtual network where your DB instances are located. A VPC

isolates networks for different services. You can select an existing

VPC or create a VPC.

If no VPC is available, the system creates one for you by default.

For details on how to create a subnet, see the "Creating a VPC"

section in the Virtual Private Cloud User Guide.

NOTE

After the GaussDB(for Influx) instance is created, the VPC where the instance resides cannot be changed.

If you want to connect to a GaussDB(for Influx) instance through an ECS over an internal network, the GaussDB(for Influx) instance and the ECS must be in the same VPC. If they are not in the same VPC, you can create a VPC peering connection to enable access.

Subnet A subnet provides dedicated network resources that are logically

isolated from other networks for network security.

Security Group A security group controls access between GaussDB(for Influx)

instances and other services. When you select a security group,

Page 110: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 106

Parameter Description

you must ensure that it allows the client to access DB instances.

If there are no security groups available, the system allocates

resources to you by default.

Table 4-14 Database configuration

Parameter Description

Administrator The default administrator account is rwuser.

Administrator

Password

Set a password for the administrator. The password:

Must be 8 to 32 characters long.

Must be a combination of uppercase letters, lowercase letters,

numbers, and the following special characters: ~!@#%^*-_=+?

For security reasons, you must select a strong password. The

system will verify the password strength.

Keep this password secure. If you lose it, the system cannot

retrieve it.

Confirm Password Enter the administrator password again.

Enterprise Project This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and

grouping of cloud resources and users. The default project is

default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management

User Guide.

Table 4-15 Tag

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each DB instance can have up to 20 tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key can

include up to 36 characters, including numbers, letters, underscores

(_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), dots (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the Tags

tab. In addition, you can add, modify, and delete tags for existing

instances. For details, see Tag.

Page 111: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 107

Table 4-16 Required duration

Parameter Description

Required

duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 On the Instance Management page, you can view and manage your DB instances.

After the creation is complete, the status changes to Available.

You can click in the upper right corner of the page to refresh the DB instance

statuses.

After a DB instance is created, the default database port is 8635 and cannot be changed.

----End

4.3.2 Step 2: Bind an EIP

Scenarios

After you create a GaussDB(for Influx) instance, you can bind an EIP to it to allow external

access. If later you want to prohibit external access, you can also unbind the EIP from the DB

instance.

Precautions Before accessing a database, you need to apply for an EIP on the VPC console. Then,

add an inbound rule to allow the IP addresses or IP address ranges of ECSs. For details,

see section Step 3: Configure Security Group Rules.

To change the EIP that has been bound to a node, you need to unbind it from the node

first.

Page 112: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 108

Binding an EIP

Step 1 On the Instance Management page, click the target GaussDB(for Influx) instance.

Step 2 On the Basic Information page, in the Node Information area, locate the target node and

click Bind EIP in the Operation column.

Figure 4-10 Binding an EIP

Step 3 In the displayed dialog box, all available unbound EIPs are listed. Select the required EIP and

click Yes. If no available EIPs are displayed, click View EIP and create an EIP on the VPC

console.

Figure 4-11 Selecting an EIP

Step 4 In the EIP column, view the EIP that is successfully bound.

To unbind the EIP from the DB instance, see Unbinding an EIP.

----End

Unbinding an EIP

Step 1 On the Instance Management page, click the target GaussDB(for Influx) instance.

Step 2 On the Basic Information page, in the Node Information area, locate the target node and

click Unbind EIP in the Operation column.

Page 113: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 109

Figure 4-12 Unbinding an EIP

Step 3 In the displayed dialog box, click Yes to unbind the EIP.

To bind an EIP to the DB instance again, see Binding an EIP.

----End

4.3.3 Step 3: Configure Security Group Rules

Scenarios

This section describes how to create a security group to enable specific IP addresses and ports

to access GaussDB NoSQL instances.

Precautions

The default security group rule allows all outgoing data packets. ECSs and GaussDB NoSQL

instances in the same security group can access each other. After a security group is created,

you can create different rules for that security group, which allows you to control access to the

GaussDB NoSQL instances that in it.

By default, you can create up to 500 security group rules. However, too many rules increase

network latency for initial access, so it is recommended that you add no more than 50 rules

for each security group.

To access the GaussDB NoSQL instances in a security group from a source outside of that

group, you need to create an inbound rule.

Procedure

Step 1 Log in to the management console.

Step 2 Click in the upper left corner and select a region and a project.

Step 3 Click Service List. Under Network, click Virtual Private Cloud.

Step 4 In the navigation pane on the left, choose Access Control > Security Groups.

Step 5 On the Security Groups page, click the security group name.

Step 6 On the Inbound Rules tab, click Add Rule. In the displayed Add Inbound Rule dialog box,

set required parameters to add inbound rules. On the Outbound Rules tab, click Add Rule.

In the displayed Add Outbound Rule dialog box, set required parameters to add outbound

rules.

Page 114: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 110

Figure 4-13 Add Inbound Rule

Figure 4-14 Add Outbound Rule

Step 7 In the displayed dialog box, set required parameters.

Table 4-17 Parameter description

Parameter

Description Value Example

Protocol The network protocol required for access. You can allow all

protocols or specify a specific protocol, TCP, UDP, ICMP,

and SSH.

TCP

Port Specifies the port that allows the access to ECSs or external

devices.

8635

Source/D

estination

Specifies the supported IP address and security group that the

rule applies to.

IP address: The IP address or subnet that the rule applies

192.168.1

0.0/24

default

Page 115: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 111

Parameter

Description Value Example

to. Single IP addresses must be expressed using slash

notation.

− Single IP address: xxx.xxx.xxx.xxx/32 (IPv4)

− Subnet: xxx.xxx.xxx.0/24

− All IP addresses: 0.0.0.0/0

Security Group: A security group that access will be

allowed from. ECSs in this security group will be granted

access to GaussDB NoSQL the instance in the current

security group

Step 8 Click OK.

----End

4.3.4 Step 4: Connect to a GaussDB(for Influx) Instance Over Public Networks

Scenarios

This section uses the Linux operating system as an example to describe how to connect an

ECS to a GaussDB(for Influx) instance over public networks.

Constraints Bind an EIP to the GaussDB(for Influx) instance node and set security group rules.

The ECS must be allowed in a security group that has access to the DB instances.

− If the security group that the target DB instance belongs to is the default security

group, you do not need to configure security group rules.

− If the security group that the target DB instance belongs to is not the default

security group, check whether the security group rules allow the ECS to connect to

the DB instance. For details, see section Step 3: Configure Security Group Rules.

If the security group rules allow the access from the ECS, the ECS can connect to

the DB instance.

If the security group rule does not allow the access from the ECS, you need to add

an inbound rule to the security group.

The default port of the GaussDB(for Influx) instance is 8635 and cannot be changed.

Prerequisites Create an ECS running Linux. For details, see the section Purchasing an ECS in the

Elastic Cloud Server Getting Started.

Download the InfluxDB client. The following uses the Linux 64-bit client as an example.

Page 116: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 4 Getting Started with GaussDB(for Influx)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 112

Procedure

Step 1 Log in to the ECS. For details, see the section Logging In to an ECS in the Elastic Cloud

Server Getting Started.

Step 2 Upload the InfluxDB client installation package to ECS.

Step 3 Decompress the client tool package.

tar -xzf influxdb-1.7.9-static_linux_amd64.tar.gz

Step 4 Connect to the DB instance in the directory where the influx tool is located.

1. Run the following command to go to the InfluxDB directory:

cd influxdb-1.7.9-1

2. Connect to the InfluxDB shell.

./influx -ssl -unsafeSsl -host <DB_HOST> -port <DB_PORT>

Example:

./influx -ssl -unsafeSsl -host 10.154.217.9 -port 8635

3. Run the following command for authentication:

auth

Enter the user name and password as prompted. The prompted information is similar as

follows:

username:<DB_USER>

password:<DB_PWD>

DB_USER indicates the administrator name. The default value is rwuser.

DB_PWD: indicates the administrator password.

DB_HOST indicates the EIP of the node to be connected. Obtain the value from the EIP column in the node list on the Basic Information page.

DB_PORT: indicates the port number. The default value is 8635 and cannot be changed.

Step 5 After the identity verification is successful, run the following command:

show database

If the following information is displayed, the connection is successful.

name: databases

name

----

_internal

----End

Page 117: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 5 Getting Started with GaussDB(for Redis)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 113

5 Getting Started with GaussDB(for Redis)

5.1 Connecting to a GaussDB(for Redis) Instance Over Private Networks

5.1.1 Step 1: Buy a GaussDB(for Redis) Instance

This section describes how to buy a DB instance that is compatible with Redis APIs.

By default, each tenant can have up to 50 GaussDB(for Redis) instances. To apply for a higher

quota, see Quota Management.

Prerequisites You have registered a HUAWEI CLOUD account.

Procedure

Step 1 Log in to the GaussDB NoSQL console.

Step 2 On the Instance Management page, click Buy DB Instance.

Step 3 On the displayed page, select a billing mode, select your DB instance specifications and click

Next.

Page 118: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 5 Getting Started with GaussDB(for Redis)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 114

Figure 5-1 Billing mode and basic information

Table 5-1 Billing mode

Parameter Description

Billing Mode Select Yearly/Monthly or Pay-per-use. Enhanced performance

instances support only the pay-per-use billing mode.

Yearly/Monthly

− You need to set Required Duration as required. Then, the

system deducts the fees incurred from your account based on

the service price.

− If you will no longer use the instance for a long time after it

expires, you can change the billing mode from yearly/monthly

to pay-per-use. For details, see Changing the Billing Mode

from Yearly/Monthly to Pay-per-Use.

NOTE

DB instances paid in yearly/monthly mode cannot be deleted. If a DB instance is no longer needed, it can only be unsubscribed. For details, see section Unsubscribing a Yearly/Monthly DB Instance.

Pay-per-use

− You do not need to set Required Duration because the system

deducts the fees incurred from your account based on the

service duration.

− If you want to use a DB instance at a low cost for a long period

of time, you can change its billing mode from pay-per-use to

yearly/monthly. For details, see Changing the Billing Mode

from Pay-per-Use to Yearly/Monthly.

Table 5-2 Basic information

Parameter Description

Region The region where the tenant is located.

Page 119: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 5 Getting Started with GaussDB(for Redis)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 115

Parameter Description

NOTICE

Select the region nearest where you will be accessing the DB from so latency can be kept to a minimum and response time will be faster. Also, products deployed in different regions cannot communicate with each other through a private network and you cannot change the region of a DB after creating the instance.

DB Instance Name The name can be the same as an existing instance name and have 4 to

64 characters. It must start with a letter and can contain only

uppercase letters, lowercase letters, numbers, hyphens (-), and

underscores (_).

After the DB instance is created, you can change its name. For

details, see Modifying the DB Instance Name.

Compatible API Redis

DB Instance Type Hybrid storage

Enhanced performance

DB Engine

Version

5.0

AZ An AZ is a part of a region with its own independent power supplies

and networks. AZs are physically isolated but can communicate

through an internal network connection.

Currently, instances can be deployed in a single AZ or three AZs.

If you want to deploy an instance in a single AZ, select one AZ.

If you want to deploy an instance across AZs for disaster

recovery, select three AZs. In this deployment mode, the nodes

are evenly distributed in the three AZs.

If you need to deploy an instance in three AZs, choose Service

Tickets > Create Service Ticket in the upper right corner of the

management console and submit the application.

Figure 5-2 Specifications and storage

Page 120: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 5 Getting Started with GaussDB(for Redis)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 116

Table 5-3 Specifications and storage

Parameter Description

Instance

Specifications

For details about the DB instance specifications, see DB Instance

Specifications.

Different performance specifications support different numbers of

connections and maximum IOPSs. Select CPU and memory

specifications based on your service requirements.

Nodes The number of nodes depends on the actual environment.

Storage Space The storage space depends on the instance specifications.

For a hybrid storage instance, the minimum storage space is

48 GB. The capacity you select must be an integer and a

minimum of 1 GB can be selected at a time.

For an enhanced performance DB instance, the minimum

storage space is 10 GB.

After a DB instance is created, you can scale up its storage space.

For details, see Scaling Up Storage Space.

Figure 5-3 Network and database configuration

Table 5-4 Network

Parameter Description

VPC The virtual network where your DB instances are located. A VPC

isolates networks for different services. You can select an existing

VPC or create a VPC.

For details on how to create a subnet, see the "Creating a VPC"

section in the Virtual Private Cloud User Guide.

If no VPC is available, the system creates one for you by default.

NOTE

After the GaussDB(for Redis) instance is created, the VPC where the instance resides cannot be changed.

If you want to connect to a GaussDB(for Redis) instance through an ECS over an internal network, the GaussDB(for Redis) instance and

Page 121: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 5 Getting Started with GaussDB(for Redis)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 117

Parameter Description

the ECS must be in the same VPC. If they are not in the same VPC, you can create a VPC peering connection to enable access.

Subnet A subnet provides dedicated network resources that are logically

isolated from other networks for network security.

Security Group A security group controls access between GaussDB NoSQL

instances and other services. When you select a security group,

you must ensure that it allows the client to access DB instances.

If there are no security groups available, the system allocates

resources to you by default.

Table 5-5 Database configuration

Parameter Description

Administrator If you select Enhanced performance, the administrator username

is rwuser by default.

Administrator

Password

Set a password for the administrator. The password:

Must be 8 to 32 characters long.

Must be a combination of uppercase letters, lowercase letters,

numbers, and the following special characters: ~!@#%^*-_=+?

For security reasons, you must select a strong password. The

system will verify the password strength.

Keep this password secure. If you lose it, the system cannot

retrieve it.

Confirm Password Enter the administrator password again.

Enterprise Project This parameter is provided for enterprise users.

An enterprise project facilitates project-level management and

grouping of cloud resources and users. The default project is

default.

Select an enterprise project from the drop-down list. For more

information about enterprise project, see Enterprise Management

User Guide.

Table 5-6 Tags

Parameter Description

Tags The setting is optional. Adding tags helps you better identify and

manage your DB instances. Each instance can have up to 20 tags.

A tag is composed of a key-value pair.

Key: Mandatory if the DB instance is going to be tagged

Each tag key must be unique for each DB instance. The key

can include up to 36 characters, including numbers, letters,

Page 122: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 5 Getting Started with GaussDB(for Redis)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 118

Parameter Description

underscores (_), hyphens (-).

Value: Optional if the DB instance is going to be tagged

The value can contain up to 43 characters, including numbers,

letters, underscores (_), dots (.), and hyphens (-).

After a DB instance is created, you can view its tag details on the

Tags tab. In addition, you can add, modify, and delete tags for

existing instances. For details, see Tag.

Table 5-7 Required duration

Parameter Description

Required

Duration

Sets the service duration if you select the Yearly/Monthly billing

mode. The service duration ranges from one month to three years.

Auto-renewal By default, this option is not selected.

If you select this option, the auto-renew cycle is determined by the

selected required duration.

Step 4 On the displayed page, confirm the DB instance details.

For yearly/monthly DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Pay Now to go to the payment

page and complete the payment.

For pay-per-use DB instances

− If you need to modify the specifications, click Previous to return to the previous

page.

− If you do not need to modify the specifications, click Submit to start creating the

instance.

Step 5 On the Instance Management page, you can view and manage your DB instances.

After the creation is complete, the status changes to Available.

You can click in the upper right corner of the page to refresh the DB instance

statuses.

After a DB instance is created, the default database port is 8635 and cannot be changed.

----End

Page 123: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 5 Getting Started with GaussDB(for Redis)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 119

5.1.2 Step 2: Connect to a GaussDB(for Redis) Instance Over Private Networks

Scenarios

This section uses the Linux operating system as an example to describe how to connect an

ECS to a GaussDB(for Redis) instance over private networks.

You can use either of the following methods to connect to a GaussDB(for Redis) instance

through a private network:

Method 1: Connect to the private IP address of each node to access the DB instance.

Method 2: Configure a private zone for the DB instance to access the DB instance.

Constraints The default port of the GaussDB(for Redis) instance is 8635.

The DB instances must be in the same VPC subnet as the ECS.

The ECS must be allowed in a security group that has access to the DB instances.

Scenario 1: If the security group that the target DB instance belongs to is the default

security group, you do not need to configure security group rules.

Scenario 2: If the security group that the target DB instance belongs to is not the default

security group, check whether the security group rules allow the ECS to connect to the

DB instance.

− If the security group rules allow the access from the ECS, the ECS can connect to

the DB instance.

− If the security group rule does not allow the access from the ECS, you need to add

an inbound rule to the security group.

For details about how to configure a security group, see Configuring Security

Group Rules.

Prerequisites Create an ECS running Linux. For details, see the section Purchasing an ECS in the

Elastic Cloud Server Getting Started.

The DB instances must be in the same VPC subnet as the ECS.

Download the Redis client installation package.

Connecting to a DB Instance Over a Private Network

Step 1 Log in to the ECS. For details, see the section Logging In to an ECS in the Elastic Cloud

Server Getting Started.

Step 2 Upload the Redis client installation package to ECS.

Step 3 Decompress the client tool package.

Page 124: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 5 Getting Started with GaussDB(for Redis)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 120

tar -xzf redis-5.0.7.tar.gz

Step 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.168.0.208 -p 8635 -a Aa@12345

DB_HOST indicates the private IP address of the node to be connected. Obtain the value from the

Private IP Address column in the node list on the Basic Information page.

DB_PORT indicates the port of the DB instance. The default value is 8635.

DB_PWD indicates the administrator password.

Step 5 If the following information is displayed, the connection is successful.

IP:port>

----End

Connecting to a DB Instance Through a Private Domain Name

Step 1 Create a private zone for the GaussDB(for Redis) instance. For details, see Creating a Private

Zone.

Step 2 Log in to the ECS. For details, see the section Logging In to an ECS in the Elastic Cloud

Server Getting Started.

Step 3 Upload the Redis client installation package to ECS.

Step 4 Decompress the client tool package.

tar -xzf redis-5.0.7.tar.gz

Step 5 Connect to the DB instance in the src directory.

cd redis-5.0.7

make

cd src

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

Example:

./redis-cli -h guassdbforredis.com -p 8635 -a Aa@12345

DB_Domain_Name indicates the private zone name of the DB instance to be connected. The private

zone name is the one created in Step 1.

DB_PORT indicates the port of the DB instance. The default value is 8635.

DB_PWD indicates the administrator password.

Page 125: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started 5 Getting Started with GaussDB(for Redis)

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 121

Step 6 If the following information is displayed, the connection is successful.

Domain_Name:port>

----End

Page 126: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started A Change History

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 122

A Change History

Released On Description

2020-10-30 This issue is the ninth official release, which incorporates the

following change:

Supported up to 20 tags per instance.

2020-08-30 This issue is the eighth official release, which incorporates the

following changes:

Supported the following functions of GaussDB(for Mongo):

Supported cluster 4.0.

Supported batch purchase of pay-per-use or yearly/monthly

DB instances.

Supported the following functions of GaussDB(for Influx):

Supports the yearly/monthly billing mode.

Supported the following functions of GaussDB(for Redis):

Supports the yearly/monthly billing mode.

2020-07-30 This issue is the seventh official release, which incorporates the

following changes:

Supported point-in-time recovery of GaussDB(for Cassandra).

Supported the following functions of GaussDB(for Mongo):

Binding and unbinding an EIP

Connecting DB instances over public networks

Supported the following functions of GaussDB(for Influx):

Binding and unbinding an EIP

Connecting DB instances over public networks

2020-06-30 This is the sixth official release, which incorporates the

following changes:

Supported the following functions of GaussDB(for

Cassandra):

− Purchasing yearly/monthly instances

− SSL

− Cross-AZ disaster recovery

Page 127: Getting Started · 2020. 9. 9. · GaussDB NoSQL Getting Started Issue 08 Date 2020-08-30 HUAWEI TECHNOLOGIES CO., LTD

GaussDB NoSQL

Getting Started A Change History

Issue 09 (2020-10-30) Copyright © Huawei Technologies Co., Ltd. 123

Released On Description

Supported the following functions of GaussDB(for Mongo):

− Scaling up storage space

− Adding nodes

− Deleting nodes.

− Changing a DB instance class

− Resetting a password

− Cross-AZ disaster recovery

Supported the following functions of GaussDB(for Influx):

− Scaling up the storage space

− Cross-AZ disaster recovery

Supported the following functions of GaussDB(for Redis):

− Cross-AZ disaster recovery

2020-04-30 This issue is the fifth official release, which incorporates the

following changes:

Supported ARM-based specifications for GaussDB(for

Mongo).

Supported logging in to the GaussDB(for Cassandra)

instances through DAS.

2020-03-31 This issue is the fourth official release, which incorporates the

following change:

Added the parameter template function.

2020-02-24 This issue is the third official release, which incorporates the

following change:

Supported binding and unbinding an EIP to and from the

GaussDB(for Cassandra) instance.

2020-01-20 This issue is the second official release, which incorporates the

following changes:

Supported GaussDB(for Influx) open beta testing.

Supported GaussDB(for Redis) open beta testing.

Support modification of GaussDB(for Cassandra) instance

specifications.

2019-11-18 This issue is the first official release.