CN110489397A - Date storage method, apparatus and system - Google Patents

Date storage method, apparatus and system Download PDF

Info

Publication number
CN110489397A
CN110489397A CN201910742533.XA CN201910742533A CN110489397A CN 110489397 A CN110489397 A CN 110489397A CN 201910742533 A CN201910742533 A CN 201910742533A CN 110489397 A CN110489397 A CN 110489397A
Authority
CN
China
Prior art keywords
server
database server
application server
data
application
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.)
Pending
Application number
CN201910742533.XA
Other languages
Chinese (zh)
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.)
SHANGHAI FITSCO INTELLIGENT TRAFFIC CONTROL CO Ltd
Original Assignee
SHANGHAI FITSCO INTELLIGENT TRAFFIC CONTROL 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 SHANGHAI FITSCO INTELLIGENT TRAFFIC CONTROL CO Ltd filed Critical SHANGHAI FITSCO INTELLIGENT TRAFFIC CONTROL CO Ltd
Priority to CN201910742533.XA priority Critical patent/CN110489397A/en
Publication of CN110489397A publication Critical patent/CN110489397A/en
Pending legal-status Critical Current

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/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1461Backup scheduling policy
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/217Database tuning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This application provides a kind of date storage methods, apparatus and system, wherein the data method includes: that target data is stored in the associated main database server of the first application server;Obtain the operating status of first application server and the associated standby database server of first application server;Judge whether first application server and the operating status of the standby database server meet storage condition;If the operating status of first application server or the standby database server meets the storage condition, the target data is stored in the standby database server.

Description

Date storage method, apparatus and system
Technical field
This application involves technical field of data storage, in particular to a kind of date storage method, apparatus and system.
Background technique
Currently, operation error or the system failure occur for anti-locking system leads to loss of data, the superfluous of data generally will do it Remaining backup.Existing mainly to use: 1. cold standbies, also referred to as offline backup refer to and are closing database and database not The database full backup carried out under the situation that can be updated;2. network backup, standby by handling logic progress in data lab setting Part.But above-mentioned backup mode may will affect the work of database.
Summary of the invention
In view of this, the embodiment of the present application is designed to provide a kind of date storage method, apparatus and system.
In a first aspect, the embodiment of the present application provides a kind of date storage method, it is applied to the first application server, packet It includes:
Target data is stored in the associated main database server of the first application server;
Obtain the operation of first application server and the associated standby database server of first application server State;
Judge whether first application server and the operating status of the standby database server meet storage condition;
If the operating status of first application server or the standby database server meets the storage condition, The target data is stored in the standby database server.
Data storage provided by the embodiments of the present application, by the way of application server Initiative Inventory Management, does not need database Server carries out back-up processing, needs database server to carry out back-up processing or database stopping work in the prior art The mode of work, which backs up, to be compared, the embodiment of the present application by application server actively by target data be stored in main database server and Standby database server, then do not need main database server and carry out data backup processing again, can reduce the processing of database Work;In addition, in target data before standby database server storage, also to the first application server or standby database server Operating status judged, the operating status of the first application server or standby database server is considered, is realized The equilibrium of first application server or standby database server operating status.
With reference to first aspect, the embodiment of the present application provides the first possible embodiment of first aspect, in which: institute It states and the step of whether operating status of first application server and the standby database server meets storage condition is judged, Include:
Judge whether the operating status of first application server is in overload status;
Judge whether the operating status of the standby database server is in overload status;
When the operating status of first application server is in the fortune of overload status or the standby database server When row state is in overload status, it is judged to being unsatisfactory for storage condition.
Further, date storage method provided by the embodiments of the present application, it is contemplated that application server and standby database service The loading condition of device realizes application server and standby database server load balancing, is not influencing application server and standby In the case that database server works, thus the stability of the application server and standby database server that improve.
With reference to first aspect, the embodiment of the present application provides second of possible embodiment of first aspect, in which: institute State method further include:
Judge whether the target delay time of the target data is greater than to be stored in the setting of the standby database server and prolong The slow time;
When the target delay time is more than the setting delay time, then by the target data deposit standby number According in the server of library.
Further, date storage method provided by the embodiments of the present application, the target data that can also be backed up to needs are prolonged When the time judged, be directly stored in standby database server to relatively long data are postponed, to reduce target data The backup delay time occur very much abnormal situation so as to cause data long.
With reference to first aspect, the embodiment of the present application provides the third possible embodiment of first aspect, in which: institute State method further include:
Judge whether the target data is preset data type;
When the target data is the preset data type, then matched according to the data type of the target data Storage rule the target data is stored in the standby database server.
Further, date storage method provided by the embodiments of the present application, can also be according to the Different matching of data type not Same data storage method, so that the differentiated processing for the data that needs back up is realized, so that the data storage side of the present embodiment Method applicability is higher.
The third possible embodiment with reference to first aspect, the embodiment of the present application provide first aspect second can The embodiment of energy, in which: the preset data type includes the data type of multiple and different ranks, the data of different stage Type corresponds to the storage priority of different stage, and the matched storage rule of the data type according to the target data is by institute State the step that target data is stored in the standby database server, comprising:
Obtain the corresponding storage priority of data type of the target data;
The target data is stored in the standby database service according to the corresponding time rule of the storage priority In device.
Further, date storage method provided by the embodiments of the present application, the data of each type correspond to different ranks, from And realize the important of data and secondary important division, it is stored to ensure that the data of important data type are limited, to mention The freedom degree of high different data storage.
Second aspect, the embodiment of the present application also provide a kind of date storage method, are applied to data-storage system, the number It include the first application server, the second application server, first database server, the second database service according to storage system Device, the first database server are the main database server of first application server, for the second application clothes The standby database server of business device, second database server are the primary database service of second application server Device is the standby database server of first application server, comprising:
First object data are stored in the first database server by first application server;
First application server obtains the operation of first application server and second database server State;
It is described when the operating status of first application server or second database server meets storage condition The first object data are stored in second database server by the first application server;
Second target data is stored in second database server by second application server;
Second application server obtains the operation of second application server and the first database server State;
It is described when the operating status of second application server or the first database server meets storage condition Second target data is stored in the first database server by the second application server.
The third aspect, the embodiment of the present application also provide a kind of data storage device, are applied to the first application server, packet It includes:
First memory module, for target data to be stored in the associated primary database service of first application server Device;
Module is obtained, for obtaining first application server and the associated standby database of first application server The operating status of server;
Judgment module, for judge first application server or the standby database server operating status whether Meet storage condition;
Second memory module, if full for the operating status of first application server or the standby database server The target data is then stored in the standby database server by sufficient storage condition.
Fourth aspect, the embodiment of the present application also provide a kind of application server, comprising: processor, memory and bus, institute State memory and be stored with the executable computer program of the processor, when electronic equipment operation, the processor with it is described By bus communication between memory, execute when the computer program is executed by the processor in a first aspect, or first party The step of method in any possible embodiment in face.
5th aspect, the embodiment of the present application also provide a kind of data-storage system, and data-storage system includes the first application Server, the second application server, first database server, the second database server, the first database server It is the standby database server of second application server, institute for the main database server of first application server The main database server that the second database server is second application server is stated, is first application server Standby database server;
First application server is used for:
First object data are stored in the first database server;
Obtain the operating status of first application server and second database server;
It is described when the operating status of first application server or second database server meets storage condition The first object data are stored in second database server by the first application server;
Second application server is used for:
Second target data is stored in second database server;
Obtain the operating status of second application server and the first database server;
When the operating status of second application server or the first database server meets storage condition, then Second target data is stored in the first database server.
In conjunction with the 5th aspect, the embodiment of the present application provides the first possible embodiment of the 5th aspect, in which: institute Stating data-storage system further includes disk array, the data of the first database server and second database server It is stored on the disk array.
Further, data-storage system provided by the embodiments of the present application, by first database server and the second database Server connects a disk array, can also can be realized depositing for multiple database server in the case where saving hardware resource Storage mode.
To enable the above objects, features, and advantages of the application to be clearer and more comprehensible, special embodiment below, and appended by cooperation Attached drawing is described in detail below.
Detailed description of the invention
Technical solution in ord to more clearly illustrate embodiments of the present application, below will be to needed in the embodiment attached Figure is briefly described, it should be understood that the following drawings illustrates only some embodiments of the application, therefore is not construed as pair The restriction of range for those of ordinary skill in the art without creative efforts, can also be according to this A little attached drawings obtain other relevant attached drawings.
Fig. 1 is the schematic diagram that data-storage system provided by the embodiments of the present application interacts.
Fig. 2 is the block diagram of server provided by the embodiments of the present application.
Fig. 3 is the flow chart of date storage method provided by the embodiments of the present application.
Fig. 4 is the functional block diagram of data storage device provided by the embodiments of the present application.
Fig. 5 is the flow chart for the date storage method that another embodiment of the application provides.
Specific embodiment
Below in conjunction with attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application is described.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi It is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Meanwhile the application's In description, term " first ", " second " etc. are only used for distinguishing description, are not understood to indicate or imply relative importance.
Embodiment one
For convenient for understanding the present embodiment, first to executing a kind of data storage side disclosed in the embodiment of the present application The running environment and server of method describe in detail.
As shown in Figure 1, being the schematic diagram that data-storage system provided by the embodiments of the present application interacts.In the present embodiment Data-storage system include: that multiple application servers 100 (only show two application servers, are the first application respectively in figure Server 110 and the second application server 120), multiple database servers 200 corresponding with application server 100 (in figure only Two database servers are shown, are first database server 210 and the second database server 220 respectively).The application Server 100 is communicatively coupled by network with multiple database servers 200, to carry out data communication or interaction.
Each application server 100 configures at least two database servers, respectively as main database server and standby Database server.In an optional embodiment, database server can be with cross-reference, optional manifestation mode Are as follows: the main database server that one application server 100 configures is also possible to the standby database clothes of other application server 100 Business device, the standby database server of one application server 100 can be used as the primary database service of other application server 100 Device.In an example, as shown in Figure 1, first database server 210 can be used as the main number of the first application server 110 According to library server, the second database server 220 can be used as the standby database server of the first application server 110.Also It is that first database server 210 can be used as the primary data store source of the first application server 110, the first application server 110 are first stored in data in first database server 210, ensure data real-time storage;Second database server 210 can Using the standby data storage source as the first application server 110, the first application server 110 counts the data deposit second of backup According in library server 220.Second database server 220 can be used as the main database server of the second application server 120, First database server 210 can be used as the standby database server of the second application server 120.It is, the second data Library server 220 can be used as the primary data store source of the second application server 120, and the second application server 120 will count first According in the second database server 220 of deposit, data real-time storage is ensured;First database server 210 can be used as second The data of backup are stored in first database server by the standby data storage source of application server 120, the second application server 120 In 210.
In other implementations, above-mentioned each application server 100 can also configure independent primary database service Device and standby database server, that is, database server 200 quantity can be application server 100 quantity two Times.
Referring again to Fig. 1, data-storage system can also include disk array 300, first database server 210 with Second database server 220 can connect the same disk array 300.In other embodiments, each database server 200 can be all connected with different disk arrays 300.
In one embodiment, the first application server 110 can be used for: first object data are stored in described first Database server;Obtain the operating status of first application server and second database server;When described The operating status of one application server or second database server meets storage condition, and first application server will The first object data are stored in second database server.
Second application server 120 can be used for: the second target data is stored in second database server;It obtains The operating status of second application server and the first database server;When second application server or described When the operating status of first database server meets storage condition, then second target data is stored in first data In the server of library.
About the more multi-step that above-mentioned application server 100 and database server 200 can also execute, below by Several embodiments of the method are described in detail.
Just the above-mentioned possible implementation structure of application server 100 and database server 200 is described below.
As shown in Fig. 2, being the block diagram of server.Server 400 may include: memory 410, processor 420 And network module 430.It will appreciated by the skilled person that structure shown in Fig. 2 is only to illustrate, not to service The structure of device 400 causes to limit.For example, server 400 may also include than shown in Fig. 2 more perhaps less component or With the configuration different from shown in Fig. 2.Optionally, the server 100 in the present embodiment can be used as in embodiment illustrated in fig. 1 The implementation of application server or database server.
Above-mentioned memory 410, processor 420 and each element of network module 430 is directly or indirectly electrical between each other Connection, to realize the transmission or interaction of data.For example, these elements can pass through one or more communication bus or letter between each other Number line, which is realized, to be electrically connected.Above-mentioned processor 420 is for executing the executable module stored in memory.
Wherein, memory 410 may be, but not limited to, random access memory (Random Access Memory, English Literary abbreviation: RAM), read-only memory (Read Only Memory, English abbreviation: ROM), programmable read only memory (Programmable Read-Only Memory, English abbreviation: PROM), erasable read-only memory (Erasable Programmable Read-Only Memory, English abbreviation: EPROM), electricallyerasable ROM (EEROM) (Electric Erasable Programmable Read-Only Memory, English abbreviation: EEPROM) etc..Wherein, memory 410 is used for It is stored with the executable computer program of the processor, the processor 420 executes the meter after receiving and executing instruction Calculation machine program, method performed by the server 400 that defines of process that the application any embodiment discloses can be applied to handle In device 420, or realized by processor 420.
Above-mentioned processor 410 may be a kind of IC chip, the processing capacity with signal.Above-mentioned processor 410 can be general processor, including central processing unit (Central Processing Unit, English abbreviation CPU), network Processor (Network Processor, English abbreviation NP) etc.;It can also be digital signal processor (digital signal Processor, English abbreviation: DSP), specific integrated circuit (Application Specific Integrated Circuit, English abbreviation: ASIC), field programmable gate array (Fieldprogrammable gate array, English abbreviation: FPGA) or Person other programmable logic device, discrete gate or transistor logic, discrete hardware components.It may be implemented or execute sheet Apply for disclosed each method, step and the logic diagram in embodiment.General processor can be microprocessor or the processing Device is also possible to any conventional processor etc..
Network module 430 is for receiving and transmitting network signal.Above-mentioned network signal may include wireless signal or have Line signal.In an example, above-mentioned network signal is cable network signal.At this point, network module 430 may include processor, The elements such as random access memory, converter, crystal oscillator.
Above-mentioned software program and module includes: operating system 440.Wherein operating system 440 may be, for example, LINUX, UNIX, WINDOWS, may include it is various for management system task (such as memory management, storage equipment control, power management Deng) component software and/or driving, and can mutually be communicated with various hardware or component software, to provide other software component Running environment.
Server 100 in the present embodiment can be used for executing each step in each method provided by the embodiments of the present application Suddenly.Below by the realization process of several embodiments detailed description date storage method.
Embodiment two
Referring to Fig. 3, being the flow chart of date storage method provided by the embodiments of the present application.It below will be to shown in Fig. 3 Detailed process is described in detail.
Target data is stored in the associated main database server of the first application server by step S501.
In a kind of optional embodiment, target data deposit main database server can be inquired first and be used to store Then target data is inserted into the table inquired by the table of data.
In an example, the partial code for inquiring table for storing data may is that select*from ITSV.DataBaseName.dbo.tableName.The partial code for the table that target data insertion inquires may is that select*into table from ITSV.DataBaseName.dbo.tableName。
Optionally, the implementation for opening database server may be, but not limited to: openrowset, Openquery, opendatasource.
Step S502 obtains first application server and the associated standby database service of first application server The operating status of device.
It is alternatively possible to read the operation program items of the first application server and standby database server, and read the One application server and standby database server central processing unit (Central Processing Unit, English abbreviation: CPU), the data such as utilization rate of the parameters such as memory, disk, network determine the first application server and for database servers Operating status.
Step S503, judges whether first application server and the operating status of the standby database server meet Storage condition.
If the operating status of first application server or the standby database server meets the storage condition, Execute step S504.
Optionally, above-mentioned storage condition can be above-mentioned central processing unit (Central Processing Unit, English abbreviation: CPU), memory, disk, the parameters such as network utilization rate reach a setting numerical value.Optionally, above-mentioned storage item Part can also be that the quantity of operation program items reaches a setting numerical value.
In one implementation, step S503 may include: to judge that the operating status of first application server is It is no to be in overload status;Judge whether the operating status of the standby database server is in overload status;When described The operating status of one application server is in overload status or the operating status of the standby database server is in overburden When state, it is judged to being unsatisfactory for storage condition.
Illustratively, whether the operating status of the first application server is in overload status and can be taken by the first application The state of the data such as Thread Count, cpu busy percentage, the memory usage that business device is currently up is judged.For example, by currently opening Dynamic Thread Count whether more than the first preset value, cpu busy percentage whether more than the second preset value, memory usage whether more than Three preset values can be determined that the first application server if two or two or more resources are more than that it corresponds to preset value Operating status is in overload status.
Above-mentioned the first preset value, the second preset value, third preset value can be arranged according to concrete application scene.
Illustratively, whether the operating status of standby database server is in overload status and can be taken by standby database The state of the data such as Thread Count, cpu busy percentage, the memory usage that business device is currently up is judged.For example, by currently opening Dynamic Thread Count whether more than the 4th preset value, cpu busy percentage whether more than the 5th preset value, memory usage whether more than Six preset values can be determined that standby database server if two or two or more resources are more than that it corresponds to preset value Operating status is in overload status.
Above-mentioned the 4th preset value, the 5th preset value, the 6th preset value can be arranged according to concrete application scene.
If the operating status of the first application server is in overload status, then it represents that the first application server currently needs Processing affairs are more, in order to avoid occupying the resource of the first application server because of slack storage, to influence the first application service Device business;To preferably make the first application server be capable of providing normal service, the High Availabitity of the first application server is improved Property.
If the operating status of standby database server is in overload status, then it represents that standby database server currently needs Processing affairs are more, in order to avoid occupying the resource of standby database server because of slack storage, to influence standby database service Device business;To preferably make standby database server be capable of providing normal service, the High Availabitity of standby database server is improved Property.
The target data is stored in the standby database server by step S504.
Optionally, the data in standby database server and the data of main database server can store in same magnetic In disk array, also it can store in different disk arrays.
The embodiment of the present application is by application server end actively by data in multiple database server (main database servers With standby database server) on stored, according to priority, different (main database server is prior to standby database service Device) in the storage of each database server.To realize configuration read-write dual data source, it is effectively reduced because of any server Failover bring loss of data, data delay.
In addition, while two database servers realize high availability, it is contemplated that the operating status of server itself, Also load balancing is realized to a certain extent.
The present invention is accounted for from software systems active control data storage itself, accomplishes data storage customizable, superfluous Balance contains priority, significant data backs up in time, and is stored in conjunction with server load condition, really realizes the height of data Availability improves the efficiency of application server and database server access data.The embodiment of the present application weakens database sheet The functional configuration requirement of body.
On the basis of above-mentioned step S501 to S504, it can also be defined in the storage time limit to Backup Data, example Such as, it if the storage delay duration of Backup Data is too long, can directly store.Reduction is stalled for time too long caused because of backup Situations such as loss of data.
In other embodiments, the date storage method in the present embodiment further include: judge the mesh of the target data Whether mark delay time is greater than the setting delay time for being stored in the standby database server;When the target delay time is more than When the setting delay time, then the target data is stored in the standby database server.
Above-mentioned target delay time indicates that target data needs the duration to be stored up to current time.
It optionally, can not be according to above-mentioned steps when the target delay time is more than the setting delay time The sequence of S502-S504 executes, and directly target data is stored in standby database server, to realize data backup.
Optionally, different storages can also be configured for every a kind of data type according to the importance of different types of data Rule.In some instances, it when data type is alarm, when the important information type such as event, can preferentially store in time;Work as number When according to being that emergency shows class data, can preferentially it store in time;When data are some conventional sense class data, can postpone to deposit Storage;When data for a long time do not change, can postpone to store.
Above-mentioned storage rule can be to be stored according to time rule.Above-mentioned storage rule can also be sequence rule Then, different data types is according to corresponding ordering rule, sequencing storage.For example, alarm class high priority data is in state class Data storage.
In some embodiments, above-mentioned date storage method can also include: judge the target data whether be Preset data type;When the target data is the preset data type, then according to the data of the target data The target data is stored in the standby database server by the storage rule of type matching.
Illustratively, above-mentioned preset data type includes the data type of multiple and different ranks, the number of different stage The storage priority of different stage, the matched storage rule of the above-mentioned data type according to the target data are corresponded to according to type The target data is stored in the step in the standby database server, may include: the data for obtaining the target data The corresponding storage priority of type;It will be described in corresponding time rule deposit of the target data according to the storage priority In standby database server.
Optionally, the priority of more important data type can be higher.
In an example, data type may include alarm class data, urgent display info class data, state class data Deng.Optionally, the priority for class data of alarming can be higher than the priority of urgent display info class data, promptly show info class The priority of data can be higher than state class data.Optionally, the priority of alarm class data and urgent display info class data Can also be identical, and be higher than state class data etc..
Optionally, above-mentioned time rule may is that the more important data type corresponding storage period can be smaller.Example Such as, the storage period for class data of alarming is less than the storage period of state class data.Optionally, above-mentioned time rule can be with Be: the duration of the corresponding delay storage of more important data type is shorter.For example, the delay duration of the storage of alarm class data is small In the storage delay duration of state class data.
Wherein, all data types can carry out configuration preference level according to its importance, can also be according to data type pair The data source configuration preference level answered.
Different storage rules is configured by the above-mentioned difference according to data type, the weight of data type can be highlighted Will whether, important high priority data is stored.Under some fortuitous events, for example, database server breaks down, it can subtract The case where few important class data do not back up.
Optionally, the priority of data can not also be matched with data type.Illustratively, the priority of data It can be matched according to the time for receiving data, for example, the more early corresponding priority of receiving time is higher.
Illustratively, the data volume that the priority of data can also have backed up is matched.For example, a kind of data storage It measures larger, then it represents that priority is higher.For example, alert data amount is most, then it can be most by the priority match of alert data It is high.
Optionally, on the basis of above-mentioned each step, the tables of data of stored completion can also be inquired life again Cost earth's surface TEMP_Table.In an example, the partial code of this earth's surface of query generation may be implemented as again: select*into TEMP_Table from openrowset(‘SQLOLEDB’,’Server Name’,’username’,’ password’,’DataBase.dbo.tableName)。
The tables of data of stored completion again this earth's surface of query generation TEMP_Table, partial code is as follows:
select*into TEMP_Table from openrowset(‘SQLOLEDB’,’Server Name’,’ username’,’password’,’DataBase.dbo.tableName)。
Optionally, above-mentioned this earth's surface regenerated can also be imported into the tables of data in standby storing data library.One In a example, the partial code importeding into the tables of data in standby storing data library realizes that format is as follows: Insert openrowset (‘SQLOLEDB’,’Server Name’,’username’,’password’,’DataBase.dbo.tableName) select*from TEMP_Table。
Optionally, the data in main database server and standby database server can also be inquired.It is exemplary , the data in UNION ALL conjunctive query main database server and standby database server can be used when data query.It is logical Data query displaying can be used in the data crossed in UNION ALL conjunctive query main database server and standby database server Content more integrality.
Embodiment three
Conceived based on same application, data storage dress corresponding with date storage method is additionally provided in the embodiment of the present application It sets, since the principle that the device in the embodiment of the present application solves the problems, such as is similar to the above-mentioned date storage method of the embodiment of the present application, Therefore the implementation of device may refer to the implementation of method, and overlaps will not be repeated.
Referring to Fig. 4, being the functional block diagram of data storage device provided by the embodiments of the present application.The application is implemented The module for the data storage device that example provides is used to execute each step in the date storage method of the offer of the above embodiments two Suddenly.The data storage device includes: the first memory module 601, obtains module 602, judgment module 603, the second memory module 604;Wherein:
First memory module 601 takes for target data to be stored in the associated primary database of first application server Business device;
Module 602 is obtained, for obtaining first application server and the associated standby number of first application server According to the operating status of library server;
Judgment module 603, for judging the operating status of first application server or the standby database server Whether storage condition is met;
Second memory module 604, if for first application server or the operation shape of the standby database server State meets storage condition, then the target data is stored in the standby database server.
In a kind of possible embodiment, judgment module 603 is also used to:
Judge whether the operating status of first application server is in overload status;
Judge whether the operating status of the standby database server is in overload status;
When the operating status of first application server is in the fortune of overload status or the standby database server When row state is in overload status, it is judged to being unsatisfactory for storage condition.
In a kind of possible embodiment, data storage device can also include: third memory module, be used for:
Judge whether the target delay time of the target data is greater than to be stored in the setting of the standby database server and prolong The slow time;
When the target delay time is more than the setting delay time, then by the target data deposit standby number According in the server of library.
In a kind of possible embodiment, data storage device can also include: the 4th memory module, be used for:
Judge whether the target data is preset data type;
When the target data is the preset data type, then matched according to the data type of the target data Storage rule the target data is stored in the standby database server.
In a kind of possible embodiment, the preset data type includes the data type of multiple and different ranks, no The data type of same level corresponds to the storage priority of different stage, and the 4th above-mentioned memory module is also used to:
Obtain the corresponding storage priority of data type of the target data;
The target data is stored in the standby database service according to the corresponding time rule of the storage priority In device.
Example IV
The embodiment of the present application also provides a kind of date storage method, the side that the method in the present embodiment and embodiment two provide Method is similar, the difference is that, it is applied to data-storage system in the present embodiment, the method in embodiment two can be applied to In one application server.Wherein, data-storage system includes the first application server, the second application server, first database Server, the second database server, the first database server are that the primary database of first application server takes Business device, is the standby database server of second application server, and second database server is second application The main database server of server is the standby database server of first application server.As shown in figure 5, this implementation Method in example may comprise steps of.
First object data are stored in first database server by step S701, the first application server.
Step S702, first application server obtain first application server and the second database server Operating status.
Step S703 is stored when the operating status of first application server or second database server meets The first object data are stored in second database server by condition, first application server.
Second target data is stored in second database server by step S704, the second application server.
Step S705, second application server obtain second application server and the first database service The operating status of device.
Step S706 is stored when the operating status of second application server or the first database server meets Second target data is stored in the first database server by condition, second application server.
Other details about the present embodiment can also be with reference to the description in the above embodiments two, and details are not described herein.
In addition, the embodiment of the present application also provides a kind of computer readable storage medium, on the computer readable storage medium It is stored with computer program, the storage of data described in above method embodiment is executed when which is run by processor The step of method.
The computer program product of date storage method provided by the embodiment of the present application, including storing program code Computer readable storage medium, the instruction that said program code includes can be used for executing data described in above method embodiment The step of storage method, for details, reference can be made to above method embodiments, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed device and method can also pass through Other modes are realized.The apparatus embodiments described above are merely exemplary, for example, flow chart and block diagram in attached drawing Show the device of multiple embodiments according to the application, the architectural framework in the cards of method and computer program product, Function and operation.In this regard, each box in flowchart or block diagram can represent the one of a module, section or code Part, a part of the module, section or code, which includes that one or more is for implementing the specified logical function, to be held Row instruction.It should also be noted that function marked in the box can also be to be different from some implementations as replacement The sequence marked in attached drawing occurs.For example, two continuous boxes can actually be basically executed in parallel, they are sometimes It can execute in the opposite order, this depends on the function involved.It is also noted that every in block diagram and or flow chart The combination of box in a box and block diagram and or flow chart can use the dedicated base for executing defined function or movement It realizes, or can realize using a combination of dedicated hardware and computer instructions in the system of hardware.
In addition, each functional module in each embodiment of the application can integrate one independent portion of formation together Point, it is also possible to modules individualism, an independent part can also be integrated to form with two or more modules.
It, can be with if the function is realized and when sold or used as an independent product in the form of software function module It is stored in a computer readable storage medium.Based on this understanding, the technical solution of the application is substantially in other words The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a People's computer, server or network equipment etc.) execute each embodiment the method for the application all or part of the steps. And storage medium above-mentioned includes: that USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited The various media that can store program code such as reservoir (RAM, Random Access Memory), magnetic or disk.It needs Illustrate, herein, relational terms such as first and second and the like be used merely to by an entity or operation with Another entity or operation distinguish, and without necessarily requiring or implying between these entities or operation, there are any this realities The relationship or sequence on border.Moreover, the terms "include", "comprise" or its any other variant are intended to the packet of nonexcludability Contain, so that the process, method, article or equipment for including a series of elements not only includes those elements, but also including Other elements that are not explicitly listed, or further include for elements inherent to such a process, method, article, or device. In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including the element Process, method, article or equipment in there is also other identical elements.
The foregoing is merely preferred embodiment of the present application, are not intended to limit this application, for the skill of this field For art personnel, various changes and changes are possible in this application.Within the spirit and principles of this application, made any to repair Change, equivalent replacement, improvement etc., should be included within the scope of protection of this application.It should also be noted that similar label and letter exist Similar terms are indicated in following attached drawing, therefore, once being defined in a certain Xiang Yi attached drawing, are then not required in subsequent attached drawing It is further defined and explained.
The above, the only specific embodiment of the application, but the protection scope of the application is not limited thereto, it is any Those familiar with the art within the technical scope of the present application, can easily think of the change or the replacement, and should all contain Lid is within the scope of protection of this application.Therefore, the protection scope of the application should be subject to the protection scope in claims.

Claims (10)

1. a kind of date storage method, which is characterized in that be applied to the first application server, comprising:
Target data is stored in the associated main database server of the first application server;
Obtain the operating status of first application server and the associated standby database server of first application server;
Judge whether first application server and the operating status of the standby database server meet storage condition;
If the operating status of first application server or the standby database server meets the storage condition, by institute Target data is stated to be stored in the standby database server.
2. the method according to claim 1, wherein the judgement first application server and the standby number The step of whether meeting storage condition according to the operating status of library server, comprising:
Judge whether the operating status of first application server is in overload status;
Judge whether the operating status of the standby database server is in overload status;
When the operating status of first application server is in the operation shape of overload status or the standby database server When state is in overload status, it is judged to being unsatisfactory for storage condition.
3. the method according to claim 1, wherein the method also includes:
When judging whether the target delay time of the target data is greater than the setting delay for being stored in the standby database server Between;
When the target delay time is more than the setting delay time, then the target data is stored in the standby database In server.
4. the method according to claim 1, wherein the method also includes:
Judge whether the target data is preset data type;
When the target data is the preset data type, then deposited according to the data type of the target data is matched The target data is stored in the standby database server by storage rule.
5. according to the method described in claim 4, it is characterized in that, the preset data type includes multiple and different ranks Data type, the data type of different stage correspond to the storage priority of different stage, the number according to the target data The step being stored in the target data according to the storage rule of type matching in the standby database server, comprising:
Obtain the corresponding storage priority of data type of the target data;
The target data is stored in the standby database server according to the corresponding time rule of the storage priority.
6. a kind of date storage method, which is characterized in that be applied to data-storage system, the data-storage system includes first Application server, the second application server, first database server, the second database server, the first database clothes Device be engaged in as the main database server of first application server, is the standby database service of second application server Device, second database server are the main database server of second application server, for the first application clothes The standby database server of business device, comprising:
First object data are stored in the first database server by first application server;
First application server obtains the operating status of first application server and second database server;
When the operating status of first application server or second database server meets storage condition, described first The first object data are stored in second database server by application server;
Second target data is stored in second database server by second application server;
Second application server obtains the operating status of second application server and the first database server;
When the operating status of second application server or the first database server meets storage condition, described second Second target data is stored in the first database server by application server.
7. a kind of data storage device, which is characterized in that be applied to the first application server, comprising:
First memory module, for target data to be stored in the associated main database server of the first application server;
Module is obtained, for obtaining first application server and the associated standby database service of first application server The operating status of device;
Judgment module, for judging whether first application server or the operating status of the standby database server meet Storage condition;
Second memory module, if being deposited for the operating status of first application server or standby database server satisfaction The target data is then stored in the standby database server by storage condition.
8. a kind of application server characterized by comprising processor, memory and bus, the memory are stored with described The executable computer program of processor passes through bus between the processor and the memory when electronic equipment operation The step of communicating, the method as described in claim 1 to 6 is any executed when the computer program is executed by the processor.
9. a kind of data-storage system, which is characterized in that data-storage system includes the first application server, the second application service Device, first database server, the second database server, the first database server are first application server Main database server, be the standby database server of second application server, second database server is The main database server of second application server is the standby database server of first application server;
First application server is used for:
First object data are stored in the first database server;
Obtain the operating status of first application server and second database server;
When the operating status of first application server or second database server meets storage condition, described first The first object data are stored in second database server by application server;
Second application server is used for:
Second target data is stored in second database server;
Obtain the operating status of second application server and the first database server;
When the operating status of second application server or the first database server meets storage condition, then by institute The second target data is stated to be stored in the first database server.
10. system according to claim 9, which is characterized in that the data-storage system further includes disk array, described The data of first database server and second database server are stored on the disk array.
CN201910742533.XA 2019-08-09 2019-08-09 Date storage method, apparatus and system Pending CN110489397A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910742533.XA CN110489397A (en) 2019-08-09 2019-08-09 Date storage method, apparatus and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910742533.XA CN110489397A (en) 2019-08-09 2019-08-09 Date storage method, apparatus and system

Publications (1)

Publication Number Publication Date
CN110489397A true CN110489397A (en) 2019-11-22

Family

ID=68550708

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910742533.XA Pending CN110489397A (en) 2019-08-09 2019-08-09 Date storage method, apparatus and system

Country Status (1)

Country Link
CN (1) CN110489397A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833116A (en) * 2012-09-07 2012-12-19 山西省电力公司电力科学研究院 Electrical equipment state information fusing and showing system
CN103795553A (en) * 2012-10-29 2014-05-14 中国银联股份有限公司 Switching of main and standby servers on the basis of monitoring
CN104871130A (en) * 2012-12-17 2015-08-26 英派尔科技开发有限公司 Load balancing scheme
US20170039106A1 (en) * 2015-01-23 2017-02-09 Servicenow, Inc. Distributed Computing System With Resource Managed Database Cloning
CN108664643A (en) * 2018-05-11 2018-10-16 重庆工商职业学院 A kind of distributed memory system and method for gathered data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833116A (en) * 2012-09-07 2012-12-19 山西省电力公司电力科学研究院 Electrical equipment state information fusing and showing system
CN103795553A (en) * 2012-10-29 2014-05-14 中国银联股份有限公司 Switching of main and standby servers on the basis of monitoring
CN104871130A (en) * 2012-12-17 2015-08-26 英派尔科技开发有限公司 Load balancing scheme
US20170039106A1 (en) * 2015-01-23 2017-02-09 Servicenow, Inc. Distributed Computing System With Resource Managed Database Cloning
CN108664643A (en) * 2018-05-11 2018-10-16 重庆工商职业学院 A kind of distributed memory system and method for gathered data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈信祥等: "《电子商务网站建设》", 30 September 2000, 清华大学出版社 *

Similar Documents

Publication Publication Date Title
CN109889999B (en) Flow pool management method, system and terminal of Internet of things card
CN102917010B (en) The method automatically seized in multicomputer system and computer system
CN102385541A (en) Controlled automatic healing of data-center services
CN105808407A (en) Equipment management method, equipment and equipment management controller
CN106992900A (en) The method and intelligent early-warning notification platform of monitoring and early warning
CN108717379A (en) Electronic device, distributed task dispatching method and storage medium
CN106020977B (en) Distributed task dispatching method and device for monitoring system
CN110928655A (en) Task processing method and device
CN108491301A (en) Electronic device, the abnormity early warning method based on redis and storage medium
CN108153590A (en) Manage hardware resource
CN109818810A (en) A kind of access server connection optimization method, access server and communication system
CN108446171A (en) Electronic device, distributed system execute method for allocating tasks and storage medium
CN108632106A (en) System for monitoring service equipment
CN111045811A (en) Task allocation method and device, electronic equipment and storage medium
CN102893229A (en) Energy-saving monitoring method and device
CN105357042A (en) High-availability cluster system, master node and slave node
WO2017118318A1 (en) Data storage and service processing method and device
CN105204961B (en) Method, device and system for setting check point of cloud data center host
CN103763126A (en) System and method for monitoring database and database monitoring device
CN103902401B (en) Virtual machine fault-tolerance approach and device based on monitoring
CN104834584A (en) Method and system for monitoring host computer hardware loads
US9132550B2 (en) Apparatus and method for managing robot components
CN106339294A (en) Voltage monitoring system and method
CN106412088A (en) Data synchronization method and terminal
CN110489397A (en) Date storage method, apparatus and system

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20191122