Data is the most important asset for enterprises. TDengine provides complete backup, restoration, and disaster recovery mechanisms to ensure the safety and reliability of time-series data.
1. Backup and recovery overview
TDengine provides these data protection mechanisms:
| Mechanism | Description |
|---|---|
| Full backup | Full data backup |
| Incremental backup | Only backs up new data |
| Scheduled backup | Automatic periodic backup |
| Remote synchronization | Cross-region data replication |
2. Backup strategy configuration
2.1 Creating a backup
Use the following SQL commands to create backups:
BACKUP DATABASE db_name;creates a full backup.BACKUP DATABASE db_name TO '/path/to/backup';backs up to a specified path.
2.2 Automatic backup configuration
ALTER DATABASE db_name BUFFER 100 BUFFER 1 BUFFER 1; configures automatic database backup.
3. Recovery operations
3.1 Restoring from backup
RESTORE DATABASE db_name FROM '/path/to/backup';
3.2 Recovery notes
Before restoring, ensure sufficient storage space is available. The database is unavailable during the restoration process, so schedule recovery operations during a maintenance window.
4. Fault tolerance mechanisms
4.1 Multi-replica configuration
CREATE DATABASE demo REPLICA 3 VGROUPS 3;
SHOW dnode;
SHOW VGROUPS;
4.2 Automatic failover
TDengine supports automatic node fault detection, automatic re-election of the primary replica, and automatic data rebalancing. When a data node fails, the system handles failover without manual intervention.
5. Remote disaster recovery
5.1 Data synchronization architecture
The remote disaster recovery topology consists of a primary site (production environment) connected to a disaster recovery site (remote deployment) through real-time data synchronization.
5.2 Synchronization configuration
CREATE TOPIC topic_name AS SELECT * FROM db_name;
taosBenchmark -c config -y -B topic_name
Data Subscription (TMQ) enables real-time cross-region replication by publishing data changes to a topic and having the remote site consume those changes.
6. Disaster recovery drill
Regular disaster recovery drills should include these steps:
- Simulate a primary site failure.
- Verify data integrity after failover.
- Test failover procedures end to end.
- Record recovery time objectives and results.
Summary
- Develop backup strategies based on business requirements.
- Configure an appropriate number of replicas for high availability.
- Deploy remote disaster recovery for extreme situations.
- Conduct regular disaster recovery drills.


