CN109460438A - Message data storage method, device, computer equipment and storage medium - Google Patents

Message data storage method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN109460438A
CN109460438A CN201811122763.8A CN201811122763A CN109460438A CN 109460438 A CN109460438 A CN 109460438A CN 201811122763 A CN201811122763 A CN 201811122763A CN 109460438 A CN109460438 A CN 109460438A
Authority
CN
China
Prior art keywords
message data
database
time
stored
data
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.)
Granted
Application number
CN201811122763.8A
Other languages
Chinese (zh)
Other versions
CN109460438B (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.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China 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 Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN201811122763.8A priority Critical patent/CN109460438B/en
Priority claimed from CN201811122763.8A external-priority patent/CN109460438B/en
Publication of CN109460438A publication Critical patent/CN109460438A/en
Application granted granted Critical
Publication of CN109460438B publication Critical patent/CN109460438B/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/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/1464Management of the backup or restore process for networked environments

Abstract

This application involves a kind of message data storage method, device, computer equipment and storage medium based on big data.Method includes: the message data for obtaining terminal and generating;Message data is stored into first database;The message data being stored in first database is synchronized in the second database at the first time every default;The corresponding temporal information of each message data for being stored in the second database is obtained every default second time;When detecting the presence of the temporal information of message data beyond preset time, temporal information in message data is backed up in document data bank beyond the message data of preset time.This method makes when needing to obtain historical data, whether long-term history message data or history message data in a short time, it can completely acquire, both ensure that the long-term storage to message data, be also convenient for the message data of inquiry different time.

Description

Message data storage method, device, computer equipment and storage medium
Technical field
This application involves field of computer technology, set more particularly to a kind of message data storage method, device, computer Standby and storage medium.
Background technique
With the development of computer technology, instant messaging application is also more and more, and instant messaging application generally can all have Massage-storing function, i.e. history message can be queried record.In the conventional technology, instant messaging application is for message count All being the client storage mode taken when according to being stored, after client is carried out unloading deletion, will be unable to get this The history message data of application.In order to solve this problem, the storage of cloud message data is supported in some applications.However this storage Mode will be unable to get to the storing data that can be got in a short time for time historical data relatively remote, cause Complete history message data can not be got.
Summary of the invention
Based on this, it is necessary in view of the above technical problems, provide a kind of message data for capableing of full dose storage message data Storage method, device, computer equipment and storage medium.
A kind of message data storage method, which comprises
Obtain the message data that terminal generates;
The message data is stored into first database;
The message data being stored in the first database is synchronized to the second data at the first time every default In library;
The corresponding temporal information of each message data for being stored in the second database is obtained every default second time;
When detecting the presence of the temporal information of message data beyond preset time, the time in the message data is believed Breath backs up in document data bank beyond the message data of preset time.
Including at least in the first database in one of the embodiments, has the first subdata base and the second subdata Library;It is described to store the message data into first database, comprising:, will be described when the first subdata base successful connection Message data is stored to first subdata base;It, will be described after preset time when the second subdata base successful connection Message data is stored to second subdata base.
It is described in one of the embodiments, to store the message data to first subdata base, comprising: by institute Message data is stated to store to the host node of first subdata base;By the host node of first subdata base by storage The message data is synchronized to the vice-node of first subdata base;It will be stored in first number at the first time every default It is synchronized in the second database according to the message data in library, comprising: described first will be stored at the first time every default The message data of the vice-node of subdata base is synchronized in the second database.
In one of the embodiments, described every the default institute that will be stored in the first database at the first time It states after message data is synchronized in the second database, further includes: obtain the message data pair in the first database The temporal information answered;The message data that the temporal information is more than the preset expiration time is deleted from the first database.
It is standby in the message data by temporal information in the message data beyond preset time in one of the embodiments, After part is into document data bank, further includes: information is successfully backed up to beyond the message data of preset time between upon this detection When the document data bank, the message data that the temporal information exceeds preset time is deleted.
In one of the embodiments, the method also includes: obtain information query request, information query request is taken With query time information;It is obtained from corresponding database according to the query time information and the query time information pair The message data answered;When the query time information is more than inquiry duration, obtaining from the document data bank is more than inquiry The corresponding message data of duration;When the query time information is less than inquiry duration, obtained from second database It is less than the corresponding message data of inquiry duration.
A kind of message data storage device, described device include:
Data acquisition module, for obtaining the message data of terminal generation;
First memory module, for storing the message data into first database;
Second memory module, for every the default message count that will be stored in the first database at the first time According to being synchronized in the second database;
Third memory module, it is corresponding every each message data that default second time acquisition is stored in the second database Temporal information;When detecting the presence of the temporal information of message data beyond preset time, by the time in the message data Information backs up in document data bank beyond the message data of preset time.
A kind of computer equipment, including memory and processor, the memory are stored with computer program, the processing Device performs the steps of when executing the computer program
Obtain the message data that terminal generates;
The message data is stored into first database;
The message data being stored in the first database is synchronized to the second data at the first time every default In library;
The corresponding temporal information of each message data for being stored in the second database is obtained every default second time;
When detecting the presence of the temporal information of message data beyond preset time, the time in the message data is believed Breath backs up in document data bank beyond the message data of preset time.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor It is performed the steps of when row
Obtain the message data that terminal generates;
The message data is stored into first database;
The message data being stored in the first database is synchronized to the second data at the first time every default In library;
The corresponding temporal information of each message data for being stored in the second database is obtained every default second time;
When detecting the presence of the temporal information of message data beyond preset time, the time in the message data is believed Breath backs up in document data bank beyond the message data of preset time.
Above-mentioned message data storage method, device, computer equipment and storage medium, pass through the terminal data that will acquire It first stores into first database, the data being stored in first database periodically can be synchronized to the at the first time every default The message data being stored in the second database periodically can be backed up to file data every default second time by two databases again It is that the message data for being more than preset time for temporal information in the second database is stored to document data bank in storage in library In, so that when needing to obtain historical data, whether long-term history message data or history message data in a short time, It can completely acquire, it, can be from the second data when needing to obtain the short-term message data for being less than preset time It is acquired in library, and when needing acquisition to be more than the message data of preset time for a long time, it can be obtained from document data bank It obtains, both ensure that the long-term storage to message data, be also convenient for the message data of inquiry different time.
Detailed description of the invention
Fig. 1 is the application scenario diagram of message data storage method in one embodiment;
Fig. 2 is the flow diagram of message data storage method in one embodiment;
Fig. 3 is to store message data to the flow diagram of the first subdata base step in one embodiment;
Fig. 4 is the flow diagram of the also included step of message data storage method in one embodiment;
Fig. 5 is the flow diagram of message data storage method in another embodiment;
Fig. 6 is the timing diagram of message data storage method in one embodiment;
Fig. 7 is the structural block diagram of message data storage device in one embodiment;
Fig. 8 is the structural block diagram of message data storage device in another embodiment;
Fig. 9 is the internal structure chart of computer equipment in one embodiment.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not For limiting the application.
Message data storage method provided by the present application, can be applied in application environment as shown in Figure 1.Wherein, eventually End 110 is communicated with server 120 by network by network.It is mountable in terminal 110 to have default application, preset application It can produce message data in use.Server 120 can wrap containing first database, the second database and number of files According to library, after the default application installed in terminal 110 generates message data, first message data can be stored to the first data The message data being stored in first database is synchronized to the second database at the first time every default by library, every default the Two times backed up to the message data being stored in the second database in document data bank.Wherein, terminal 110 can with but It is not limited to various personal computers, laptop, smart phone, tablet computer and portable wearable device, server 120 can be realized with the server cluster of the either multiple server compositions of independent server.
In one embodiment, as shown in Fig. 2, providing a kind of message data storage method, it is applied to Fig. 1 in this way In server for be illustrated, comprising the following steps:
Step 202, the message data that terminal generates is obtained.
Default instant messaging application can be installed at the terminal, it, can not stopping pregnancy in instant messaging application use process Raw message data, the available message data generated to the default instant messaging application installed in terminal.Message data can be with It is the message data of the types such as pure words, expression message and picture.
Step 204, message data is stored into first database.
Step 206, the message data being stored in first database is synchronized to the second data at the first time every default In library.
Step 208, each message data corresponding time of the second database is stored in every default second time acquisition Information.
Step 210, when detecting the presence of the temporal information of message data beyond preset time, when by message data Between information backed up in document data bank beyond the message data of preset time.
First database can be the library Redis, and Redis is high performance key-value (key-value) database.? After the message data for getting terminal generation, message data can all be stored into first database.Default first time It is the pre-set time with default second time, presetting at the first time can identical or not phase with default second time Together.Second database can be oracle database (a kind of relational database management system), can will be stored in the first data Message data in library is synchronized in the second database at the first time every default, and will be stored in the every default second time Message data in two databases backs up in file, guarantees the full dose storage to message data with this.
When the message data for storing in the second database is backed up in document data bank every default second time, Message data can be backed up according to the temporal information of message data.Each message data has corresponding time to believe Breath, temporal information refer to the time that message data generates, and correspond to getting each message data for being stored in the second database Temporal information after, temporal information can be stored beyond preset time corresponding message data backup into document data bank. Assuming that setting preset time to 30 days, then then the message data that temporal information is more than 30 days can be backed up to file data In library, i.e., the message data generated before 30 days is backed up in document data bank, and temporal information is less than 30 days and is disappeared Breath data are still stored in the second database.In this way, can be from document data bank for the message data for being more than preset time In get, and the message data for being less than preset time can be got from the second database, ensure that entire message The full storage of data.
In one embodiment, temporal information in message data is being backed up into file beyond the message data of preset time After in database, further includes: information successfully backs up to file data beyond the message data of preset time between upon this detection When library, erasing time information exceeds the message data of preset time.
It, can be to the after saving the message data backup in the second database more than preset time in document data bank Message data in two databases is arranged.It will be more than that the message data of preset time successfully backs up in document data bank Afterwards, the part message data in the second database more than preset time can be deleted, is avoided in the second database Data redundancy.
In above-mentioned message data storage method, first stored into first database by the terminal data that will acquire, often The data being stored in first database periodically can be synchronized to the second database at the first time every default, when default second Between can timing the message data being stored in the second database be backed up in document data bank again, storage when, be by second Temporal information is more than that the message data of preset time is stored into document data bank in database, so that when needing to obtain history number According to when, whether long-term history message data or history message data in a short time, can completely acquire, It when needing to obtain the short-term message data for being less than preset time, can be acquired from the second database, and need to obtain It takes long-term when being more than the message data of preset time, can acquire, both ensure that message data from document data bank Long-term storage, be also convenient for inquiry different time message data.
In one embodiment, including at least in first database has the first subdata base and the second subdata base.It will disappear Breath data are stored into first database, comprising: when the first subdata base successful connection, message data is stored to the first son Database;When the second subdata base successful connection, after preset time, message data is stored to the second subdata base.
It in first database, can wrap containing multiple subdata bases, i.e., including at least in first database has the first son Database and the second subdata base.Each subdata base can store message data.Pre- by what is installed in terminal It, can first which of detection and first database subdata base if the message data that application generates is stored to first database Successful connection, if detect with the first subdata base successful connection in first database, then can will be generated in terminal Message data is stored to the first subdata base.If detect with the second subdata base successful connection in first database, then The message data generated in terminal can be stored to the second subdata base.It stores by message data into first database When a certain subdata base, it will detect whether to connect into other subdata bases in the first subdata base every preset time Function can then transfer message data to store to the subdata base of other successful connections, by this method by message if successful connection Data are stored into first database.That is, there are delay machine feelings when there are some subdata base connection failure Under condition, then message data will not be stored into the subdata base, avoid the failure storage of message data, and even existed There is the case where some subdata base delay machine, message data normal storage to other subdata bases can also be guaranteed into message data Safely and effectively store.
In one embodiment, as shown in figure 3, storing message data to the first subdata base, comprising:
Step 302, message data is stored to the host node of the first subdata base.
Step 304, the message data of storage is synchronized to by the first subdata base by the host node of the first subdata base Vice-node.
The message data being stored in first database is synchronized in the second database at the first time every default, is wrapped It includes: the message data for being stored in the vice-node of the first subdata base being synchronized in the second database at the first time every default.
Can wrap in each subdata base in first database containing multiple nodes, including at least have a vice-node and Host node.It, can be by message when storing the message data generated in terminal in the first subdata base into first database Data first store on the host node into the first subdata base, by the host node of the first subdata base that the message data of storage is same Step is to the first subdata base in vice-node.Therefore, have in terminal on the host node of the first subdata base and vice-node Message data.And host node is responsible for that message data is written, i.e., stores the message data in terminal, and vice-node is responsible for reading Take message data that can then synchronize message data by vice-node, i.e., that is, when carrying out transfer storage to message data Reading data is carried out by vice-node.The mode of this read and write abruption can also largely be read and write to avoid the same node Caused Data bottlenecks.
In one embodiment, the message data being stored in first database is synchronized at the first time every default After in second database, further includes: obtain the corresponding temporal information of message data in first database;Periodically from the first number It is more than the message data of preset expiration time according to erasing time information in library.
After the message data in first database is synchronized in the second database, in order to avoid being deposited in first database A large amount of useless message datas are contained, storage efficiency is reduced, can be synchronized to by the message data being stored in first database After in second database, the message data that the time in first database is more than the preset expiration time is periodically deleted.Each message Data have corresponding temporal information, according to temporal information would know that the message data caused by the time.So clear It can be more than the message count of preset expiration time by temporal information in first database when managing the message data in first database According to.The preset expiration time can be with sets itself.For example the preset expiration time is set as 1 hour, then can be periodically by the first data The message data generated before 1 hour in library is deleted.Can be will be in first database before 1 hour every ten minutes The message data of generation is deleted, and is also possible to one and is detected that message data was generated before 1 hour, then can be by message Data are deleted from first database.
Since message data is stored in first database at the beginning, the message data in first database is same After step is into the second database, the stale data in first database can be cleared up, avoid the storage in first database More useless expired time, leads to the data redundancy in first database, therefore can be by way of this periodic cleaning pair Memory in first database is discharged.
In one embodiment, as shown in figure 4, the above method further include:
Step 402, information query request is obtained, information query request carries query time information.
Step 404, message corresponding with query time information is obtained from corresponding database according to query time information Data.
Step 406, when queried between information be more than inquiry duration when, from document data bank obtain be more than inquiry duration pair The message data answered.
Step 408, when queried between information when being less than inquiry duration, obtained when being less than inquiry from the second database Long corresponding message data.
Information query request can be initiated by user by terminal, carry query time information in information query request, I.e. user can determine whether the temporal information for needing the message data inquired when information query of the triggering to message data is requested.Than Message data before needing to inquire 10 days such as user then can choose the message count for needing to inquire at corresponding data query interface According to event horizon.The limitation of time, the message data before limitation search 10 days can also be added in search command Message data corresponding with query time information is obtained from corresponding database according to query time information.It generates at the terminal When message data, first the message data generated in terminal can be stored to first database, every it is default at the first time can be by the Message data in one database is synchronized in the second database, can will be stored in the second database every default second time Message data back up in document data bank.And the message in the second database can will be stored in every default second time When data backup is into document data bank, the corresponding time letter of each message data for being stored in the second database can be got Breath, and will test temporal information and backed up in document data bank beyond the message data of preset time.Therefore, between when queried When information is more than inquiry duration, obtaining from document data bank database is more than the corresponding message data of inquiry duration, and works as and look into When inquiry temporal information is less than inquiry duration, is obtained from the second database and be less than the corresponding message data of inquiry duration.
Assuming that preset time is 30 days, then detecting that temporal information can be backed up beyond 30 days message data to file In database, that is to say, that be stored in the second database and be less than 30 days message data, and stored in document data bank 30 days message data is had more than.So in query message data, if the query time carried in information query request Information then can then obtain corresponding message data from document data bank, and was taken when in information query request before 30 days The query time information of band is that corresponding message data can be then obtained from the second database in 30 days.
In one embodiment, as shown in figure 5, providing a kind of message data storage method, it is applied to Fig. 1 in this way In server for be illustrated, comprising the following steps:
Step 502, the message data that terminal generates is obtained.
Step 504, when the first subdata base successful connection, message data is stored to the main section of the first subdata base Point.
Step 506, the message data of storage is synchronized to by the first subdata base by the host node of the first subdata base Vice-node.
Step 508, the message data for being stored in the vice-node of the first subdata base is synchronized at the first time every default In second database.
The default application that the message data generated in terminal can be installed in terminal, it is default to apply in use process In can produce corresponding message data.Get terminal generation message data after, message data can all be stored to In first database.When storing message data into first database, be message data is stored to first database The subdata base of middle successful connection then stores message data to the first subdata base if the first subdata base successful connection; If the second subdata base successful connection then stores message data to the second subdata base.In storing process, meeting successively will Message data is stored into each subdata base, i.e., in storage, it is assumed that stored message data to successful connection at the beginning The first subdata base, then message data can be stored after storing a period of time to other subdata bases of successful connection, The bottleneck of read-write is caused to avoid a large amount of data storage of the same subdata base, reduces data storage efficiency.
And when storing message data into the first subdata base, then it is first to store message data to the first subdata Host node in library then can be by the message count of storage after the host node in the first subdata base stores message data According to the vice-node for being synchronized to the first subdata base.The mode of read and write abruption is taken in subdata base, therefore host node is responsible for number According to write-in, and vice-node is responsible for reading data, therefore every the default message count that will be stored in first database at the first time When according to being synchronized in the second database, the message data for being stored in the vice-node of the first subdata base is actually synchronized to In two databases.
Step 510, the message data that the time in first database is more than the preset expiration time is periodically deleted.
Step 512, the corresponding temporal information of each message data for being stored in the second database is obtained.
Step 514, when detecting the presence of the temporal information of message data beyond preset time, when by message data Between information backed up in document data bank beyond the message data of preset time.
Step 516, upon this detection between information when successfully backing up to document data bank beyond the message data of preset time, Erasing time information exceeds the message data of preset time.
After storing the message data in first database into the second database, can periodically it delete in first database Time is more than the message data of preset expiration time.Such as the message data generated before deleting 1 hour, then in first database The message data of storage is the message data generated in nearest 1 hour, and the history message data before 1 hour are stored extremely In second database.Each message data has corresponding temporal information, stores by message data to the second database In after, the available temporal information to each message data of the second database, and by be more than preset time message data it is standby Part is into document data bank.For example the message data before 30 days is backed up in document data bank.
Timing diagram as shown in FIG. 6 after the message data generated on getting terminal, can store message data to In one database, first database can be the library Redis.In first database when carrying out message data storage, actually Message data is first stored into the host node into subdata base, then data are synchronized to vice-node by host node.It stores to first After database, message data can be subjected to transfer storage by first database, stored into the second database, and can be regular Clear up the stale data in first database.The message data in first database is synchronized in the second database and has been stored Bi Hou can detecte the message data whether message data in the second database has more than preset duration, for example detect whether There is the message data before 30 days.If any, then can by this part be more than preset duration message data store to file service Device, and the message data more than preset duration is deleted from the second database.It so can be to avoid in the second database The redundancy of data.And in query message data, can in the second database query time information without departing from preset time Message data, and query time information exceeds the message data of preset time hereof.
It is first stored into first database by the terminal data that will acquire, will can periodically be deposited at the first time every default The data stored up in first database are synchronized to the second database, will can periodically be stored in the second data every default second time Message data in library backs up in document data bank again, so that when needing to obtain historical data, whether long-term history The history message data of message data still in a short time, can completely acquire.Such as when quality testing department needs to obtain When counting to the sales data of sales force, need to get the history message data of sales force, then when quality inspection portion When door needs to get the message data of the sales force before 30 days, it can inquire and get from document data bank, and When quality testing department needs to get the message data of the sales force in 30 days, it can inquire and obtain from the second database It arrives.
It should be understood that although each step in the flow chart of Fig. 2-Fig. 5 is successively shown according to the instruction of arrow, It is these steps is not that the inevitable sequence according to arrow instruction successively executes.Unless expressly stating otherwise herein, these steps There is no stringent sequences to limit for rapid execution, these steps can execute in other order.Moreover, in Fig. 2-Fig. 5 extremely Few a part of step may include that perhaps these sub-steps of multiple stages or stage are not necessarily same to multiple sub-steps Moment executes completion, but can execute at different times, and the execution sequence in these sub-steps or stage is also not necessarily It successively carries out, but in turn or can be handed over at least part of the sub-step or stage of other steps or other steps Alternately execute.
In one embodiment, as shown in fig. 7, providing a kind of message data storage device, comprising: data acquisition mould Block, the first memory module, the second memory module and third memory module, in which:
Data acquisition module 702, for obtaining the message data of terminal generation.
First memory module 704, for storing message data into first database.
Second memory module 706, for every default at the first time that the message data being stored in first database is same Step is into the second database.
Third memory module 708, for obtaining each message count for being stored in the second database every default second time According to corresponding temporal information;It, will be in message data when detecting the presence of the temporal information of message data beyond preset time Temporal information backs up in document data bank beyond the message data of preset time.
In one embodiment, including at least in first database has the first subdata base and the second subdata base.First Memory module 704 is also used to when the first subdata base successful connection, and message data is stored to the first subdata base;When second When subdata base successful connection, after preset time, message data is stored to the second subdata base.
In one embodiment, the first memory module 704 is also used to store message data to the master of the first subdata base Node;The message data of storage is synchronized to the vice-node of the first subdata base by the host node of the first subdata base.Second Memory module 706 is also used at the first time be synchronized to the message data for being stored in the vice-node of the first subdata base every default In second database.
In one embodiment, above-mentioned apparatus further includes the first cleaning modul, for obtaining in the first database The corresponding temporal information of the message data;The temporal information is deleted from the first database more than the preset expiration time Message data.
In one embodiment, above-mentioned apparatus further includes the second cleaning modul, and information is beyond pre- between being used for upon this detection If the message data of time successfully backs up to document data bank, erasing time information exceeds the message data of preset time.
In one embodiment, it as shown in figure 8, above-mentioned apparatus further includes data inquiry module 710, is looked into for obtaining message Request is ask, information query request carries query time information;Obtained from corresponding database according to query time information with The corresponding message data of query time information;When information is more than inquiry duration between when queried, obtained from document data bank super Cross the corresponding message data of inquiry duration;When information is less than inquiry duration between when queried, obtained not from the second database Message data corresponding more than inquiry duration.
Specific about message data storage device limits the limit that may refer to above for message data storage method Fixed, details are not described herein.Modules in above-mentioned message data storage device can fully or partially through software, hardware and its Combination is to realize.Above-mentioned each module can be embedded in the form of hardware or independently of in the processor in computer equipment, can also be with It is stored in the memory in computer equipment in a software form, in order to which processor calls the above modules of execution corresponding Operation.
In one embodiment, a kind of computer equipment is provided, which can be server, internal junction Composition can be as shown in Figure 9.The computer equipment include by system bus connect processor, memory, network interface and Database.Wherein, the processor of the computer equipment is for providing calculating and control ability.The memory packet of the computer equipment Include non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program and data Library.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The calculating The database of machine equipment is for storing message data.The network interface of the computer equipment is used to pass through network with external terminal Connection communication.To realize a kind of message data storage method when the computer program is executed by processor.
It will be understood by those skilled in the art that structure shown in Fig. 9, only part relevant to application scheme is tied The block diagram of structure does not constitute the restriction for the computer equipment being applied thereon to application scheme, specific computer equipment It may include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of computer equipment, including memory and processor are provided, which is stored with Computer program, which performs the steps of when executing computer program obtains the message data that terminal generates;By message Data are stored into first database;The message data being stored in first database is synchronized to the at the first time every default In two databases;The corresponding temporal information of each message data for being stored in the second database is obtained every default second time; When detecting the presence of the temporal information of message data beyond preset time, when by temporal information in message data beyond presetting Between message data back up in document data bank.
In one embodiment, including at least in first database has the first subdata base and the second subdata base.It will disappear Breath data are stored into first database, comprising: when the first subdata base successful connection, message data is stored to the first son Database;When the second subdata base successful connection, after preset time, message data is stored to the second subdata base.
In one embodiment, message data is stored to the first subdata base, comprising: store message data to first The host node of subdata base;The message data of storage is synchronized to the first subdata base by the host node of the first subdata base Vice-node.The message data being stored in first database is synchronized in the second database at the first time every default, comprising: The message data for being stored in the vice-node of the first subdata base is synchronized in the second database at the first time every default.
In one embodiment, the message data being stored in first database is synchronized at the first time every default After in second database, processor also performs the steps of the message obtained in first database when executing computer program The corresponding temporal information of data;Erasing time information is more than the message data of preset expiration time from first database.
In one embodiment, temporal information in message data is being backed up into file beyond the message data of preset time After in database, when information is beyond presetting between processor also performs the steps of upon this detection when executing computer program Between message data when successfully backing up to document data bank, erasing time information exceeds the message data of preset time.
In one embodiment, it is also performed the steps of when processor executes computer program and obtains information query request, Information query request carries query time information;It is obtained from corresponding database according to query time information and query time The corresponding message data of information;When information is more than inquiry duration between when queried, obtaining from document data bank is more than when inquiring Long corresponding message data;When information is less than inquiry duration between when queried, is obtained from the second database and be less than inquiry The corresponding message data of duration.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program performs the steps of when being executed by processor obtains the message data that terminal generates;Message data is stored to first In database;The message data being stored in first database is synchronized in the second database at the first time every default;Often The corresponding temporal information of each message data for being stored in the second database is obtained every default second time;When having detected the presence of When the temporal information of message data exceeds preset time, the message data by temporal information in message data beyond preset time is standby Part is into document data bank.
In one embodiment, including at least in first database has the first subdata base and the second subdata base.It will disappear Breath data are stored into first database, comprising: when the first subdata base successful connection, message data is stored to the first son Database;When the second subdata base successful connection, after preset time, message data is stored to the second subdata base.
In one embodiment, message data is stored to the first subdata base, comprising: store message data to first The host node of subdata base;The message data of storage is synchronized to the first subdata base by the host node of the first subdata base Vice-node.The message data being stored in first database is synchronized in the second database at the first time every default, comprising: The message data for being stored in the vice-node of the first subdata base is synchronized in the second database at the first time every default.
In one embodiment, the message data being stored in first database is synchronized at the first time every default After in second database, is also performed the steps of when computer program is executed by processor and obtain disappearing in first database Cease the corresponding temporal information of data;Erasing time information is more than the message data of preset expiration time from first database.
In one embodiment, temporal information in message data is being backed up into file beyond the message data of preset time After in database, information is beyond default between also performing the steps of upon this detection when computer program is executed by processor When the message data of time successfully backs up to document data bank, erasing time information exceeds the message data of preset time.
In one embodiment, acquisition information query is also performed the steps of when computer program is executed by processor to ask It asks, information query request carries query time information;It is obtained from corresponding database according to query time information and inquiry The corresponding message data of temporal information;When information is more than inquiry duration between when queried, obtaining from document data bank is more than to look into Ask the corresponding message data of duration;When information is less than inquiry duration between when queried, obtains and be less than from the second database Inquire the corresponding message data of duration.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, To any reference of memory, storage, database or other media used in each embodiment provided herein, Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously It cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art It says, without departing from the concept of this application, various modifications and improvements can be made, these belong to the protection of the application Range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.

Claims (10)

1. a kind of message data storage method, which comprises
Obtain the message data that terminal generates;
The message data is stored into first database;
The message data being stored in the first database is synchronized in the second database at the first time every default;
The corresponding temporal information of each message data for being stored in the second database is obtained every default second time;
When detecting the presence of the temporal information of message data beyond preset time, temporal information in the message data is surpassed The message data of preset time backs up in document data bank out.
2. the method according to claim 1, wherein including at least in the first database has the first subdata Library and the second subdata base;It is described to store the message data into first database, comprising:
When the first subdata base successful connection, the message data is stored to first subdata base;
When the second subdata base successful connection, after preset time, the message data is stored to second subnumber According to library.
3. according to the method described in claim 2, it is characterized in that, described store the message data to first subnumber According to library, comprising:
The message data is stored to the host node of first subdata base;
The message data of storage is synchronized to first subdata base by the host node of first subdata base Vice-node;
The message data being stored in the first database is synchronized in the second database at the first time every default, It include: that the message data for being stored in the vice-node of first subdata base is synchronized to second at the first time every default In database.
4. the method according to claim 1, wherein described the will be stored at the first time every default described After the message data in one database is synchronized in the second database, further includes:
Obtain the corresponding temporal information of the message data in the first database;
The message data that the temporal information is more than the preset expiration time is deleted from the first database.
5. the method according to claim 1, wherein when by temporal information in the message data beyond presetting Between message data back up in document data bank after, further includes: between upon this detection information exceed preset time message When data successfully back up to the document data bank, the message data that the temporal information exceeds preset time is deleted.
6. the method according to claim 1, wherein the method also includes:
Information query request is obtained, the information query request carries query time information;
Message data corresponding with the query time information is obtained from corresponding database according to the query time information;
When the query time information is more than inquiry duration, obtaining from the document data bank is more than that inquiry duration is corresponding Message data;
When the query time information is less than inquiry duration, is obtained from second database and be less than inquiry duration pair The message data answered.
7. a kind of message data storage device, which is characterized in that described device includes:
Data acquisition module, for obtaining the message data of terminal generation;
First memory module, for storing the message data into first database;
Second memory module, for every default at the first time that the message data being stored in the first database is same Step is into the second database;
Third memory module obtains each message data corresponding time for being stored in the second database every default second time Information;When detecting the presence of the temporal information of message data beyond preset time, by temporal information in the message data Message data beyond preset time backs up in document data bank.
8. device according to claim 7, which is characterized in that including at least in the first database has the first subdata Library and the second subdata base, first memory module are also used to when the first subdata base successful connection, by the message count According to storing to first subdata base;When the second subdata base successful connection, after preset time, by the message count According to storing to second subdata base.
9. a kind of computer equipment, including memory and processor, the memory are stored with computer program, feature exists In the step of processor realizes any one of claims 1 to 6 the method when executing the computer program.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of method described in any one of claims 1 to 6 is realized when being executed by processor.
CN201811122763.8A 2018-09-26 Message data storage method, device, computer equipment and storage medium Active CN109460438B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811122763.8A CN109460438B (en) 2018-09-26 Message data storage method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811122763.8A CN109460438B (en) 2018-09-26 Message data storage method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109460438A true CN109460438A (en) 2019-03-12
CN109460438B CN109460438B (en) 2024-04-12

Family

ID=

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111611090A (en) * 2020-05-13 2020-09-01 浙江创邻科技有限公司 Distributed message processing method and system
CN111966533A (en) * 2020-07-23 2020-11-20 招联消费金融有限公司 Electronic file management method and device, computer equipment and storage medium
CN112395270A (en) * 2020-11-27 2021-02-23 网络通信与安全紫金山实验室 Data management method, device, equipment and storage medium
CN113468154A (en) * 2021-06-25 2021-10-01 浙江数链科技有限公司 MySQL-based large table volume reduction method and device, electronic device and storage medium
WO2022111733A1 (en) * 2020-11-30 2022-06-02 百果园技术(新加坡)有限公司 Message processing method and apparatus, and electronic device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794246A (en) * 2010-02-24 2010-08-04 成都市华为赛门铁克科技有限公司 Backup storage system, backup system, data backup method and recovery method
CN103176860A (en) * 2011-12-21 2013-06-26 腾讯科技(深圳)有限公司 Data backup method and data backup system
CN104572838A (en) * 2014-12-11 2015-04-29 北京京东尚科信息技术有限公司 Improved system and method for writing data to database
CN106708658A (en) * 2016-11-29 2017-05-24 维沃移动通信有限公司 Data backup method, mobile terminal and storage server
CN108196979A (en) * 2017-12-28 2018-06-22 北京小度信息科技有限公司 Data back up method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794246A (en) * 2010-02-24 2010-08-04 成都市华为赛门铁克科技有限公司 Backup storage system, backup system, data backup method and recovery method
CN103176860A (en) * 2011-12-21 2013-06-26 腾讯科技(深圳)有限公司 Data backup method and data backup system
CN104572838A (en) * 2014-12-11 2015-04-29 北京京东尚科信息技术有限公司 Improved system and method for writing data to database
CN106708658A (en) * 2016-11-29 2017-05-24 维沃移动通信有限公司 Data backup method, mobile terminal and storage server
CN108196979A (en) * 2017-12-28 2018-06-22 北京小度信息科技有限公司 Data back up method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111611090A (en) * 2020-05-13 2020-09-01 浙江创邻科技有限公司 Distributed message processing method and system
CN111611090B (en) * 2020-05-13 2021-12-28 浙江创邻科技有限公司 Distributed message processing method and system
CN111966533A (en) * 2020-07-23 2020-11-20 招联消费金融有限公司 Electronic file management method and device, computer equipment and storage medium
CN112395270A (en) * 2020-11-27 2021-02-23 网络通信与安全紫金山实验室 Data management method, device, equipment and storage medium
WO2022111733A1 (en) * 2020-11-30 2022-06-02 百果园技术(新加坡)有限公司 Message processing method and apparatus, and electronic device
CN113468154A (en) * 2021-06-25 2021-10-01 浙江数链科技有限公司 MySQL-based large table volume reduction method and device, electronic device and storage medium

Similar Documents

Publication Publication Date Title
CN108322533B (en) Configuration and synchronization method between distributed type assemblies node based on operation log
CN109144790A (en) The synthesized backup method and device of MySQL database
CN108932295A (en) Primary database method for handover control, device, computer equipment and storage medium
US10628298B1 (en) Resumable garbage collection
CN110727724B (en) Data extraction method and device, computer equipment and storage medium
CN106776795B (en) Data writing method and device based on Hbase database
CN111125002B (en) Data backup archiving method and system based on distributed storage
US10990312B2 (en) Method, apparatus, device and storage medium for processing data location of storage device
US7315959B2 (en) Real-time remote backup system and related method
US10671567B2 (en) System and method for optimized lock detection
CN114138549A (en) Data backup and recovery method based on kubernets system
CN111966531B (en) Data snapshot method and device, computer equipment and storage medium
US10082969B2 (en) System and method for managing a storage system
US10430115B2 (en) System and method for optimizing multiple packaging operations in a storage system
CN104866245B (en) The method and apparatus of synchronisation snapshot between buffer memory device and storage system
CN109460438A (en) Message data storage method, device, computer equipment and storage medium
CN115686932A (en) Backup set file recovery method and device and computer equipment
CN114328032A (en) Disaster recovery switching processing method and device based on big data double activities and computer equipment
CN116048878A (en) Business service recovery method, device and computer equipment
CN112115166B (en) Data caching method and device, computer equipment and storage medium
CN113312309B (en) Snapshot chain management method, device and storage medium
CN114900532A (en) Power data disaster tolerance method, system, device, computer equipment and storage medium
CN111191082B (en) Data management method, device, computer equipment and storage medium
CN112988708A (en) Version updating method and device, computer readable storage medium and processor
CN109460438B (en) Message data storage method, device, computer equipment and storage medium

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