Buying and Connecting to a GeminiDB DynamoDB-Compatible Instance
This section instructs you to buy a GeminiDB DynamoDB-Compatible instance on the GeminiDB console.
By default, each tenant can create a maximum of 50 GeminiDB DynamoDB-Compatible instances. To request a higher quota, choose Service Tickets > Create Service Ticket in the upper right corner of the console and contact customer service personnel.
- Buying an Instance
- Connecting to an Instance Using Java
For details about other connection methods, see Connection Methods.
Prerequisites
- You have created a Huawei Cloud account.
Buying an Instance
For details, see Buying a GeminiDB DynamoDB-Compatible Instance.
- Log in to the Huawei Cloud console.
- In the service list, choose Databases > GeminiDB.
- On the Instances page, click Buy DB Instance.
- On the displayed page, select a billing mode, configure instance parameters, and click Next.
The following parameters are for reference only. Select proper specifications as needed. Table 1 lists details about the parameters.Figure 1 Billing mode and basic information
Parameter
Example Value
Description
Billing Mode
Pay-per-use
Billing mode of an instance
- Yearly/Monthly: A prepaid billing mode in which you pay for resources before using it. Bills are settled based on the subscription period. The longer the subscription term, the bigger the discount. This mode is a good option for long-term stable services.
- Pay-per-use: A postpaid billing mode. Pay as you go and just pay for what you use. The DB instance usage is calculated by the second but billed every hour. This mode allows you to adjust resource usage easily. You neither need to prepare for resources in advance, nor end up with excessive or insufficient preset resources.
Region
Select CN-Hong Kong.
Region where a tenant is located
NOTE:
To reduce network latency, select a region nearest from which you will access the instance. Instances deployed in different regions cannot communicate with each other over a private network. After you buy an instance, you cannot change its region.
DB Instance Name
User-defined
The instance name:
- Can be the same as an existing instance name.
- Can contain 4 to 64 characters and must start with a letter. It is case-sensitive and allows only letters, digits, hyphens (-), and underscores (_).
Compatible API
DynamoDB
GeminiDB is compatible with mainstream NoSQL APIs, including Redis, DynamoDB, Cassandra, HBase, MongoDB, and InfluxDB. You can select GeminiDB APIs by following How Do I Select an API?
Storage Type
Classic
- Classic: classic architecture with decoupled storage and compute
- Cloud native: new, more flexible, new-gen version with support for more AZs
NOTE:
Cloud native storage is now in OBT. To use it, choose Service Tickets > Create Service Ticket in the upper right corner of the console and contact the customer service.
DB Instance Type
Cluster
Cluster
One cluster consists of at least three nodes. A cluster is easy to scale out to meet increasing data growth needs. A cluster is recommended when dealing with stringent availability demands, substantial data volumes, and the need for seamless scalability.
AZ
AZ 1, AZ 2, and AZ 3
Availability zone where the instance is created. An AZ is a part of a region with its own independent power supplies and networks. AZs are physically isolated but can communicate with each other over a private network.
Instances can be deployed in a single AZ or three AZs.
- To deploy instances in a single AZ, select one AZ.
- To deploy instances across AZs for disaster recovery, select three AZs, where the instance nodes will be evenly distributed.
Figure 2 Specifications and storageParameter
Example Value
Description
Instance Specifications
2U8GB
Select appropriate specifications based on the CPU-memory ratio.
After an instance is created, you can change its specifications. For details, see Changing vCPUs and Memory.
Nodes
3
Number of nodes that the instance is deployed on.
Currently, a maximum of 60 nodes are supported. To add more, choose Service Tickets > Create Service Ticket in the upper right corner of the console and contact the customer service.
After an instance is created, you can add nodes. For details, see Manually Adding Instance Nodes.
Storage Space
500 GB
Instance storage space. The range depends on the instance specifications. For details, see Instance Specifications.
After an instance is created, you can scale up its storage if necessary. For details, see Manually Scaling Up Storage Space.
Autoscaling
Toggled off
Autoscaling is toggled off by default.
You can enable Auto Scale after an instance is created. For details, see Automatically Scaling Up Storage Space.
Disk Encryption
Disable
Disable is selected by default.
If you select Enable, your data will be encrypted on disks and stored in ciphertext after you create an instance. When you download encrypted objects, the ciphertext will be decrypted into plain text and then sent to you. Disk encryption can improve data security and may have slight impacts on database writes and reads.
Figure 3 Network configurationFigure 4 Database configurationParameter
Example Value
Description
VPC
default_vpc
Virtual private network where your instances are located. A VPC isolates networks for different services. You can select an existing VPC or create a VPC.
NOTE:
- After a GeminiDB DynamoDB-Compatible instance is created, the VPC where the instance is deployed cannot be changed.
- If you want to connect to a GeminiDB DynamoDB-Compatible instance using an ECS over a private network, the GeminiDB Influx instance and the ECS must be in the same VPC. If they are not, you can create a VPC peering connection between them.
Subnet
default_subnet
A subnet provides dedicated network resources that are logically isolated from other networks for security purposes.
Security Group
default
A security group controls access between GeminiDB DynamoDB-Compatible API and other services. Ensure that the security group you selected allows your client to access the instance.
Administrator Password
Configured based on the password policy
Password of the administrator account. The password:
- Can include 8 to 32 characters.
- Can include uppercase letters, lowercase letters, digits, and any of the following special characters: ~!@#%^*-_=+?
- For security reasons, set a strong password. The system will verify the password strength.
Keep your password secure. The system cannot retrieve it if it is lost.
Enterprise Project
default
This parameter is provided for enterprise users.
An enterprise project groups cloud resources, so you can manage resources and members by project. The default project is default.
Select an enterprise project from the drop-down list. For more information about enterprise projects, see Enterprise Management User Guide.
Retain the default values for other parameters.
- On the displayed page, confirm instance details. To modify the configurations, click Previous.
- If no modification is required, read and agree to the service agreement and click Submit.
- Click Back to Instance Management to go to the instance list.
- On the Instances page, view and manage the created instance.
- It takes about 5 to 9 minutes to create an instance. During the process, the instance status is Creating.
- After the instance is created, its status becomes Available.
Figure 5 Available instance
Connecting to an Instance Using Java
This section describes how to connect to a GeminiDB DynamoDB-Compatible instance using Java.
Prerequisites
- A GeminiDB DynamoDB-Compatible instance has been created.
- For details about how to create an ECS, see Purchasing an ECS in Getting Started with Elastic Cloud Server.
- JDK has been installed on the ECS.
Obtaining the IP Address of a GeminiDB DynamoDB-Compatible Instance
- Log in to the Huawei Cloud console.
- In the service list, choose Databases > GeminiDB.
- On the Instances page, click the target instance.
The port of the GeminiDB DynamoDB-Compatible instance is 8000.
Method 1:
In the Node Information area on the Basic Information page, view the private IP address or EIP of each node.
Figure 6 Viewing the IP addressMethod 2
In the navigation pane, choose Connections to view the private IP address and EIP of the instance.
Figure 7 Viewing IP addresses
Using a Load Balancing Plug-in to Connect to a GeminiDB DynamoDB-Compatible Instance
- To obtain the JAR package and plug-in code, choose Service Tickets > Create Service Ticket in the upper right corner of the console and contact the customer service.
- Replace the IP address in the following code example with the IP address queried in 3.
Java code example:
package com.huawei.dbs.test; import com.huawei.dbs.RequestHandler; import com.amazonaws.SDKGlobalConfiguration; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; import com.amazonaws.services.dynamodbv2.document.DynamoDB; import com.amazonaws.services.dynamodbv2.document.TableCollection; import java.net.URI; public class V1Demo { public static AWSCredentialsProvider myCredentials = new AWSStaticCredentialsProvider( new BasicAWSCredentials("your_ak", "your_sk")); public static String ip = "***.***.***.***"; public static void main(String[] args) { disableCertificateChecks(); AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard() .withRegion("region-a") .withRequestHandlers(new RequestHandler(URI.create("http://" + ip + "8000"))) .withCredentials(myCredentials) .build(); DynamoDB dynamoDB = new DynamoDB(client); TableCollection res = dynamoDB.listTables(); System.out.println(res); } }
Connecting to an Instance over HTTPS
Prerequisites:
- The instance and ECS must be in the same VPC and subnet.
- The ECS must be accessible to the security group to which the instance belongs. For details, see Setting Security Group Rules for a GeminiDB DynamoDB-Compatible Instance.
- Enable SSL for the GeminiDB instance by following Enabling SSL for a GeminiDB DynamoDB-Compatible Instance and download a certificate by following Downloading an SSL Certificate. Take a Java application as an example. The command for importing the certificate is as follows:
keytool -importcert -alias hw -file ca.cert -keystore truststore.jks -storepass password
1. For compatibility purposes, you can still use HTTP after SSL is enabled. To meet high security requirements, you can modify a parameter to disable HTTP. For details, choose Service Tickets > Create Service Ticket in the upper right corner of the console and contact the customer service.
2. Currently, an EIP cannot be used over HTTPS.
Procedure
- Add Maven dependencies. Add dependencies related to AWS SDK for Java 2.x to the pom.xml file.
<dependencies> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>dynamodb</artifactId> <version>2.x.x</version> </dependency> </dependencies>
- Connect to the GeminiDB DynamoDB-Compatible instance using DynamoDBClient over HTTPS.
Java code example:
import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; import com.amazonaws.services.dynamodbv2.model.*; public class SourceDemo { // AK/SK credentials can be automatically obtained from environment variable file home/.aws/credentials. // If there is no such a file, you need to manually specify the AK/SK. public static AWSCredentialsProvider myCredentials = new AWSStaticCredentialsProvider( new BasicAWSCredentials("your_ak", "your_sk")); public static void main(String[] args) { AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("https://127.0.0.1:8000", "region_a")) .withCredentials(myCredentials) .build(); System.out.println(client.listTables()); CreateTableRequest request = new CreateTableRequest() .withTableName("test_001") .withProvisionedThroughput(new ProvisionedThroughput(1000L, 1000L)) .withKeySchema( new KeySchemaElement("id", KeyType.HASH) ) .withAttributeDefinitions( new AttributeDefinition("id", ScalarAttributeType.N) ); System.out.println(client.createTable(request)); } }
GeminiDB DynamoDB-Compatible API is completely compatible with DynamoDB. For details about common operations, see official DynamoDB documents.
FAQs
Question: What should I do if the DAS console cannot be redirected after I click Log In in the Operation column in the instance list or click Log In on the Basic Information page?
Solution: Set your browser to allow pop-ups and try again.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot