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

CarbonData Data Migration

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

Scenario

If you want to rapidly migrate CarbonData data from a cluster to another one, you can use the CarbonData backup and restoration commands. This method does not require data import in the target cluster, reducing required migration time.

Prerequisites

The Spark2x client has been installed in a directory, for example, /opt/client, in two clusters. The source cluster is cluster A, and the target cluster is cluster B.

Procedure

  1. Log in to the node where the client is installed in cluster A as a client installation user.
  2. Run the following commands to configure environment variables:

    source /opt/client/bigdata_env

    source /opt/client/Spark2x/component_env

  3. If the cluster is in security mode, run the following command to authenticate the user. In normal mode, skip user authentication.

    kinit carbondatauser

    carbondatauser indicates the user of the original data. That is, the user has the read and write permissions for the tables.

    NOTE:

    You must add the user to the hadoop (primary group) and hive groups, and associate it with the System_administrator role.

  4. Run the following command to connect to the database and check the location for storing table data on HDFS:

    spark-beeline

    desc formatted Name of the table containing the original data;

    Location in the displayed information indicates the directory where the data file resides.

  5. Log in to the node where the client is installed in cluster B as a client installation user and configure the environment variables:

    source /opt/client/bigdata_env

    source /opt/client/Spark2x/component_env

  6. If the cluster is in security mode, run the following command to authenticate the user. In normal mode, skip user authentication.

    kinit carbondatauser2

    carbondatauser2 indicates the user that uploads data.

    NOTE:

    You must add the user to the hadoop (primary group) and hive groups, and associate it with the System_administrator role.

  7. Run the spark-beeline command to connect to the database.
  8. Does the database that maps to the original data exist?

    • If yes, go to 9.
    • If no, run the create database Database name command to create a database with the same name as that maps to the original data and go to 9.

  9. Copy the original data from the HDFS directory in cluster A to that in cluster B.

    When uploading data in cluster B, ensure that the upload directory has the directories with the same names as the database and table in the original directory and the upload user has the permission to write data to the upload directory. After the data is uploaded, the user has the permission to read and write the data.

    For example, if the original data is stored in /user/carboncadauser/warehouse/db1/tb1, the data can be stored in /user/carbondatauser2/warehouse/db1/tb1 in the new cluster.

    1. Run the following command to download the original data to the /opt/backup directory of cluster A:

      hdfs dfs -get /user/carboncadauser/warehouse/db1/tb1 /opt/backup

    2. Run the following command to copy the original data of cluster A to the /opt/backup directory on the client node of cluster B.

      scp /opt/backup root@IP address of the client node of cluster B:/opt/backup

    3. Run the following command to upload the data copied to cluster B to HDFS:

      hdfs dfs -put /opt/backup /user/carbondatauser2/warehouse/db1/tb1

  10. In the client environment of cluster B, run the following command to generate the metadata associated with the table corresponding to the original data in Hive:

    REFRESH TABLE $dbName.$tbName;

    $dbName indicates the database name, and $tbName indicates the table name.

  11. If the original table contains an index table, perform 9 and 10 to migrate the index table directory from cluster A to cluster B.
  12. Run the following command to register an index table for the CarbonData table (skip this step if no index table is created for the original table):

    REGISTER INDEX TABLE $tableName ON $maintable;

    $tableName indicates the index table name, and $maintable indicates the table name.

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