Product Architecture and Function Principles
The following figure shows the product architecture and function principles of DRS.
Architecture Description
- Minimum permission design
- Java Database Connectivity (JDBC) is used to connect to the source and destination databases, so you do not have to deploy programs on the databases.
- A task runs on an independent and exclusively used VM. Data is isolated between tenants.
- The number of IP addresses is limited. Only the DRS instance IP address is allowed to access the source and destination databases.
- Reliability design
- Automatic reconnection: If the connection between DRS and your database breaks down due to bad network or database switchover, DRS automatically retries the connection until the task is restored.
- Resumable upload: When the connection between the source and the destination is abnormal, DRS automatically marks the current replay point. After the fault is rectified, you can resume data transfer from the replay point to ensure data consistency.
- If the VM where the DRS replication instance is located fails, services are automatically switched to a new VM with the IP address unchanged to ensure that the migration task is not interrupted.
Principles of Real-Time Migration
- Take the full+incremental migration as an example. A complete migration process includes four phases.
- Phase 1: Structure migration. DRS queries the databases, tables, primary keys, and indexes to be migrated from the source and creates corresponding objects in the destination.
- Phase 2: Full data migration. DRS uses the parallel technology to query all data from the source and inserts the data into the destination, which is fast and convenient. Before the full migration is started, incremental data is extracted and saved in advance to ensure data integrity and consistency in the subsequent incremental migration process.
- Phase 3: Incremental data migration. After the full migration task is complete, the incremental migration task is started. The incremental data generated after the start of the full migration is continuously parsed, converted, and replayed to the destination database until data is in sync between the source and destination databases.
- Phase 4: To prevent data from being operated by triggers and events during the migration, triggers and events will be migrated after a migration task is complete.
- Principles of the underlying module for full synchronization:
Sharding module: calculates the sharding logic of each table using the optimized sharding algorithm.
Extraction module: queries data from the source database in parallel mode based on the calculated shard information.
Replay module: inserts the data queried by the extraction module into the destination database in parallel and multi-task mode.
- Principles of the underlying module for incremental synchronization:
Log reading module: reads the original incremental log data (for example, binlog for MySQL) from the source database, parses the data, converts the data into the standard log format, and stores it locally.
Log replay module: processes and filters incremental logs based on the standard format converted by the log reading module, and synchronizes the incremental data to the destination database.
Basic Principles of Backup Migration
DRS allows you to migrate data from a Microsoft SQL Server database to the cloud using the backup file of the database. You can copy the full and incremental backup files of the source database to an OBS bucket. DRS downloads that files from the bucket and uploads them to the disk of the destination database. After the pre-check and verification are complete, DRS runs the import command to restore the data to the destination database.
Principles of Real-Time Synchronization
Real-time synchronization can ensure that data is always in sync between the source and destination databases. It mainly applies to synchronization from OLTP to OLAP or from OLTP to big data components in real time. The technical principles of full|+incremental synchronization and real-time migration are basically the same. However, there is a slight difference between them in different scenarios.
- DRS supports heterogeneous synchronization (between different DB engines). It means that DRS converts the structure definition statements of the source database to match that of the destination database. In addition, DRS can map and convert database field types. You can refer to Mapping Data Types of heterogeneous databases or use Database and Application Migration UGO (UGO) to synchronize the structure of heterogeneous databases.
- DRS allows you to configure data processing rules, so you can use these rules to extract, parse, and replay data to meet your service requirements.
- Objects such as accounts, triggers, and events cannot be synchronized.
- Real-time synchronization is often used in many-to-one scenario. DDL operations in many-to-one and one-to-many scenarios are specially processed.
Basic Principles of Data Subscription
Data subscription provides an SDK so that customers' service programs can obtain incremental data from the source database in real time.
DRS extracts original incremental logs from the source database, parses the logs into the standard format, and persists the logs to the local host. In addition, DRS invokes the notification interface of the client subscription SDK in real time to push incremental data to the client service program. Then, the client can consume data changes based on service requirements.
The incremental data consumed by the client program is recorded on the server in real time. The DRS server can continues to push incremental data from the last consumption position in scenarios such as service interruption and reconnection.
Principles of Real-Time Disaster Recovery
DRS uses the real-time replication technology to implement disaster recovery for two databases. The underlying technical principles are the same as those of real-time migration. The difference is that real-time DR supports forward synchronization and backward synchronization. In addition, disaster recovery is performed on the instance-level, which means that databases and tables cannot be selected.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.