Search

CN-122027477-A - Data recovery method and device, electronic equipment and storage medium

CN122027477ACN 122027477 ACN122027477 ACN 122027477ACN-122027477-A

Abstract

The disclosure relates to a data recovery method, a data recovery device, electronic equipment and a storage medium. And when the process of the virtual gateway proxy is restarted, acquiring first configuration information, responding to the first configuration information to indicate that the network configuration data is not fully synchronized from a remote server, detecting the availability of a local cache file, and responding to the determination that the local cache file meets the availability condition, and loading the network configuration data in the local cache file. Compared with the prior art, in the embodiment of the disclosure, the first configuration information is acquired when the process of the virtual gateway agent is restarted, and under the condition that the first configuration information indicates incomplete synchronization, efficient local recovery is preferentially tried to solve the problem of slow starting, and meanwhile, the starting performance of the virtual gateway agent can be improved, the data consistency is ensured, and the reliability is ensured through the preposed availability detection and the local loading recovery.

Inventors

  • WU JINGCHAO

Assignees

  • 北京金山云网络技术有限公司

Dates

Publication Date
20260512
Application Date
20260306

Claims (10)

  1. 1. A method of data recovery, for use with a virtual gateway proxy, the method comprising: When the process of the virtual gateway agent is restarted, acquiring first configuration information, wherein the first configuration information is used for indicating whether network configuration data are fully synchronized from a remote server; Detecting availability of a local cache file in response to the first configuration information indicating that network configuration data is not synchronized in full from a remote server; the local cache file is a persistent file which is positioned on a host computer where the virtual gateway agent is positioned and used for storing the network configuration data; loading network configuration data in the local cache file in response to determining that the local cache file meets an available condition; Or, responsive to the first configuration information indicating full synchronization, synchronizing network configuration data from the remote server.
  2. 2. The method of claim 1, wherein the obtaining the first configuration information comprises: acquiring a first configuration item in a local configuration file, wherein the first configuration item is used for statically configuring whether full synchronization is started or not; If the first configuration item indicates that full-scale synchronization is not started, inquiring a second configuration item in the local cache file through a remote procedure call interface, wherein the second configuration item is used for dynamically configuring whether full-scale synchronization is started or not; Before said synchronizing network configuration data from said remote server in full, said method further comprises: If either the first configuration item or the second configuration item indicates that full synchronization is enabled, determining that the first configuration information indicates that network configuration data is full synchronized from a remote server.
  3. 3. The method according to any one of claims 1 or 2, wherein said detecting availability of a locally cached file comprises: Checking whether a storage path of the local cache file exists; If the storage path exists, checking whether the current process of the virtual gateway agent has the authority of reading the local cache file; if the current process has the reading authority, reading the local cache file based on the storage path to obtain a reading result, wherein the reading result is used for indicating whether the local cache file exists or not; And in response to the reading result indicating that the local cache file exists, determining that the local cache file meets the available condition.
  4. 4. The method of claim 1, wherein said loading network configuration data in said local cache file comprises: opening the local cache file in a binary read mode; reading file content of the local cache file, and analyzing the file content into a preset structured data format; If the analysis is successful, the data in the preset structured data format obtained by the analysis is used as network configuration data to be loaded into the running memory of the virtual gateway proxy; if an abnormality occurs in the opening, reading or resolving process, determining that the network configuration data fails to be loaded, and recording an error log.
  5. 5. The method according to claim 1, wherein the method further comprises: In response to determining that the local cache file does not satisfy an availability condition, or in the event of a failure in loading of the network configuration data, a downgrade process is performed, the downgrade process being used to trigger full synchronization of network configuration data from the remote server.
  6. 6. The method according to claim 1, wherein the method further comprises: Responding to the network configuration data managed by the virtual gateway proxy to generate an update event, and serializing the updated network configuration data into data with a preset structured data format; storing the data in the preset structured data format into the local cache file through atomic write operation so as to update the local cache file; creating a copy with a time stamp for the local cache file, and storing the copy as a historical backup file.
  7. 7. The method of claim 5, wherein the performing a degradation process comprises: Returning a predefined empty cache data structure, wherein the empty cache data structure is used for indicating the operation of executing the data full synchronization, the empty cache data structure has the same top-level structure as non-empty cache data, the empty cache data structure contains a field associated with cache content, and the field is initialized to be a null value; and based on the empty cache data structure, synchronizing the total data in the remote server to the running memory of the virtual gateway agent to complete the recovery of the network configuration data.
  8. 8. A data recovery apparatus for use with a virtual gateway proxy, the apparatus comprising: the system comprises an acquisition module, a network configuration module and a virtual gateway proxy, wherein the acquisition module is used for acquiring first configuration information when the process of the virtual gateway proxy is restarted, and the first configuration information is used for indicating whether network configuration data are fully synchronized from a remote server; the detection module is used for responding to the first configuration information to indicate that the network configuration data is not synchronized in full quantity from a remote server, and detecting the availability of a local cache file, wherein the local cache file is a persistent file which is positioned on a host machine where the virtual gateway agent is positioned and used for storing the network configuration data; And the recovery module is used for loading network configuration data in the local cache file in response to determining that the local cache file meets the available condition, or triggering the network configuration data to be synchronized from the remote server in full amount in response to the first configuration information indicating full amount synchronization.
  9. 9. An electronic device, comprising: a memory; Processor, and A computer program; Wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method of any one of claims 1-7.
  10. 10. A computer readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the method according to any of claims 1-7.

Description

Data recovery method and device, electronic equipment and storage medium Technical Field The disclosure relates to the technical field of data recovery, and in particular relates to a data recovery method, a data recovery device, electronic equipment and a storage medium. Background In a cloud computing virtual network environment, a virtual gateway agent, as a key component connecting a control plane and a data plane, needs to manage massive network resource configuration data, such as a virtual private network, a virtual interface, a routing rule, and the like. To enhance access performance, the data typically has a primary copy stored in the remote server and a cached copy of the data is maintained in the local memory of the virtual gateway proxy. When the virtual gateway proxy process needs to be restarted due to upgrade, fault recovery or configuration change, the key problem of how to quickly recover the local cache data is faced. At present, the conventional treatment scheme has the following disadvantages: 1) Each time synchronized in full from the remote server. After the agent is restarted, the local state is discarded completely and all data is pulled back from the remote server. The scheme can ensure that the data is up to date, but has extremely poor starting performance, and particularly in a large-scale deployment environment, the synchronization process can take tens of minutes, consume a large amount of network bandwidth and increase server pressure. 2) Relying entirely on local caches forces recovery from local. And after the agent is restarted, unconditionally loading the cache data from the local disk file. The scheme has high starting speed, but has serious risks that data can be stale and outdated due to long-time non-synchronization, and if the local file is damaged or the format is incompatible, the proxy is started to fail or act abnormally. In summary, the prior art scheme has the problems of poor starting performance, difficult guarantee of data consistency and inflexible recovery strategy of local cache data. Disclosure of Invention In order to solve the technical problems, the present disclosure provides a data recovery method, a device, an electronic apparatus, and a storage medium. In a first aspect, an embodiment of the present disclosure provides a data recovery method applied to a virtual gateway proxy, where the method includes: When the process of the virtual gateway agent is restarted, acquiring first configuration information, wherein the first configuration information is used for indicating whether network configuration data are fully synchronized from a remote server; Detecting availability of a local cache file in response to the first configuration information indicating that network configuration data is not synchronized in full from a remote server; the local cache file is a persistent file which is positioned on a host computer where the virtual gateway agent is positioned and used for storing the network configuration data; loading network configuration data in the local cache file in response to determining that the local cache file meets an available condition; Or, responsive to the first configuration information indicating full synchronization, synchronizing network configuration data from the remote server. In some embodiments, the acquiring the first configuration information includes: acquiring a first configuration item in a local configuration file, wherein the first configuration item is used for statically configuring whether full synchronization is started or not; If the first configuration item indicates that full-scale synchronization is not started, inquiring a second configuration item in the local cache file through a remote procedure call interface, wherein the second configuration item is used for dynamically configuring whether full-scale synchronization is started or not; Before said synchronizing network configuration data from said remote server in full, said method further comprises: If either the first configuration item or the second configuration item indicates that full synchronization is enabled, determining that the first configuration information indicates that network configuration data is full synchronized from a remote server. In some embodiments, the detecting availability of the locally cached file includes: Checking whether a storage path of the local cache file exists; If the storage path exists, checking whether the current process of the virtual gateway agent has the authority of reading the local cache file; if the current process has the reading authority, reading the local cache file based on the storage path to obtain a reading result, wherein the reading result is used for indicating whether the local cache file exists or not; And in response to the reading result indicating that the local cache file exists, determining that the local cache file meets the available condition. In some embodiments, the loading the netw