CN-114201337-B - Backup method and related device
Abstract
The application provides a backup method, which comprises the steps that an object storage service (OBS) server obtains a first check value of a file to be uploaded and a path list of the object file to be matched from a database system, the OBS server obtains a second check value of the object file to be matched corresponding to the path list of the object file to be matched, and if the first check value is the same as the second check value, the OBS server copies the object file to be matched to a preset backup path. The application can reduce the data volume of backup uploading and improve the backup performance by comparing whether the content of the file to be uploaded is the same as that of the existing history file in the OBS server or not, thereby avoiding the repeated uploading of the file. Further, the files to be matched which are possibly identical are determined through the object file path list to be matched, the range of the matched files is reduced, and the backup efficiency is improved. Further, whether the files are identical is judged in a check value mode, file content reading is avoided, and backup efficiency and accuracy are improved. The application also provides a related device.
Inventors
- ZHANG CHENGWEI
- FU XUDONG
- REN BO
Assignees
- 华为云计算技术有限公司
- 华为云计算技术有限公司
Dates
- Publication Date
- 20260421
- Application Date
- 20200902
- Priority Date
- 20200902
Claims (13)
- 1. A backup method, comprising: The method comprises the steps that an object storage service (OBS) server obtains a first check value of a file to be uploaded and a path list of the object file to be matched from a database system; the OBS server acquires a second check value of the object file to be matched corresponding to the object file path list to be matched; If the first check value is the same as the second check value, the OBS server copies the object file to be matched to a preset backup path; If the first check value is different from the current second check value, the OBS server compares whether the first check value is the same as the next second check value; if the first check value is different from all the second check values, the OBS server returns first synthesis failure information to the database system, wherein the first synthesis failure information is used for indicating the database system to upload the file to be uploaded to the OBS server so that the OBS server copies the file to be uploaded to the preset backup path; if the OBS server fails to copy the object file to be matched to the preset backup path, the OBS server returns second synthesis failure information to the database system, wherein the second synthesis failure information is used for indicating the database system to upload the file to be uploaded to the OBS server, so that the OBS server copies the file to be uploaded to the preset backup path.
- 2. The method of claim 1, wherein after the OBS server returns the first composition failure information to the database system, the method further comprises: and the OBS server stores the file to be uploaded to the preset backup path.
- 3. The method according to claim 1 or 2, characterized in that the method further comprises: and the OBS server sends the preset backup path to a database system, so that the database system updates the file path list of the object to be matched according to the preset backup path.
- 4. A backup method, comprising: The method comprises the steps that a database system obtains a first check value of a file to be uploaded; The database system acquires a second check value of the object file to be matched corresponding to the object file path list to be matched from the OBS server; If the first check value is the same as the second check value, the database system sends indication information to the OBS server, wherein the indication information is used for indicating the OBS server to copy the object file to be matched corresponding to the second check value to a preset backup path; if the first check value is different from the current second check value, the database system compares whether the first check value is the same as the next second check value; If the first check value is different from all the second check values, the database system uploads the file to be uploaded to the OBS server so that the OBS server stores the file to be uploaded to the preset backup path; the database system acquires second synthesis failure information from the OBS server; And in response to the second synthesis failure information, the database system uploads the file to be uploaded to the OBS server, so that the OBS server copies the file to be uploaded to the preset backup path.
- 5. The method according to claim 4, wherein the method further comprises: The database system acquires the preset backup path from an OBS server; and the database system updates the object file path list to be matched according to the preset backup path.
- 6. A backup apparatus, comprising: The acquisition module is used for acquiring a first check value of the file to be uploaded and a path list of the object file to be matched from the database system; The acquisition module is further used for acquiring a second check value of the object file to be matched corresponding to the object file path list to be matched; The processing module is used for copying the object file to be matched to a preset backup path if the first check value is the same as the second check value; the processing module is further configured to compare whether the first check value is the same as the next second check value if the first check value is not the same as the current second check value; The processing module is further configured to return first synthesis failure information to the database system if the first check value is different from all the second check values, where the first synthesis failure information is used to instruct the database system to upload the file to be uploaded to the OBS server, so that the OBS server copies the file to be uploaded to the preset backup path; And the processing module is further configured to, if the OBS server fails to copy the object file to be matched to the preset backup path, return second synthesis failure information to the database system, where the second synthesis failure information is used to instruct the database system to upload the file to be uploaded to the OBS server, so that the OBS server copies the file to be uploaded to the preset backup path.
- 7. A backup apparatus according to claim 6, wherein, And the processing module is further used for storing the file to be uploaded to the preset backup path.
- 8. A backup apparatus according to claim 6 or 7, wherein, The processing module is further configured to send the preset backup path to a database system, so that the database system updates the path list of the object file to be matched according to the preset backup path.
- 9. A backup apparatus, comprising: the acquisition module is used for acquiring a first check value of the file to be uploaded; the acquiring module is further configured to acquire a second check value of the object file to be matched corresponding to the object file path list to be matched from the OBS server; The processing module is used for sending indication information to the OBS server if the first check value is the same as the second check value, wherein the indication information is used for indicating the OBS server to copy the object file to be matched corresponding to the second check value to a preset backup path; the processing module is further configured to compare whether the first check value is the same as the next second check value if the first check value is not the same as the current second check value; the processing module is further configured to upload the file to be uploaded to the OBS server if the first check value is different from all the second check values, so that the OBS server stores the file to be uploaded to the preset backup path; The acquiring module is further configured to acquire second synthesis failure information from the OBS server; And the processing module is further configured to upload the file to be uploaded to the OBS server in response to the second synthesis failure information, so that the OBS server copies the file to be uploaded to the preset backup path.
- 10. A backup apparatus according to claim 9, wherein, The acquisition module is further used for acquiring the preset backup path from the OBS server; And the processing module is further used for updating the object file path list to be matched according to the preset backup path.
- 11. An OBS server comprising a processor, a memory; the processor and the memory are communicated with each other; the memory is used for storing instructions; The processor is configured to execute the instructions in the memory and to perform the method of any one of claims 1 to 3.
- 12. A database system comprising a processor, a memory; the processor and the memory are communicated with each other; the memory is used for storing instructions; The processor is configured to execute the instructions in the memory to perform the method of any of claims 4 to 5.
- 13. A computer readable storage medium comprising instructions which, when run on a computer, cause the computer to perform the method of any one of claims 1 to 5.
Description
Backup method and related device Technical Field The embodiment of the application relates to the technical field of data backup, in particular to a backup method and a related device. Background In a database system, in order to cope with damage to data, it is necessary to specify an appropriate backup plan for the data, and store the data in a database for backup. The backup mode can be divided into a full backup mode and an incremental backup mode, wherein the full backup mode refers to that all data is backed up to a database, and the incremental backup mode refers to that the data is backed up compared with the data which is backed up in a history mode. Most of the current backup methods adopt a combination mode of 'full backup and incremental backup' to reduce the backup data volume, such as full backup once per week, and incremental backup is performed once per day. Therefore, the full-backup data volume can be effectively avoided, the data recovery performance is also considered, and the availability of the database system is ensured. However, the existing cloud databases bring about a significant increase in data with the increase in usage time, resulting in an increasing cost of regular full backups, and especially an increasing challenge of completing full backups within a specified time window. Disclosure of Invention The embodiment of the application provides a backup method and a related device, which can reduce the data volume uploaded by backup and improve the backup performance. In a first aspect, an embodiment of the present application provides a backup method, where an object storage service OBS server obtains a first check value of a file to be uploaded and a path list of an object file to be matched from a database system, the OBS server obtains a second check value of the object file to be matched corresponding to the path list of the object file to be matched, and if the first check value is the same as the second check value, the OBS server copies the object file to be matched to a preset backup path. The embodiment of the application can reduce the data volume uploaded by backup and improve the backup performance by comparing whether the content of the file to be uploaded is the same as that of the existing historical file in the OBS server or not, so that the repeated file uploading is avoided. Further, the files to be matched which are possibly identical are determined through the object file path list to be matched, the range of the matched files is reduced, and the backup efficiency is improved. Further, whether the files are identical is judged in a check value mode, file content reading is avoided, and backup efficiency and accuracy are improved. In combination with the first aspect, in an implementation manner of the embodiment of the present application, the method further includes that if the first check value is different from the current second check value, the OBS server compares whether the first check value is the same as the next second check value, and if the first check value is different from all the second check values, the OBS server returns first composition failure information to the database system, where the first composition failure information is used to instruct the database system to upload the file to be uploaded to the OBS server. With reference to the first aspect, in an implementation manner of the embodiment of the present application, after the OBS server returns the first synthesis failure information to the database system, the method further includes the OBS server saving the file to be uploaded to the preset backup path. With reference to the first aspect, in an implementation manner of the embodiment of the present application, the method further includes that the OBS server sends the preset backup path to a database system, so that the database system updates the object file path list to be matched according to the preset backup path. In combination with the first aspect, in an implementation manner of the embodiment of the present application, the method further includes, if the OBS server fails to copy the object file to be matched to a preset backup path, returning, by the OBS server, second synthesis failure information to the database system, where the second synthesis failure information is used to instruct the database system to upload the file to be uploaded to the OBS server. In a second aspect, an embodiment of the present application provides a backup method, where the database system obtains a first check value of a file to be uploaded, the database system obtains a second check value of a file to be matched corresponding to a path list of the file to be matched from an OBS server, and if the first check value is the same as the second check value, the database system sends indication information to the OBS server, where the indication information is used to instruct the OBS server to copy the file to be matched corresponding to t