このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

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
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
On this page

Show all

Introducing HBase Shell Commands

Updated on 2024-07-23 GMT+08:00

This section describes common HBase shell commands.

  1. Start the HBase shell.

    Go to the HBase directory and run the following command to access the HBase shell:

    ./bin/hbase shell
  2. Get help information.

    After you run the help command in the HBase shell, all command information as well as common command instructions and use methods will be returned.

    hbase(main):001:0> help
  3. Create a table.

    Run the create command to create a table. When creating a table, you must specify the table name and column family name.

    hbase(main):007:0> create 'cloudtable','cf'
    0 row(s) in 1.5530 seconds
    
    => Hbase::Table - cloudtable
  4. Query a table:
    hbase(main):009:0> list
    TABLE
    cloudtable
    1 row(s) in 0.0060 seconds
    
    => ["cloudtable"]
  5. Insert a piece of record to a table.

    Run the put command to insert a piece of record to the specified table. You need to specify the table name, primary key, customized column, and inserted value.

    hbase(main):004:0> put 'cloudtable','row1','cf:a','value1'
    0 row(s) in 0.2720 seconds

    The following describes parameters in the command:

    • cloudtable: table name
    • row1: primary key
    • cf:a: customized column
    • value1: inserted value
  6. Scan records

    Run the scan command to scan a table. You need to specify the table name and you can scan a full table or specify a scanning range.

    hbase(main):001:0> scan 'cloudtable'
    ROW                                                                  COLUMN+CELL
    row1                                                                column=cf:a, timestamp=1504866237162, value=value1
    1 row(s) in 0.2420 seconds
    NOTE:
    • If the TTL of the cell is set when the data is inserted, the TTL attribute cannot be viewed. You can check whether the TTL configuration is successful.
    • If the TTL of the cell is not set when data is inserted, the system automatically inserts the current time as the timestamp.
  7. Query a single record.

    Run the get command to query a single record. The name and primary key of the queried table must be specified.

    hbase(main):001:0> get 'cloudtable','row1'
    COLUMN                                                               CELL
    cf:a                                                                timestamp=1504866237162, value=value1
    1 row(s) in 0.2280 seconds
  8. Disable a table.

    Before modifying or deleting a table, you need to disable the table. Run the disable command to disable the table. When you perform operations on a disabled table, "ERROR" will be reported, indicating that the table is disabled.

    hbase(main):002:0> disable 'cloudtable'
    0 row(s) in 2.3550 seconds
  9. Enable a table.

    If you want to use a table that has been disabled, run the enable command to enable the table.

    hbase(main):004:0> enable 'cloudtable'
    0 row(s) in 1.2500 seconds
  10. Delete a table.

    Run the drop command to delete a table that you do not require anymore. Before deleting a table, disable the table. Otherwise, "ERROR" will be displayed, indicating that the table is enabled. Deleting a table will cause data loss. Therefore, exercise caution when deleting a table.

    hbase(main):007:0> disable 'cloudtable'
    0 row(s) in 2.2380 seconds
    
    hbase(main):008:0> drop 'cloudtable'
    0 row(s) in 1.2600 seconds
  11. Exit the HBase shell.

    Run the quit command to exit the HBase shell.

    hbase(main):009:0> quit

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback