Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ GeminiDB/ GeminiDB Cassandra API/ Best Practices/ Buying and Connecting to a GeminiDB Cassandra Instance

Buying and Connecting to a GeminiDB Cassandra Instance

Updated on 2025-01-26 GMT+08:00

This section describes how to buy a GeminiDB Cassandra instance and uses a Linux ECS as an example to describe how to connect to the instance over a private network.

Step 1: Buy a GeminiDB Cassandra Instance

  1. Log in to the Huawei Cloud console.
  2. In the service list, choose Databases > GeminiDB Cassandra API.
  3. On the Instances page, click Buy DB Instance.
  4. Click Buy DB Instance, select a billing mode, and configure instance parameters. Then, click Next and complete subsequent operations.

    Figure 1 Basic information

    Figure 2 Setting a password

  5. View the purchased GeminiDB Cassandra instance.

    Figure 3 Successful purchase

Step 2: Buy an Instance

  1. Log in to the Huawei Cloud console.
  2. In the service list, choose Compute > Elastic Cloud Server. On the Elastic Cloud Server console, click Buy ECS.

  3. Configure basic settings and click Next: Configure Network. Make sure that the ECS is in the same region, AZ, VPC, and security group as the GeminiDB Cassandra instance you created.

    Figure 4 Basic settings
    Figure 5 Selecting specifications
    Figure 6 Selecting an image

  4. Configure the ECS network and click Next: Configure Advanced Settings. Make sure that the ECS is in the same VPC and security group as the GeminiDB Cassandra instance.

    • If security group rules allow access from the ECS, you can connect to the instance using the ECS.
    • If the security group rules do not allow access from the ECS, add an inbound rule to the security group.
    Figure 7 Network settings
    Figure 8 Selecting an EIP

  5. Configure a password for the ECS and click Next: Confirm.

    Figure 9 Advanced settings

  6. Confirm the configurations and click Submit.

    Figure 10 Confirming the configurations

  7. View the purchased ECS.

Step 3: Connect to the GeminiDB Cassandra Instance

  1. On the ECS console, log in to the ECS using the remote login option.

    Figure 11 Remote login

  2. Enter the username and password of the ECS.

    Figure 12 Entering the username and password

  3. Download the Cassandra installation package and upload it to the ECS.

    Method 1:

    wget https://dbs-download.obs.cn-north-1.myhuaweicloud.com/nosql/Cassandra_cqlsh_x86_64.zip

    Method 2:

    Download the Cassandra client installation package using your browser and upload it to the ECS.

  4. Decompress the client package.

    unzip Cassandra_cqlsh_x86_64.zip

  5. Make the files executable:

    chmod +x *

  6. Connect to the GeminiDB Cassandra instance in the directory where the cqlsh is located.

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

    Example:

    ./cqlsh 192.xx.xx.xx 8635 -u rwuser

    Table 1 Required description

    Parameter

    Description

    <DB_HOST>

    The private IP address of the instance to be accessed.

    To obtain this IP address, go to the Instances page, locate the instance, and click its name. The IP address can be found in the Private IP Address field under Node Information on the Basic Information page.

    If the GeminiDB Cassandra instance you purchased has multiple nodes, select the private IP address of any node.

    <DB_PORT>

    The port used to access the instance. The default port number is 8635. Set this parameter based on service requirements.

    Click the instance name to go to the Basic Information page and obtain the port number in the Network Information area.

    <DB_USER>

    Username of the instance administrator. The default value is rwuser.

  7. If information similar to the following is displayed, the connection was successful.

    rwuser@cqlsh>

Basic Syntax

  • Keyspace syntax
    • Create a keyspace.

      Example:

      CREATE KEYSPACE IF NOT EXISTS nosql WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'};

      In this example, keyspace_name is set to nosql, class to SimpleStrategy, and replication_factor to 3. GeminiDB Cassandra provides strong consistency and 3 data copies for each GeminiDB Cassandra instance no matter how many copies you set.

    • Run DESC <keyspace_name> to verify the creation results.
      Figure 13 Verifying the creation results
    • Run use <keyspace_name> to switch to the keyspace you created.
      Figure 14 Switching the keyspace
    • Run DROP KEYSPACE <keyspace_name> to delete the keyspace you created.
      Figure 15 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));

      nosql_table is a table name defined by the following three columns: user_id, age, and user_name. user_id indicates a user ID of the INT data type. age indicates user age of the INT data type. user_name indicates a username of the TEXT data type. The primary key is user_id.

    • Run DESC <table_name> to verify the creation results.
      Figure 16 Verifying the creation results
    • Insert data into the table, for 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');

    • Run SELECT * FROM <table_name> to query table data.
      Figure 17 Querying table data
    • Add a column to the table, for example,

      ALTER TABLE nosql_table ADD gender text;

    • Update data in a table of a keyspace, for 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 18 Viewing the update results
    • Delete data from a table in a keyspace, for example,

      Delete age data of the user whose ID is 1.

      DELETE age FROM nosql.nosql_table WHERE user_id=1;

      Figure 19 Deleting a data record

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

      DELETE FROM nosql.nosql_table WHERE user_id=2;

      Figure 20 Deleting the entire record
    • Delete an entire table, for example,

      DROP TABLE nosql.nosql_table;

      Figure 21 Deleting an entire table
  • HELP command
    • Run the HELP command to view all supported commands.
      Figure 22 Viewing all supported commands
    • HELP <COMMAND> is used to query the usage of a command.

      Example: HELP DESC

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback