El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

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
Situation Awareness
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

Kafka Data Migration Overview

Updated on 2024-10-25 GMT+08:00

You can migrate Kafka services to connect message producers and consumers to a new Kafka instance and can even migrate persisted message data to the new Kafka instance. Kafka services can be migrated in the following two scenarios:

  • Migrating services to the cloud without downtime

    Services that have high requirements on continuity must be smoothly migrated to the cloud because they cannot afford a long downtime.

  • Re-deploying services on the cloud

    A Kafka instance deployed within an AZ is not capable of cross-AZ disaster recovery. For higher reliability, you can re-deploy services to an instance that is deployed across AZs.

Constraints

  • When Smart Connect is used to migrate services, it consumes the source Kafka messages and produces messages to the target Kafka instance, occupying the bandwidth of the source and the target Kafka.
  • To maintain performance, Smart Connect only synchronizes the source and target data in real time. The consumption progress is synchronized in batches, so the consumption progress on the source and target partitions may vary from 0 to 100.

Preparation

  1. Configure the network environment.

    A Kafka instance can be accessed within a VPC or over a public network. For public network access, the producer and consumer must have public access permissions, and the following security group rules must be configured.

    Table 1 Security group rules

    Direction

    Protocol

    Port

    Source

    Description

    Inbound

    TCP

    9094

    IP address or IP address group of the Kafka client

    Accessing a Kafka instance in a public network (in plaintext)

    Inbound

    TCP

    9095

    IP address or IP address group of the Kafka client

    Accessing a Kafka instance in a public network (in ciphertext)

  2. Create the target Kafka instance.

    The specifications of the target instance cannot be lower than the original specifications. For more information, see Buying a Kafka Instance.

  3. Create a topic in the target Kafka instance.

    Create a topic with the same configurations as the original Kafka instance, including the topic name, number of replicas, number of partitions, message aging time, and whether to enable synchronous replication and flushing. For more information, see Creating a Kafka Topic.

Migration Scheme 1: Migrating the Production First

Migrate the message production service to the new Kafka instance. After migration, the original Kafka instance will no longer produce messages. After all messages of the original Kafka instance are consumed, migrate the message consumption service to the new Kafka instance to consume messages of this instance.

This is a common migration scheme. It is simple and easy to control on the service side. During the migration, the message sequence is ensured, so this scheme is suitable for scenarios with strict requirements on the message sequence. However, latency may occur because there is a period when you have to wait for all data to be consumed.

  1. Change the Kafka connection address of the producer to that of the new Kafka instance.
  2. Restart the production service so that the producer can send new messages to the new Kafka instance.
  3. Check the consumption progress of each consumer group in the original Kafka instance until all data in the original Kafka instance is consumed.
  4. Change the Kafka connection addresses of the consumers to those of the new Kafka instance.
  5. Restart the consumption service so that consumers can consume messages from the new Kafka instance.
  6. Check whether consumers consume messages properly from the new Kafka instance.
  7. The migration is complete.

Migration Scheme 2: Migrating the Production Later

Use multiple consumers for the consumption service. Some consume messages from the original Kafka instance, and others consume messages from the new Kafka instances. Then, migrate the production service to the new Kafka instance so that all messages can be consumed in time.

For a certain period of time, the consumption service consumes messages from both the original and new Kafka instances. Before the migration, message consumption from the new Kafka instance has already started, so there is no latency. However, early on in the migration, data is consumed from both the original and new Kafka instances, so the messages may not be consumed in the order that they are produced. This scheme is suitable for services that require low latency but do not require strict message sequence.

  1. Start new consumer clients, set the Kafka connection addresses to that of the new Kafka instance, and consume data from the new Kafka instance.

    NOTE:

    Original consumer clients must continue running. Messages are consumed from both the original and new Kafka instances.

  2. Change the Kafka connection address of the producer to that of the new Kafka instance.
  3. Restart the producer client to migrate the production service to the new Kafka instance.
  4. After the production service is migrated, check whether the consumption service connected to the new Kafka instance is normal.
  5. After all data in the original Kafka is consumed, close the original consumption clients.
  6. The migration is complete.

Migration Scheme 3: Migrating the Consumption First

Use Smart Connect to synchronize the two Kafka instances, migrate the consumer first and then the producer to the new Kafka instance.

This scheme uses Smart Connect to synchronize the source and target data in real time. However, the consumption progress is synchronized in batches. The consumption progress on the source and target partition may vary from 0 to 100. As a result, some messages are repeatedly consumed. This scheme applies to services where the message production must continue, end-to-end latency must be low, and repeated consumption can be tolerated.

  1. Create a Smart Connect task for Kafka data replication. For details, see Replicating Kafka Instance Data.
  2. On the Message Query page of the Kafka console, check whether the latest messages and the synchronization progress of both Kafka instances are consistent. For details, see Viewing Kafka Messages.

    • Yes: Go to 3.
    • No: Check whether the synchronized data per minute of both Kafka instances is normal. If yes, wait for the synchronization progress of both Kafka instances to be consistent, then go to 3.

  3. Change the Kafka connection addresses of the consumers to those of the new Kafka instance.
  4. Restart the consumption service so that consumers can consume messages from the new Kafka instance.
  5. Check whether consumers consume messages properly from the new Kafka instance.
  6. Change the Kafka connection address of the producer to that of the new Kafka instance.
  7. Restart the producer client to migrate the production service to the new Kafka instance.
  8. After the production service is migrated, check whether the consumption service connected to the new Kafka instance is normal.
  9. The migration is complete.

How Do I Migrate Persisted Data Along with Services?

You can migrate consumed data from the original instance to a new instance by using Smart Connect. This tool mirrors the original Kafka producer and consumer into new ones and migrates data to the new Kafka instance. For details, see Replicating Kafka Instance Data.

Note that each cloud Kafka instance stores data in three replicas. Therefore, the storage space of the new instance should be three times that of the original single-replica message storage.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback