CN113535469B - Switching method and switching system for disaster recovery database - Google Patents

Switching method and switching system for disaster recovery database Download PDF

Info

Publication number
CN113535469B
CN113535469B CN202110620990.9A CN202110620990A CN113535469B CN 113535469 B CN113535469 B CN 113535469B CN 202110620990 A CN202110620990 A CN 202110620990A CN 113535469 B CN113535469 B CN 113535469B
Authority
CN
China
Prior art keywords
data
connection
connection request
database
switching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110620990.9A
Other languages
Chinese (zh)
Other versions
CN113535469A (en
Inventor
霍钊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Si Tech Information Technology Co Ltd
Original Assignee
Beijing Si Tech Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Si Tech Information Technology Co Ltd filed Critical Beijing Si Tech Information Technology Co Ltd
Priority to CN202110620990.9A priority Critical patent/CN113535469B/en
Publication of CN113535469A publication Critical patent/CN113535469A/en
Application granted granted Critical
Publication of CN113535469B publication Critical patent/CN113535469B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1479Generic software techniques for error detection or fault masking

Abstract

The invention discloses a switching method and a switching system of disaster recovery databases, belonging to the technical field of database management, wherein the switching method comprises the following steps: intercepting a connection request when the disaster recovery database is switched; judging whether the connection request has the risk of data loss or not; if yes, returning interception information to a sender of the connection request; if not, the connection request is forwarded to the enabled database. By intercepting and analyzing the connection request, when the risk of data loss exists, interception information is returned to the sender of the connection request, so that wrong connection and wrong data are avoided, and the use experience is improved; and for normal connection requests without data loss risk, normal processing is performed, so that continuity of database services is ensured.

Description

Switching method and switching system for disaster recovery database
Technical Field
The invention relates to the technical field of database management, in particular to a method and a system for switching disaster recovery databases.
Background
To ensure continuity of the business, a main database (production database) and a backup database (disaster backup database) are generally provided. The problem of production continuity is solved through the disaster recovery database, when the production database fails, the process is continued by switching to the disaster recovery database, and the disaster recovery database is usually replicated with the production database in real time. To improve the robustness of the system, the production database and disaster recovery database are typically located remotely.
However, in the prior art, the replication of disaster recovery databases and production data is completed through an application layer protocol, so that the efficiency is generally low, the phenomenon of synchronous delay exists, and the delay time is different from a few minutes to tens of minutes. Therefore, during the switching process, the disaster recovery database is caused to lose the data in the delay time, and the part of data is resynchronized when the next production database is recovered. This results in lost data within the delay time not being accessible or modifiable, causing anomalies in the traffic, such as incorrect traffic or repeated acceptance. The business anomaly further causes a large number of maintenance problems such as complaints, data auditing, exception handling and the like, so that the service level is reduced, the experience is reduced, and the operation and maintenance cost is increased.
Disclosure of Invention
Aiming at the technical problems in the prior art, the invention provides a method and a system for switching disaster recovery databases, which return interception information to a sender of a connection request when data loss is at risk, so that wrong connection and wrong data are avoided, and the use experience is improved.
The invention discloses a switching method of disaster recovery databases, which comprises the following steps: intercepting a connection request when the disaster recovery database is switched; judging whether the connection request has the risk of data loss or not; if yes, returning interception information to a sender of the connection request; if not, the connection request is forwarded to the enabled database.
Preferably, the analysis method of the data loss risk comprises the following steps:
acquiring historical connection;
establishing analysis data according to historical connection, wherein the analysis data comprises connection data corresponding to the connection request in a certain time;
judging whether the time difference between the switching of the disaster recovery database and the last corresponding connection data is smaller than a first threshold value, wherein the first threshold value is larger than or equal to the synchronous time delay of the disaster recovery database;
if the time difference is less than the first threshold, the data is at risk of loss.
Preferably, the last connection data is of a modified data type.
Preferably, the method for establishing analysis data according to the historical connection comprises the following steps:
establishing an analysis data list, and analyzing historical connection by key values;
judging whether the current historical connection has a corresponding record in the analysis data list or not;
if there is a record, the timestamp of the record is updated.
If no record exists, a new record is added and a time stamp is saved.
Preferably, the key comprises any one or a combination of the following dimensions: a user name, an account, a user ID, and a cell phone number.
Preferably, the connection request includes a transaction request, and the switching method includes:
obtaining a user ID according to the intercepted connection request;
matching the user ID with the user ID of the analysis data;
if the matching is successful, judging whether the time difference between the switching of the disaster recovery database and the last corresponding connection data is smaller than a first threshold value;
if the time difference is smaller than a first threshold value, the data is at risk of losing, and interception information is sent to a requester;
if the time difference is greater than or equal to a first threshold, forwarding the connection request to the enabled database;
if the match is unsuccessful, the connection request is forwarded to the enabled database.
The invention also provides a switching system for realizing the disaster recovery database switching method, which comprises an interception module and a risk assessment module,
the interception module is used for intercepting a connection request when the disaster recovery database is switched;
the risk assessment module is used for judging whether the connection request has the risk of data loss or not; if yes, returning interception information to a sender of the connection request; if not, the connection request is forwarded to the enabled database.
Preferably, the switching system further comprises a gateway and a service management module, wherein the interception module is arranged in the gateway, and the service management module is used for managing the production database and the disaster recovery database.
Preferably, the switching system further comprises an acquisition module and a connection analysis module,
the acquisition module is arranged in the service management module and is used for acquiring historical connection;
the connection analysis module is used for establishing analysis data according to historical connection;
the risk assessment module is used for analyzing the risk of data loss according to the time difference between the switching of the disaster backup database and the last connection data.
Preferably, the analysis data in a certain time is loaded into the cache, and when the time difference between the disaster recovery database switching and the last time of data connection in the cache is smaller than a first threshold value, the data is at risk of losing.
Compared with the prior art, the invention has the beneficial effects that: by intercepting and analyzing the connection request, when the risk of data loss exists, interception information is returned to the sender of the connection request, so that wrong connection and wrong data are avoided, and the use experience is improved; and for normal connection requests without data loss risk, normal processing is performed, so that continuity of database services is ensured.
Drawings
FIG. 1 is a flow chart of a method for switching disaster recovery databases of the present invention;
FIG. 2 is a flow chart of a method of analyzing risk of data loss;
FIG. 3 is a logic block diagram of analysis of risk of data loss;
FIG. 4 is a flow chart of a method of creating analytical data;
fig. 5 is a logical block diagram of the switching system of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The invention is described in further detail below with reference to the attached drawing figures:
as shown in fig. 1, a method for switching disaster recovery databases includes:
step 101: and intercepting the connection request when the disaster recovery database is switched. The disaster recovery database switching refers to switching the production database to the disaster recovery database or switching the disaster recovery database to the production database.
Step 102: and judging whether the connection request has the risk of data loss or not.
If yes, go to step 103: and returning interception information to the sender of the connection request. The interception information alerts the sender of the connection request, e.g., alerts that there may be an anomaly in the data, recommends that access be continued for an extended period of time, etc.
If not, go to step 104: the connection request is forwarded to the enabled database.
By intercepting and analyzing the connection request, when the risk of data loss exists, interception information is returned to the sender of the connection request, so that wrong connection and wrong data are avoided, and the use experience is improved; and for normal connection requests without data loss risk, normal processing is performed, so that continuity of database services is ensured.
As shown in fig. 2 and 3, in step 102, the method for analyzing the risk of data loss includes:
step 201: a historical connection is obtained. In a specific embodiment, a service management module is configured to receive the connection request, manage the production database and the disaster recovery database, and collect the historical connection when the service management module receives and processes the connection request. Wherein, the history connection refers to the connection request processed by the service management module.
Step 202: and establishing analysis data according to the historical connection, wherein the analysis data comprises connection data corresponding to the connection request in a certain time. For example, connection data within 1 hour, corresponding connection data refers to connection data employed in connection requests, for example, connection requests for querying or modifying the connection data.
Step 203: and judging whether the time difference between the switching of the disaster recovery database and the last corresponding connection data is smaller than a first threshold value, wherein the first threshold value is larger than the switching time delay of the disaster recovery database. In a specific embodiment, the synchronization time delay is 10 minutes, the first threshold is set to 30 minutes, that is, when the time difference between the last corresponding connection data and the disaster recovery database is less than 30 minutes, the risk of data loss is judged; and when the time difference is greater than 30 minutes, judging that the connection is normal.
If the threshold value is smaller than the first threshold value, step 204 is executed: judging that the data has a loss risk.
If the threshold is greater than or equal to the first threshold, step 205 is executed: and judging that the data has no loss risk.
The switching time delay comprises synchronous delay of the disaster recovery database and the production database. In step 203, the type of the connection data may be determined, where the last corresponding connection data is modified data, such as data addition, modification, and deletion; the connection data of the query class can not have substantial influence on the data in the database, so that the query class can still be normally accessed.
In step 202, a method for establishing analysis data according to a historical connection may include:
step 221: and the key value is used for analyzing the connection request and recording according to the time of the connection request to obtain statistical data.
Step 222: and obtaining analysis data in a certain time from the statistical data.
But is not limited thereto, as shown in fig. 4, the analysis data may also be established by:
step 231: and establishing an analysis data list, and analyzing the historical connection by using the key value. In a particular embodiment, the key value is any one of the following dimensions or a combination thereof: the user name, account, user ID and mobile phone number, the connection request may be a transaction request, i.e. the method of the invention may be applied in a transaction system. In a particular embodiment, historical connections are collected from a traffic management module.
Step 232: and judging whether the current historical connection has a corresponding record in the analysis data list.
If there is a record, go to step 233: updating the recorded time stamp.
If no record exists, step 234 is performed: a new record is added and a timestamp is saved.
Thereby updating the analysis data list in real time.
The invention also provides a switching system for realizing the disaster recovery database switching method, as shown in fig. 5, comprising an interception module 11 and a risk assessment module 12,
the interception module 11 is used for intercepting a connection request when the disaster recovery database is switched;
the risk assessment module 12 is configured to determine whether the connection request is at risk of data loss; if yes, returning interception information to a sender of the connection request; if not, the connection request is forwarded to the enabled database.
The switching system of the invention also comprises a gateway 1 and a service management module 2, wherein the interception module 11 is arranged in the gateway 1, and the service management module 2 is used for managing a production database 21 and a disaster recovery database 22. The service management module 2 is further internally provided with an acquisition module 23, the acquisition module is used for acquiring historical connection, namely, a connection request processed by the service management module is sent to the connection analysis module 3, the connection analysis module 3 is used for establishing analysis data 31 according to the historical connection, and the analysis data 31 comprise connection data within a certain time. The risk assessment module 12 is configured to analyze the risk of data loss according to the time difference between the switching of the disaster recovery database and the last connection of the data. In a specific embodiment, a matching rule is established according to the analysis data and the disaster recovery database switching time point, the connection request is matched with the matching rule, and when the connection request meets the matching rule, the risk of data loss is judged.
The analysis data or the matching rule can be loaded into the cache, and the risk of data loss is analyzed according to the time difference between the switching of the disaster backup database and the last connection data of the cache.
Examples
Taking telecommunication service as an example and taking user ID as a key value, when processing a transaction request, the switching method comprises the following steps:
step 301: intercept the connection request and obtain the user ID from the connection request.
Step 302: and matching the user ID with the user ID of the analysis data. The analysis data is user transaction data within a certain time (such as 1 hour), including user ID, transaction time and transaction type.
If the match is successful, step 303 is executed: and judging whether the time difference between the switching of the disaster recovery database and the last corresponding connection data (namely the last transaction of the user) is smaller than a first threshold value.
If the threshold value is smaller than the first threshold value, step 304 is executed: the data is at risk of loss and the interception information is sent to the requesting party.
If the time difference is greater than or equal to the first threshold, step 305 is executed: the connection request is forwarded to the enabled database. In a particular embodiment, the connection request is sent to a service management module, which distributes the connection request to the enabled database.
If the match is unsuccessful, step 305 is performed.
A business system carrying 3000 thousands of users has a daily transaction amount of about 1000 thousands of users and is mainly concentrated in 8 hours in the daytime. In this scenario, the service system calculates according to the switching delay of 10 minutes during the disaster recovery switching process, and the service volume is about 20 tens of thousands of in 10 minutes, wherein about 2W (10%) of the non-query class of the transaction affects the normal transaction demand of about 2W users. The auditing and processing of these anomaly data takes at least about 3 days to complete, and requires significant customer service and maintenance personnel.
After analysis and interception are performed by the method of the embodiment, user services within 10s to 1 minute can be accurately calculated, more than 90% of users can be accurately positioned and tracked, and service interception limiting and interception reminding can be performed in advance. User satisfaction is improved, and workload of system background maintenance processing is reduced.
The connection analysis module 3 may be deployed in an analysis cluster, and the production database and the disaster recovery database are deployed in an ESB cluster.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (9)

1. The switching method of the disaster recovery database is characterized by comprising the following steps:
intercepting a connection request when the disaster recovery database is switched;
judging whether the connection request has the risk of data loss or not;
if yes, returning interception information to a sender of the connection request;
if not, forwarding the connection request to the enabled database;
the analysis method of the data loss risk comprises the following steps:
acquiring historical connection;
establishing analysis data according to historical connection, wherein the analysis data comprises connection data corresponding to the connection request in a certain time;
judging whether the time difference between the switching of the disaster recovery database and the last connection data is smaller than a first threshold value, wherein the first threshold value is larger than or equal to the synchronous time delay of the disaster recovery database;
if the time difference is smaller than the first threshold value, the data is at risk of losing;
if the data is greater than or equal to the first threshold, the data is not at risk of loss.
2. The handover method according to claim 1, wherein the type of the last connection data is modification data.
3. The handover method according to claim 1, wherein the method of establishing analysis data based on the historical connection comprises:
establishing an analysis data list, and analyzing historical connection by key values;
judging whether the current historical connection has a corresponding record in the analysis data list or not;
if a record exists, updating the time stamp of the record;
if no record exists, a new record is added and a time stamp is saved.
4. A switching method according to claim 3, wherein the key value comprises any one or a combination of the following dimensions: a user name, an account, a user ID, and a cell phone number.
5. The method of switching according to claim 4, wherein the connection request comprises a transaction request, the method comprising:
obtaining a user ID from the intercepted connection request;
matching the user ID with the user ID of the analysis data;
if the matching is successful, judging whether the time difference between the switching of the disaster recovery database and the last corresponding connection data is smaller than a first threshold value;
if the time difference is smaller than a first threshold value, the data is at risk of losing, and interception information is sent to a requester;
if the time difference is greater than or equal to a first threshold, forwarding the connection request to the enabled database;
if the match is unsuccessful, the connection request is forwarded to the enabled database.
6. A switching system for implementing the disaster recovery database switching method as claimed in any one of claims 1-5, comprising an interception module and a risk assessment module,
the interception module is used for intercepting a connection request when the disaster recovery database is switched;
the risk assessment module is used for judging whether the connection request has the risk of data loss or not; if yes, returning interception information to a sender of the connection request; if not, the connection request is forwarded to the enabled database.
7. The switching system of claim 6, further comprising a gateway and a service management module, the interception module disposed within the gateway, the service management module configured to manage the production database and the disaster recovery database.
8. The switching system of claim 7, further comprising an acquisition module and a connection analysis module,
the acquisition module is arranged in the service management module and is used for acquiring historical connection;
the connection analysis module is used for establishing analysis data according to historical connection;
the risk assessment module is used for analyzing the risk of data loss according to the time difference between the switching of the disaster backup database and the last connection data.
9. The switching system according to claim 8, wherein the analysis data is loaded into the buffer for a certain period of time, and the data is at risk of being lost when a time difference between the switching of the disaster recovery database and the last time the data was connected to the buffer is smaller than a first threshold value.
CN202110620990.9A 2021-06-03 2021-06-03 Switching method and switching system for disaster recovery database Active CN113535469B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110620990.9A CN113535469B (en) 2021-06-03 2021-06-03 Switching method and switching system for disaster recovery database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110620990.9A CN113535469B (en) 2021-06-03 2021-06-03 Switching method and switching system for disaster recovery database

Publications (2)

Publication Number Publication Date
CN113535469A CN113535469A (en) 2021-10-22
CN113535469B true CN113535469B (en) 2024-01-30

Family

ID=78095543

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110620990.9A Active CN113535469B (en) 2021-06-03 2021-06-03 Switching method and switching system for disaster recovery database

Country Status (1)

Country Link
CN (1) CN113535469B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105938490A (en) * 2016-04-14 2016-09-14 北京思特奇信息技术股份有限公司 Intelligent switching method and system for connecting web application system with data source
WO2018001061A1 (en) * 2016-06-28 2018-01-04 中国银联股份有限公司 Method, device and terminal for reducing system switching unavailable time of disaster recovery center
CN109117310A (en) * 2018-08-08 2019-01-01 中国建设银行股份有限公司 Realize disaster tolerance system, the method and device of data backup
CN109635039A (en) * 2018-11-23 2019-04-16 金色熊猫有限公司 Multiple data centers method of data synchronization and system
CN111506649A (en) * 2020-04-10 2020-08-07 深圳前海微众银行股份有限公司 Transaction data disaster tolerance switching method and device, computing device and storage medium
CN112817795A (en) * 2021-01-30 2021-05-18 北京奇保信安科技有限公司 Interface level database disaster recovery method and device and electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8301593B2 (en) * 2008-06-12 2012-10-30 Gravic, Inc. Mixed mode synchronous and asynchronous replication system
CN101414277B (en) * 2008-11-06 2010-06-09 清华大学 Need-based increment recovery disaster-tolerable system and method based on virtual machine

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105938490A (en) * 2016-04-14 2016-09-14 北京思特奇信息技术股份有限公司 Intelligent switching method and system for connecting web application system with data source
WO2018001061A1 (en) * 2016-06-28 2018-01-04 中国银联股份有限公司 Method, device and terminal for reducing system switching unavailable time of disaster recovery center
CN109117310A (en) * 2018-08-08 2019-01-01 中国建设银行股份有限公司 Realize disaster tolerance system, the method and device of data backup
CN109635039A (en) * 2018-11-23 2019-04-16 金色熊猫有限公司 Multiple data centers method of data synchronization and system
CN111506649A (en) * 2020-04-10 2020-08-07 深圳前海微众银行股份有限公司 Transaction data disaster tolerance switching method and device, computing device and storage medium
CN112817795A (en) * 2021-01-30 2021-05-18 北京奇保信安科技有限公司 Interface level database disaster recovery method and device and electronic equipment

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
A brief analysis of the disaster recovery backup technology in Oracle database DataGuard;Xiu-ju Liu;《2010 2nd International Conference on Industrial and Information Systems》;第234-236页 *
大连台电视播控系统中的数据库应用与维护;谭峰;孔冰;;《电视技术》;第39卷(第04期);第64-68页 *
文件级持续数据保护系统的设计与实现;杨宗博;《中国优秀硕士学位论文全文数据库 信息科技辑》(第3期);I138-72 *
证券行业灾难备份与恢复系统的设计与实现;孙滨;《中国优秀硕士学位论文全文数据库 信息科技辑》(第11期);I138-26 *

Also Published As

Publication number Publication date
CN113535469A (en) 2021-10-22

Similar Documents

Publication Publication Date Title
CN110765091B (en) Account checking method and system
US8559607B2 (en) Network assurance analytic system
US6970945B1 (en) Systems and methods of message queuing
US20070124437A1 (en) Method and system for real-time collection of log data from distributed network components
CN109146653B (en) Distributed environment-based accounting daily cutting checking method and device
CN112434039A (en) Data storage method, device, storage medium and electronic device
CN111352759A (en) Alarm root cause judgment method and device
CN108647357A (en) The method and device of data query
CN114048217A (en) Incremental data synchronization method and device, electronic equipment and storage medium
CN112579603A (en) CDC-based data model dynamic information perception monitoring method and device
CN110727563A (en) Cloud service alarm method and device for preset customer
CN113535469B (en) Switching method and switching system for disaster recovery database
CN110196868A (en) Based on distributed work order flow monitoring method
CN110659271B (en) Data deletion optimization method and terminal
CN110502529B (en) Data processing method, device, server and storage medium
CN111813833B (en) Real-time two-degree communication relation data mining method
CN111404737B (en) Disaster recovery processing method and related device
CN115033578A (en) Method for updating service data, related device and storage medium
CN105205168A (en) Exposure system based on Redis database and operation method thereof
CN113472469B (en) Data synchronization method, device, equipment and storage medium
CN114637786B (en) Off-line calculation method for vehicle working hours and storage medium
CN115134213B (en) Disaster recovery method, device, equipment and storage medium
CN112035458B (en) Data isolation method, device and equipment
CN116703184B (en) Data processing method, data processing device, electronic equipment and readable storage medium
CN110191026B (en) Distributed service link monitoring method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant