CN102202073B - Distributed system and data synchronization method thereof - Google Patents

Distributed system and data synchronization method thereof Download PDF

Info

Publication number
CN102202073B
CN102202073B CN201010131403.1A CN201010131403A CN102202073B CN 102202073 B CN102202073 B CN 102202073B CN 201010131403 A CN201010131403 A CN 201010131403A CN 102202073 B CN102202073 B CN 102202073B
Authority
CN
China
Prior art keywords
data
tables
name
updated
service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201010131403.1A
Other languages
Chinese (zh)
Other versions
CN102202073A (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.)
New H3C Technologies Co Ltd
Original Assignee
Hangzhou H3C Technologies 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 Hangzhou H3C Technologies Co Ltd filed Critical Hangzhou H3C Technologies Co Ltd
Priority to CN201010131403.1A priority Critical patent/CN102202073B/en
Publication of CN102202073A publication Critical patent/CN102202073A/en
Application granted granted Critical
Publication of CN102202073B publication Critical patent/CN102202073B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention discloses a distributed system and a data synchronization method thereof. The method comprises the following steps of: when updating of data of a data sheet stored in a main server is monitored, determining whether data of the updated data sheet need to be synchronized to a corresponding service server; if the data of the updated data sheet need to be synchronized to the corresponding service server, acquiring configuration information of the updated data sheet and the address information of the corresponding service server; generating a synchronous notice message according to the acquired configuration information and transmitting the generated synchronous notice message to the service server through the acquired address information; and synchronizing the data of the updated data sheet according to the configuration information in the received synchronous notice message by using the service server. By adopting the method, automatic synchronization of the data sheet is realized, and the civilization complexity is lowered.

Description

A kind of distributed system and method for data synchronization thereof
Technical field
The present invention relates to communication technical field, particularly relate to a kind of distributed system and method for data synchronization thereof.
Background technology
More and more huger along with company information and business, in the process of IT application in enterprises, for enterprise information system, service distribution formula installation and deployment have become best selection, and in distributed system, the storage mode of information is stored by database.Wherein, master data base is used for preserving user's configuration information or business summary information, and by user, is carried out the displaying of service configuration information and summary information; And Service Database is for storage service data, when user interface need to be shown concrete business information, need to inquire about in corresponding Service Database.
As shown in Figure 1, structural representation for a kind of distributed system, wherein, master data base is business configuration database Master, corresponding with distributed master server, for example, and each Service Database (, Service Database slave1 and Service Database slave2) is corresponding with distributed service server.When user is configured business, and while storing master data base into, need corresponding configuration information from master data base, to be synchronized in relevant Service Database, to keep the consistency of configuration information in master data base and Service Database.
In the prior art, master data base and Service Database need synchronous configuration information all when system development, just to determine, for example, while comprising the information such as corresponding table, field, unique identification when this configuration information, when system development, need to determine synchronous which table, which field, and the configuration informations such as unique identification of table.
But, present inventor finds in implementation procedure, in prior art practical application, there is following problem: after distributed system is reached the standard grade, in the time of need to increasing the synchronisation requirement of some configuration informations newly, these configuration informations cannot be from master data base automatic synchronization in corresponding Service Database, thereby need to again develop existing distributed system, and while needing synchrodata between newly-increased distributed server, also need original distributed system to re-start adaptive exploitation, thereby cause lacking versatility and autgmentability.For example, during Development of Distributed System, determine the A field that needs synchronous meter A, if newly-increased synchronisation requirement is the B field of synchronous meter A, need existing distributed system again to develop, the distributed system after exploitation is determined A field and the B field that needs synchronous meter A again.
Summary of the invention
The invention provides a kind of distributed system and method for data synchronization thereof, to realize the automatic synchronization of tables of data, simplify the complexity of becoming civilized.
In order to achieve the above object, the present invention proposes a kind of method of data synchronization of distributed system, the method is applied to comprise in the distributed system of master server and at least one service server, said method comprising the steps of:
When monitoring the data of the tables of data that described master server stores and be updated, determine whether the data of the described tables of data being updated to be synchronized to corresponding service server;
In the time of if the data of the described tables of data being updated need to being synchronized to corresponding described service server, obtain the address information of the configuration information of the described tables of data being updated and the described service server of correspondence;
According to the described configuration information obtaining, generate synchronization notice message, and the described synchronization notice message generating is sent to described service server by the described address information of obtaining;
Described service server, according to the described configuration information in the described synchronization notice message receiving, carries out synchronously the data of the described tables of data being updated.
Determine whether the data of the described tables of data being updated to be synchronized to corresponding service server, specifically comprise:
Whether the table name of the described tables of data that judgement is updated is recorded in the service lists of safeguarding in advance, if the described table name of the described tables of data being updated is recorded in described service lists, determines and the data of the described tables of data being updated need to be synchronized to corresponding described service server;
Wherein, table name and the service identification corresponding to this table name of the tables of data that need to be synchronized to described service server in described service lists, have been recorded.
Described method also comprises:
When the synchronous tables of data of newly-increased described needs in described service server, add table name and the service identification corresponding to this table name of the synchronous tables of data of described needs to described service lists.
The address information of obtaining the configuration information of the described tables of data being updated and the described service server of correspondence, specifically comprises:
According to the table name of the described tables of data being updated, from the system table of described system database, obtain the described configuration information of the tables of data being updated; And
In described service lists, search the described service identification corresponding to table name of the described tables of data being updated; And according to the described service identification finding, from described master server, in pre-stored business service address table, obtain the described address information corresponding with the described service identification finding.
The described configuration information of described tables of data at least comprises: table name, field name information, field type information, uniqueness identification information;
According to the described configuration information obtaining, generate synchronization notice message, specifically comprise:
According to described table name, described field name information, described field type information and described uniqueness identification information, generate described synchronization notice message.
Described service server, according to the described configuration information in the described synchronization notice message receiving, carries out synchronously, specifically comprising to the data of the described tables of data being updated:
Described service server is resolved the described synchronization notice message receiving, to obtain described table name, described field name information, described field type information and described uniqueness identification information;
Whether described service server judging self has stored the of the same name tables of data corresponding with the described table name obtaining; If the tables of data described of the same name of not storage correspondence, described service server is according to the described table name, described field name information, described field type information and the described uniqueness identification information that obtain, newly-built described tables of data of the same name, and according to the table name of newly-built described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in newly-built tables of data described of the same name;
If store corresponding tables of data described of the same name, described field name, described field type and the described uniqueness identification information that described service server basis is obtained,, the described field name of described tables of data of the same name, described field type and uniqueness identification information are upgraded, and according to the table name of described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in described tables of data of the same name.
A distributed system, described distributed system comprises master server and at least one service server, this distributed system also comprises:
Whether monitoring unit, be updated for monitoring the data of the tables of data that described master server stores;
Determining unit, is connected with described monitoring means, while being updated for monitor the data of the tables of data that described master server stores when described monitoring unit, determines whether the data of the described tables of data being updated to be synchronized in corresponding service server;
Acquiring unit, be connected with described determining unit, in the time of the data of the described tables of data being updated need to being synchronized to corresponding described service server for determining when described determining unit, obtain the address information of the configuration information of the described tables of data being updated and the described service server of correspondence;
Notification unit, is connected with described acquiring unit, for generating synchronization notice message according to the described configuration information obtaining, and the described notice message generating is sent to corresponding described service server by the described address information of obtaining;
Described service server, according to the configuration information in the described synchronization notice message receiving, carries out synchronously the data of the described tables of data being updated.
Described system also comprises:
Service lists memory cell, is connected with described determining unit, for storing the service lists of safeguarding in advance; Wherein, described service lists has recorded table name and the service identification corresponding to this table name of the tables of data that need to be synchronized to described service server;
Described determining unit specifically for, whether the table name of the described tables of data that judgement is updated is recorded in described service lists, if the described table name of the described tables of data being updated is recorded in described service lists, determines and the data of the described tables of data being updated need to be synchronized to corresponding described service server.
Described system also comprises:
Service lists updating block, when the synchronous tables of data of newly-increased described needs in described service server, for adding table name and the service identification corresponding to this table name of the synchronous tables of data of described needs to described service lists.
In described master server, store system table and business service address table; Wherein,
Described system table at least stores table name, field name information, field type information, uniqueness identification information;
This business service address table stores more than one service identification and address information corresponding to each this service identification.
Described acquiring unit comprises:
First obtains subelement, for according to the table name of the described tables of data being updated, obtains the described configuration information of the tables of data being updated from described system table; And
Second obtains subelement, for searching the described service identification corresponding to table name of the described tables of data being updated in described service lists, and according to the described service identification finding, from described business service address table, obtain the described address information corresponding with the described service identification finding.
Described notification unit, specifically for obtaining subelement according to described first, obtain described table name, described field name information, described field type information, described uniqueness identification information and generate described synchronization notice message, and the described address information of obtaining according to second acquisition unit, the described synchronization notice message generating is sent to described service server.
Described service server also comprises:
Synchrodata memory cell, for storing tables of data of the same name; Wherein, the table name in described tables of data of the same name is identical with the table name of tables of data in described master server;
Resolution unit, for receiving and resolve described synchronization notice message, to obtain described table name, described field name information, described field type information and described uniqueness identification information;
Lock unit, for judging whether synchrodata memory cell has stored the described of the same name tables of data corresponding with the described table name obtaining; If the tables of data described of the same name of not storage correspondence, the described table name that described lock unit obtains according to described resolution unit, described field name information, described field type information and described uniqueness identification information, newly-built described tables of data of the same name in described synchrodata memory cell, and according to the table name of newly-built described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in newly-built tables of data described of the same name;
If store corresponding tables of data described of the same name, the described field name that described lock unit obtains according to described resolution unit, described field type and described uniqueness identification information, the described uniqueness identification information of described tables of data of the same name, described field name and described field type are upgraded, and according to the table name of described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in corresponding tables of data described of the same name.
Compared with prior art, the present invention has the following advantages:
By usage data table watch-dog, realize the automatic synchronization of tables of data, simplify the complexity of becoming civilized; And there is extensibility, if the demand of newly-increased synchrodata table only needs this table name and affiliated traffic ID to join in the list of traffic ID-table name and can realize, and without original system being carried out to adaptation exploitation.
Accompanying drawing explanation
Fig. 1 is distributed system architecture schematic diagram in prior art;
Fig. 2 is the method for data synchronization flow chart of a kind of distributed system of proposing of the present invention;
Fig. 3 is the schematic diagram of a kind of application scenarios of the present invention;
Fig. 4 is the method for data synchronization flow chart of a kind of distributed system that shown in corresponding diagram 3, application scenarios proposes;
Fig. 5 is a kind of message format schematic diagram of synchronization notice message;
Fig. 6 is the message format schematic diagram of synchronization notice message of the employee table of corresponding diagram 5;
Fig. 7 A and Fig. 7 B are the structure chart of a kind of distributed system of proposing of the present invention.
Embodiment
In the present invention, by the tables of data on usage data table watch-dog monitoring master server, when thereby user carries out business configuration while causing the content of tables of data to be upgraded, whether the table name of the tables of data that inquiry of tables of data watch-dog changes is configuration information to be synchronously updated to the table name of service server, if time, configuration information is notified to service server, and by the synchronous configuration information of service server, thereby realized the automatic synchronization of tables of data, simplified the complexity of becoming civilized.
Based on above-mentioned thought, the invention provides a kind of method of data synchronization of distributed system, be applied to comprise in the distributed system of tables of data watch-dog, master server (corresponding with master data base) and service server (corresponding with Service Database).Wherein, this tables of data watch-dog is realized by modules such as monitoring unit, determining unit, acquiring unit, notification units.These modules that form this tables of data watch-dog both can have been distinguished isolated operation in this distributed system, on master server or service server, also can integral body be embodied as tables of data watch-dog, and equally this tables of data watch-dog may operate on master server, also may operate on other equipment, or independent operating, as long as this tables of data watch-dog can monitor the tables of data on master server.
In embodiments of the present invention, the whole tables of data watch-dog of realizing of above-mentioned each modular unit of take is example, and the operation method of the distributed data base in the embodiment of the present invention and distributed data base is illustrated.
Concrete, on master server, stored tables of data, this tables of data is list item corresponding to business configuration.For example, an employee shown in table 1 shows employee, for storing the essential information of employee of company, wherein, and the tables of data of this employee's table for storing on master server, the employee's of the said firm essential information is corresponding business configuration.In table 1, comprise the fields such as following field: id (uniqueness sign), name (title), phone (phone).
Table 1
Id Name phone
1 Zhang San 13800138000
2 Li Si 13800138001
3 King two 13800138002
Further, on tables of data watch-dog, safeguarded service lists, in this service lists, stored the corresponding relation of service identification (ID) with table name, and the table name recording in this service lists is the table name that needs to be synchronized to the tables of data of service server on master server, this traffic ID (for example operates in business on some service servers for identifying distributed system, Business Name etc.), for example, in the time the employee's table shown in the above-mentioned table 1 of storing on master server need to being synchronized to corresponding service server, the industry ID storing in service lists and the relation of table name are as shown in table 2.
Table 2
Traffic ID Table name
1 (representing employee's business) Employee's table
2
In the embodiment of the present invention, the situation of change of tables of data on described tables of data watch-dog monitoring master server, when the tables of data on master server changes, whether the table name of the tables of data that described tables of data watch-dog changes by inquiry is recorded in service lists, if the table name of the tables of data changing is recorded in service lists, need configuration information corresponding to this tables of data to be synchronized on corresponding service server, to the data of this tables of data are synchronized on corresponding service server.When newly-increased while needing synchronous tables of data in service server, only need to add table name and the service identification corresponding to this table name of the synchronous tables of data of needs to service lists.Wherein, this is newly-increased needs synchronous tables of data to refer to, in master server newly-built and need to be synchronized in the tables of data of corresponding service server and master server, stored but be not yet synchronized to the tables of data in service server.
Based on above-mentioned situation, user carries out business configuration, when the content of tables of data has been carried out to increase, modification or deletion one above operation, and the method for data synchronization that the embodiment of the present invention provides, as shown in Figure 2, further comprising the steps:
Step 201, when the content that tables of data watch-dog monitors this tables of data is upgraded, determines whether the data of the described tables of data being updated to be synchronized to corresponding service server.If so, execution step 202.
In this step, determine whether the data of the described tables of data being updated to be synchronized to corresponding service server, specifically comprise: whether the table name of the described tables of data that judgement is updated is recorded in the service lists of safeguarding in advance, if the described table name of the described tables of data being updated is recorded in described service lists, determines and the data of the described tables of data being updated need to be synchronized to corresponding described service server.If the table name of the tables of data being updated is not recorded in described service lists, table name is synchronized to service server without the data after this tables of data is upgraded.
Concrete, user, when carrying out business configuration, need to upgrade to the content of tables of data (for example, the operations such as increase, modification or deletion), and now, tables of data watch-dog can monitor user's aforesaid operations.For example, for the employee table shown in table 1, if when user carries out business configuration, need to delete king two record, and while increasing the recording of Zhao five, user can carry out corresponding operation at configuration interface, the employee after operation shows as shown in table 3.
Table 3
Id Name phone
1 Zhang San 13800138000
2 Li Si 13800138001
4 Zhao five 13800138003
When user carries out after aforesaid operations, tables of data watch-dog can monitor user's aforesaid operations, and tables of data watch-dog monitors employee table and changes, and whether then inquire about employee's table has corresponding record in described service lists, if sometimes, perform step 202.
Be understandable that, in tables of data watch-dog, in service lists, stored in advance the corresponding relation of table name and traffic ID, and table name in the tables of data of this table name and master server is identical, according to the table name in tables of data and the table name in service lists, this tables of data watch-dog can inquire the table name of tables of data of variation whether in described service lists.For example, when service lists has the record of table name 1, table name 2, and user revises, be in tables of data during the corresponding business configuration content of table name 3, the table name of the tables of data changing is not in described service lists, without the data of the tables of data of table name 3 are carried out synchronously.
Step 202, if in the time of the data of the described tables of data being updated need to being synchronized to corresponding described service server, obtains the address information of the configuration information of the described tables of data being updated and the described service server of correspondence.
When the table name of the tables of data changing has recording of correspondence in described service lists, the corresponding configuration information of table name and data that this tables of data is described need to be synchronized in service server, now, this tables of data watch-dog need to be inquired about corresponding configuration information from the tables of data of master server, the i.e. configuration information of the corresponding business of this table name (can be the descriptor of the corresponding business of this table name), for example, field name information, field type information, uniqueness identification information etc.Certainly, in practical application, this configuration information is not limited to above-mentioned information, in the present invention, repeats no longer in detail.
Concrete, when having obtained the table name of tables of data, can at the system table of database, (this system table be by database maintenance, for example, any one databases such as MS SQLServer, Oracle) in, this tables of data of inquiry (for example, above-mentioned employee's table) configuration information, comprises the field name information of this employee's table, the attributes such as uniqueness identification information of the field type information of each Related fields, this employee's table.
In addition, owing to having stored the corresponding relation of traffic ID and table name in the service lists in tables of data watch-dog, when knowing the table name of tables of data of variation, according to this table name, and above-mentioned corresponding relation, tables of data watch-dog can be known corresponding traffic ID; And according to this traffic ID, continue to find the IP address of service server, then can synchronization notice message be sent to this service server according to this IP address.
It should be noted that in distributed system, all safeguarded the corresponding relation of traffic ID and corresponding service server IP address, according to this traffic ID, can find the IP address of service server.
Step 203, generates synchronization notice message according to the described configuration information obtaining, and the described synchronization notice message generating is sent to described service server by the described address information of obtaining.
After configuration information (descriptor of business) has obtained, need to generate synchronization notice message according to this configuration information, be about to field name information, field type information, uniqueness identification information etc. and be combined into corresponding synchronization notice message.
Step 204, described service server, according to the described configuration information in the described synchronization notice message receiving, carries out synchronously the data of the described tables of data being updated.
When service server receives after this synchronization notice message, described service server is resolved the described synchronization notice message receiving, to obtain described table name, described uniqueness identification information, described field name information and described field type information; Whether described service server judging self has stored the of the same name tables of data corresponding with the described table name obtaining; If the tables of data described of the same name of not storage correspondence, described service server is according to described table name, described uniqueness identification information, described field name information and the described field type information obtained, newly-built described tables of data of the same name, and according to the table name of newly-built described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in newly-built tables of data described of the same name; If store corresponding tables of data described of the same name, described service server is according to the described uniqueness identification information, described field name and the described field type that obtain, the uniqueness identification information of described tables of data of the same name, described field name and described field type are upgraded, and according to the table name of described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in described tables of data of the same name.
For example, the configuration information carrying in synchronization notice message is name and phone, and table name is employee's table; And configuration information in the tables of data of the same name of service server (being that employee shows) is while being name, illustrate that the configuration information in synchronization notice message is different from the configuration information in this tables of data of the same name, configuration information phone need to be updated in the tables of data of the same name of this service server.
Be understandable that, in the present invention, be not limited to by using the configuration information in above-mentioned mode synchronous service server data table, those skilled in the art can be according to the enlightenment of the embodiment of the present invention, the method of synchronization to configuration information changes, for example, when tables of data watch-dog knows that tables of data on master server changes, only by synchronization notice message, the table name of the tables of data changing is notified to corresponding service server, and service server only relatively the table name of this tables of data from it, whether having corresponding tables of data; If have, service server initiatively obtains from master server the configuration information that this table name is corresponding, and upgrade the configuration information in self tables of data, then the data that read the tables of data changing by table name from master server are recorded in the tables of data that the configuration information of self storage upgraded; If no, set up tables of data of the same name (this tables of data of the same name refers to the tables of data identical with the table name of the tables of data of storing on master server) on service server; In this mode the present invention, repeat no longer in detail.
Further, after said process completes, this service server also need to be inquired about the content in the tables of data changing from master server, and according to the content in the tables of data of the same name of the content update in the tables of data of this variation self.And in order more clearly to set forth the process of the content in the tables of data of the same name of this renewal self, and the technical scheme that the present invention proposes is further clearly described, below in conjunction with the application scenarios shown in Fig. 3, the present invention is further detailed.In Fig. 3, comprise tables of data watch-dog, master server (corresponding master data base), service server (corresponding Service Database).As shown in Figure 4, the method for data synchronization of this distributed system comprises the following steps:
Step 401, user carries out business configuration, and to the content in tables of data increase, the operation such as modification or deletion.
Step 402, when tables of data watch-dog monitors tables of data and changes, the list of tables of data watch-dog inquiry business.Due to tables of data watch-dog can be real-time monitor data table,, when user carries out business configuration, tables of data watch-dog can monitor the variation of tables of data.
Implementation process refers to the associated description of Fig. 2 in embodiment, does not repeat them here.
Step 403, when tables of data watch-dog knows that according to monitored results the table name of the tables of data changing has recording of correspondence in service lists, tables of data watch-dog generates synchronization notice message.
Implementation process is asked for an interview the associated description of Fig. 2 in embodiment, does not repeat them here.
After configuration information (descriptor of business) has obtained, need to generate synchronization notice message according to the descriptor of business, be about to field name information, field type information, uniqueness identification information etc. and be combined into corresponding synchronization notice message.As shown in Figure 5, message format schematic diagram for a kind of synchronization notice message, wherein, Fig. 5 represents the synchronous table of needs (SyncTable), at least carried following information: table name (TableName), field identification (IdentityField, this field identification is uniqueness identification information), field name information (FieldName), field type information (FieldType).If synchronization notice message issues with XML (Extensible Markup Language, extend markup language) document format, corresponding above-mentioned employee shows the situation of employee, and corresponding synchronization notice message as shown in Figure 6.In Fig. 6, table name is employee, and uniqueness identification field is called id, and its field type is int, and the field name of other fields comprises name and phone, and its field type is respectively varchar (64) and varchar (16).
Step 404, the IP address of tables of data watch-dog inquiry business server, and according to this IP address, synchronization notice message is sent to service server.
Concrete, while knowing traffic ID due to tables of data watch-dog by service lists, the IP address that finds service server according to this traffic ID (, the data that can determine the tables of data that this need to be changed are synchronized on certain service server in distributed system), then can synchronization notice message be sent to this service server according to this IP address.
Step 405, service server receives synchronization notice message.
Step 406, service server is resolved synchronization notice message, obtains and needs synchronous configuration information.
Step 407, whether service server inquiry there is tables of data of the same name, if there is no, and according to the configuration information in synchronization notice message, newly-built tables of data of the same name; If existed, relatively the configuration information of this tables of data whether with synchronization notice message in accordant configuration information, if inconsistent, according to the configuration information in the configuration information update in synchronization notice message self tables of data of the same name.
Concrete, in service server, also stored and tables of data corresponding in master server, for example, in master server, stored the employee shown in table 1 while showing, when need to by this tables of data at corresponding service server synchronously, also needing the employee's table shown in storage list 1 in corresponding service server.
When user carries out business configuration, the employee table shown in table 1 is revised as to the employee shown in table 3 while showing, the synchronization notice message that tables of data watch-dog sends to service server, as shown in Figure 6, when service server receives above-mentioned synchronization notice message, resolve this synchronization notice message, whether service server there is tables of data of the same name by inquiry, whether i.e. inquiry deposits employee's table, and now in this service server, stored employee's table, now, the configuration information that needs further the tables of data of self relatively whether with synchronization notice message in accordant configuration information.Wherein, field name in the configuration information of employee's table of storing in this service server comprises Id, name and tri-fields of phone, and in synchronization notice message, also carried the configuration information of above-mentioned three fields, be the configuration information of tables of data and the accordant configuration information in this synchronization notice message, do not need additionally to increase field name.If while also having carried the field name of address and corresponding field type in synchronization notice message, configuration information and the configuration information in this synchronization notice message that tables of data is described are inconsistent, now, need to show additionally to increase field name address this employee, , service server receives synchronization notice message, resolve after synchronization notice message, obtain the configuration information of synchronous meter, in query traffic data storehouse, whether there is tables of data of the same name, if there is tables of data of the same name, judge data list structure of the same name, whether field type is consistent with the tables of data in database, if consistent, the list structure of tables of data of the same name or field type are not upgraded, if inconsistent, updating form structure or field type.
Step 408, service server is inquired about the content that this table name is corresponding from master server, and according to the content in the tables of data of the same name of content update self corresponding to this table name.Wherein, the content that this table name is corresponding is the content in the tables of data of variation.
Concrete, in above-mentioned steps, service server has known that the table name of the tables of data of variation is employee, in this step, this service server can be inquired about the content that this table name is corresponding according to this table name employee in master server, the content inquiring is as shown in table 3, and the tables of data of the same name of the employee of self correspondence is the employee tables of data (as shown in table 1) before changing in master data base, this service server need to be according to the content of the employee tables of data of the content update in this table 3 self storage, thereby make the data of the employee tables of data in this service server can be synchronized to the content shown in table 3, the data that are about to employee table in master server are synchronously updated in the employee tables of data of this service server.
Further, in the process of service server in the content synchronization in employee tables of data in master server being updated to the employee tables of data of self storage, whether the content that need to compare in self employee tables of data is consistent with the content in employee tables of data in master server.Wherein, the information in the employee tables of data of storing in this service server with Zhang San, Li Si and king two, and in master server in employee table in have Zhang San, Li Si and Zhao's five information, therefore, need to delete the information of king two in employee's table of storing in service server, and according to the content in employee table in master server, increase Zhao five information.
It should be noted that, due in field identification, field name information and field type information, field name information and field type information be not unique sign (for example, may there be several Zhang San), therefore, when whether the content of the content in self tables of data relatively in showing with employee in master server be consistent, need to compare according to field identification (uniqueness sign), this comparison procedure is specially: service server knows that the tables of data of master server is content A, and in service server, data query table content is B.By poll A and B, the Identity Field:(1 of more every record respectively) if the value of the Identity Field of certain record is only present in A, show that this is recorded as newly-increased, need in B, insert this record; (2) if the value of the Identity Field of certain record is only present in B, show that this record deleted by user, need in B, delete this record; (3) if the value of the IdentityField of certain record is present in A, B simultaneously, show that this record may be modified, according to the value of this record of A, upgrade the corresponding record in B.
In summary it can be seen, in the present invention, by usage data table watch-dog, can be by the tables of data automatic synchronization changing on master server to service server, thus simplified the complexity of exploitation; And there is extensibility, if need to increase synchrodata table newly, only the table name of this tables of data and affiliated traffic ID need to be joined in service lists, and not need original system to carry out adaptation exploitation.
Wherein, the inventive method can be adjusted each step order according to actual needs.
Inventive concept based on same with said method, the invention allows for a kind of distributed system that can apply said method, described distributed system comprises master server and at least one service server, as shown in Fig. 7 A and Fig. 7 B, wherein, Fig. 7 A is the structural representation of tables of data watch-dog, the structural representation that Fig. 7 B is service server.This distributed system also comprises:
Whether monitoring unit 10, be updated for monitoring the data of the tables of data that described master server stores.
Determining unit 20, be connected with described monitoring means 10, while being updated for monitor the data of the tables of data that described master server stores when described monitoring unit 10, determine whether the data of the described tables of data being updated to be synchronized in corresponding service server.
Acquiring unit 30, be connected with described determining unit 20, in the time of the data of the described tables of data being updated need to being synchronized to corresponding described service server for determining when described determining unit 20, obtain the address information of the configuration information of the described tables of data being updated and the described service server of correspondence.
Notification unit 40, is connected with described acquiring unit 30, for generating synchronization notice message according to the described configuration information obtaining, and the described notice message generating is sent to corresponding described service server by the described address information of obtaining.
Described service server, according to the configuration information in the described synchronization notice message receiving, carries out synchronously the data of the described tables of data being updated.
In the present invention, described system also comprises:
Service lists memory cell 50, is connected with described determining unit 20, for storing the service lists of safeguarding in advance; Wherein, described service lists has recorded table name and the service identification corresponding to this table name of the tables of data that need to be synchronized to described service server.
Described determining unit 20 specifically for, whether the table name of the described tables of data that judgement is updated is recorded in described service lists, if the described table name of the described tables of data being updated is recorded in described service lists, determines and the data of the described tables of data being updated need to be synchronized to corresponding described service server.
Described system also comprises:
Service lists updating block 60, be connected with service lists memory cell 50, when the synchronous tables of data of newly-increased described needs in described service server, for adding table name and the service identification corresponding to this table name of the synchronous tables of data of described needs to described service lists.
In the present invention, in described master server, store system table and business service address table; Wherein,
Described system table at least stores table name, field name information, field type information, uniqueness identification information; This business service address table stores more than one service identification and address information corresponding to each this service identification.
In view of the situation, described acquiring unit 30 comprises:
First obtains subelement 31, for according to the table name of the described tables of data being updated, obtains the described configuration information of the tables of data being updated from described system table; And
Second obtains subelement 32, for searching the described service identification corresponding to table name of the described tables of data being updated in described service lists, and according to the described service identification finding, from described business service address table, obtain the described address information corresponding with the described service identification finding.
In the present invention, described notification unit 40, specifically for obtaining subelement according to described first, obtain described table name, described field name information, described field type information, described uniqueness identification information and generate described synchronization notice message, and the described address information of obtaining according to second acquisition unit, the described synchronization notice message generating is sent to described service server.
In the present invention, described service server also comprises:
Synchrodata memory cell 70, for storing tables of data of the same name; Wherein, the table name in described tables of data of the same name is identical with the table name of tables of data in described master server;
Resolution unit 80, for receiving and resolve described synchronization notice message, to obtain described table name, described field name information and described field type information, described uniqueness identification information;
Lock unit 90, for judging whether synchrodata memory cell has stored the described of the same name tables of data corresponding with the described table name obtaining; If the tables of data described of the same name of not storage correspondence, the described table name that described lock unit obtains according to described resolution unit, described field name information, described field type information and described uniqueness identification information, newly-built described tables of data of the same name in described synchrodata memory cell, and according to the table name of newly-built described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in newly-built tables of data described of the same name;
If store corresponding tables of data described of the same name, field name and described uniqueness identification information described in the described field type that described lock unit obtains according to described resolution unit, the described field name of described tables of data of the same name, described field type and described uniqueness identification information are upgraded, and according to the table name of described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in corresponding tables of data described of the same name.
As mentioned above, in the embodiment of the present invention, the unit module of this system can be integrated in one, and also can separatedly dispose.Said units module can be merged into a device, as tables of data watch-dog, also can further split into a plurality of submodules.
Through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by hardware, and the mode that also can add necessary general hardware platform by software realizes.Understanding based on such, technical scheme of the present invention can embody with the form of software product, it (can be CD-ROM that this software product can be stored in a non-volatile memory medium, USB flash disk, portable hard drive etc.) in, comprise some instructions with so that computer equipment (can be personal computer, server, or the network equipment etc.) carry out the method described in each embodiment of the present invention.
It will be appreciated by those skilled in the art that accompanying drawing is the schematic diagram of a preferred embodiment, the module in accompanying drawing or flow process might not be that enforcement the present invention is necessary.
It will be appreciated by those skilled in the art that the module in the device in embodiment can be distributed in the device of embodiment according to embodiment description, also can carry out respective change and be arranged in the one or more devices that are different from the present embodiment.The module of above-described embodiment can be merged into a module, also can further split into a plurality of submodules.
The invention described above sequence number, just to describing, does not represent the quality of embodiment.
Disclosed is above only several specific embodiment of the present invention, and still, the present invention is not limited thereto, and the changes that any person skilled in the art can think of all should fall into protection scope of the present invention.

Claims (9)

1. a method of data synchronization for distributed system, is characterized in that, the method is applied to comprise in the distributed system of master server and at least one service server, said method comprising the steps of:
When monitoring the data of the tables of data that described master server stores and be updated, determine whether the data of the described tables of data being updated to be synchronized to corresponding service server;
In the time of if the data of the described tables of data being updated need to being synchronized to corresponding described service server, obtain the address information of the configuration information of the described tables of data being updated and the described service server of correspondence;
According to the described configuration information obtaining, generate synchronization notice message, and the described synchronization notice message generating is sent to described service server by the described address information of obtaining;
Described service server, according to the described configuration information in the described synchronization notice message receiving, carries out synchronously the data of the described tables of data being updated;
Wherein, determine whether the data of the described tables of data being updated to be synchronized to corresponding service server, specifically comprise:
Whether the table name of the described tables of data that judgement is updated is recorded in the service lists of safeguarding in advance, if the described table name of the described tables of data being updated is recorded in described service lists, determines and the data of the described tables of data being updated need to be synchronized to corresponding described service server;
Wherein, obtain the address information of the configuration information of the described tables of data being updated and the described service server of correspondence, specifically comprise:
According to the table name of the described tables of data being updated, from the system table of system database, obtain the described configuration information of the tables of data being updated; And
In described service lists, search the service identification corresponding to table name of the described tables of data being updated; And according to the described service identification finding, from described master server, in pre-stored business service address table, obtain the described address information corresponding with the described service identification finding;
Wherein, table name and the service identification corresponding to this table name of the tables of data that need to be synchronized to described service server in described service lists, have been recorded.
2. the method for claim 1, is characterized in that, described method also comprises:
When the synchronous tables of data of newly-increased described needs in described service server, add table name and the service identification corresponding to this table name of the synchronous tables of data of described needs to described service lists.
3. the method for claim 1, is characterized in that, the described configuration information of described tables of data at least comprises: table name, field name information, field type information and uniqueness identification information;
According to the described configuration information obtaining, generate synchronization notice message, specifically comprise:
According to described table name, described field name information, described field type information and described uniqueness identification information, generate described synchronization notice message.
4. method as claimed in claim 3, is characterized in that, described service server, according to the described configuration information in the described synchronization notice message receiving, carries out synchronously, specifically comprising to the data of the described tables of data being updated:
Described service server is resolved the described synchronization notice message receiving, to obtain described table name, described field name information, described field type information and described uniqueness identification information;
Whether described service server judging self has stored the of the same name tables of data corresponding with the described table name obtaining; If the tables of data described of the same name of not storage correspondence, described service server is according to the described table name, described field name information, described field type information and the described uniqueness identification information that obtain, newly-built described tables of data of the same name, and according to the table name of newly-built described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in newly-built tables of data described of the same name;
If store corresponding tables of data described of the same name, described service server is according to the described field name, described field type and the uniqueness identification information that obtain, the described field name of described tables of data of the same name, described field type and described uniqueness identification information are upgraded, and according to the table name of described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in described tables of data of the same name.
5. a distributed system, described distributed system comprises master server and at least one service server, it is characterized in that, this distributed system also comprises:
Whether monitoring unit, be updated for monitoring the data of the tables of data that described master server stores;
Determining unit, is connected with described monitoring unit, while being updated for monitor the data of the tables of data that described master server stores when described monitoring unit, determines whether the data of the described tables of data being updated to be synchronized in corresponding service server;
Acquiring unit, be connected with described determining unit, in the time of the data of the described tables of data being updated need to being synchronized to corresponding described service server for determining when described determining unit, obtain the address information of the configuration information of the described tables of data being updated and the described service server of correspondence;
Notification unit, is connected with described acquiring unit, for generating synchronization notice message according to the described configuration information obtaining, and the described synchronization notice message generating is sent to corresponding described service server by the described address information of obtaining;
Described service server, according to the configuration information in the described synchronization notice message receiving, carries out synchronously the data of the described tables of data being updated;
Service lists memory cell, is connected with described determining unit, for storing the service lists of safeguarding in advance; Wherein, described service lists has recorded table name and the service identification corresponding to this table name of the tables of data that need to be synchronized to described service server;
Wherein, described determining unit specifically for, whether the table name of the described tables of data that judgement is updated is recorded in described service lists, if the described table name of the described tables of data being updated is recorded in described service lists, determines and the data of the described tables of data being updated need to be synchronized to corresponding described service server;
Wherein, described acquiring unit specifically comprises:
First obtains subelement, for according to the table name of the described tables of data being updated, obtains the described configuration information of the tables of data being updated from system table; And
Second obtains subelement, for searching the described service identification corresponding to table name of the described tables of data being updated in described service lists, and according to the described service identification finding, from the table of business address of service, obtain the described address information corresponding with the described service identification finding.
6. system as claimed in claim 5, is characterized in that, described system also comprises:
Service lists updating block, when the synchronous tables of data of newly-increased described needs in described service server, for adding table name and the service identification corresponding to this table name of the synchronous tables of data of described needs to described service lists.
7. system as claimed in claim 5, is characterized in that, stores system table and business service address table in described master server; Wherein,
Described system table at least stores table name, field name information, field type information and uniqueness identification information;
This business service address table stores more than one service identification and address information corresponding to each this service identification.
8. system as claimed in claim 5, is characterized in that,
Described notification unit, specifically for obtaining subelement according to described first, obtain described table name, described field name information, described field type information and described uniqueness identification information and generate described synchronization notice message, and the described address information of obtaining according to second acquisition unit, the described synchronization notice message generating is sent to described service server.
9. system as claimed in claim 8, is characterized in that, described service server also comprises:
Synchrodata memory cell, for storing tables of data of the same name; Wherein, the table name in described tables of data of the same name is identical with the table name of tables of data in described master server;
Resolution unit, for receiving and resolve described synchronization notice message, to obtain described table name, described field name information, described field type information and described uniqueness identification information;
Lock unit, for judging whether synchrodata memory cell has stored the described of the same name tables of data corresponding with the described table name obtaining; If the tables of data described of the same name of not storage correspondence, the described table name that described lock unit obtains according to described resolution unit, described field name information, described field type information and described uniqueness identification information, newly-built described tables of data of the same name in described synchrodata memory cell, and according to the table name of newly-built described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in newly-built tables of data described of the same name;
If store corresponding tables of data described of the same name, the described field name that described lock unit obtains according to described resolution unit, described field type and described uniqueness identification information, the described uniqueness identification information of described tables of data of the same name, described field name and described field type are upgraded, and according to the table name of described tables of data of the same name, from described master server, read the data of this tables of data being updated, the described data that read are recorded in corresponding tables of data described of the same name.
CN201010131403.1A 2010-03-24 2010-03-24 Distributed system and data synchronization method thereof Active CN102202073B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010131403.1A CN102202073B (en) 2010-03-24 2010-03-24 Distributed system and data synchronization method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010131403.1A CN102202073B (en) 2010-03-24 2010-03-24 Distributed system and data synchronization method thereof

Publications (2)

Publication Number Publication Date
CN102202073A CN102202073A (en) 2011-09-28
CN102202073B true CN102202073B (en) 2014-05-07

Family

ID=44662468

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010131403.1A Active CN102202073B (en) 2010-03-24 2010-03-24 Distributed system and data synchronization method thereof

Country Status (1)

Country Link
CN (1) CN102202073B (en)

Families Citing this family (38)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102387213A (en) * 2011-10-25 2012-03-21 中兴通讯股份有限公司 Data synchronization method and device
CN102495739B (en) * 2011-11-03 2017-05-24 中兴通讯股份有限公司 Data compatible method and system as well as inter-plate message method and system
CN102722514B (en) * 2011-12-30 2017-11-10 新奥特(北京)视频技术有限公司 A kind of method that Remote Dynamic creates database
CN102724295B (en) * 2012-05-24 2016-05-18 中国电子科技集团公司第十五研究所 Method of data synchronization and system
CN103577422B (en) * 2012-07-24 2017-11-14 腾讯科技(深圳)有限公司 The processing method and system of a kind of Bidirectional-mappindatalation datalation
CN102915338A (en) * 2012-09-18 2013-02-06 浪潮(北京)电子信息产业有限公司 Data synchronization method of distributed file systems and file systems
CN103856517B (en) * 2012-11-30 2017-06-23 英业达科技有限公司 Sync equalizing system and method
CN103051686B (en) * 2012-12-10 2018-03-27 北京普泽创智数据技术有限公司 A kind of method and system of distributed system dynamic application isolation
CN104468148B (en) * 2013-09-12 2019-03-22 中兴通讯股份有限公司 A kind of nginx server configuring maintenance method and system
CN103997525B (en) * 2014-05-21 2017-10-20 北京天禾元创软件股份有限公司 A kind of Distributed Data Synchronization method and system
CN105530269B (en) * 2014-09-28 2019-04-09 阿里巴巴集团控股有限公司 Data interactive method and system and server
CN104410511B (en) * 2014-10-27 2018-07-06 浪潮(北京)电子信息产业有限公司 A kind of server management method and system
CN106708891A (en) * 2015-11-17 2017-05-24 中兴通讯股份有限公司 Network management data synchronizing method and device
CN105512283B (en) * 2015-12-04 2019-05-03 国网江西省电力公司信息通信分公司 Data quality management control method and device
CN105743970A (en) * 2015-12-31 2016-07-06 武汉传神信息技术有限公司 Asynchronous data synchronization method for distributed systems
CN105610985B (en) * 2016-03-14 2018-10-09 北京国电通网络技术有限公司 A kind of synchronous method of server ip address
CN105824916B (en) * 2016-03-16 2019-05-31 上海携程商务有限公司 Data synchronous system and method
CN105847378B (en) * 2016-04-13 2019-06-28 北京思特奇信息技术股份有限公司 A kind of method and system for realizing that big data is synchronous
CN106815286B (en) * 2016-12-05 2020-09-11 大唐网络有限公司 File processing method
CN106777019B (en) * 2016-12-08 2019-08-27 腾讯科技(深圳)有限公司 A kind of monitoring method and monitoring server of HBase system
US11316775B2 (en) 2016-12-21 2022-04-26 Juniper Networks, Inc. Maintaining coherency in distributed operating systems for network devices
US11316744B2 (en) 2016-12-21 2022-04-26 Juniper Networks, Inc. Organizing execution of distributed operating systems for network devices
US10887173B2 (en) 2016-12-21 2021-01-05 Juniper Networks, Inc. Communicating state information in distributed operating systems
CN108270609B (en) * 2017-01-04 2021-10-15 武汉斗鱼网络科技有限公司 Method and device for updating configuration file of website server
CN106874389B (en) * 2017-01-11 2023-04-07 腾讯科技(深圳)有限公司 Data migration method and device
CN106709066B (en) * 2017-01-19 2020-05-19 杭州数梦工场科技有限公司 Data synchronization method and device
CN108228695A (en) * 2017-06-30 2018-06-29 勤智数码科技股份有限公司 A kind of dynamic real-time update method of business datum
CN108696595A (en) * 2018-05-28 2018-10-23 郑州云海信息技术有限公司 Distributed type assemblies method of data synchronization, master node, slave node, system and medium
CN109325030B (en) * 2018-09-03 2023-08-18 平安国际融资租赁有限公司 Message processing method, device, computer equipment and storage medium
CN109408565B (en) * 2018-10-19 2021-09-28 浪潮软件科技有限公司 Data synchronous interaction method, system and data interaction platform
US11095742B2 (en) 2019-03-27 2021-08-17 Juniper Networks, Inc. Query proxy for delivery of dynamic system state
CN110365809B (en) * 2019-07-23 2021-12-14 中南民族大学 Distributed server address configuration system and method
CN110704273B (en) * 2019-08-28 2024-01-05 贝壳技术有限公司 Processing method and device of configuration information, electronic equipment and storage medium
CN111061745A (en) * 2019-10-10 2020-04-24 望海康信(北京)科技股份公司 Data synchronization system and method
CN111831661A (en) * 2020-07-20 2020-10-27 江苏云柜网络技术有限公司 Database filing method based on express business logic
CN112131239A (en) * 2020-09-30 2020-12-25 腾讯科技(深圳)有限公司 Data processing method, computer equipment and readable storage medium
CN113254535B (en) * 2021-06-08 2022-12-13 成都新潮传媒集团有限公司 Method and device for synchronizing data from mongodb to mysql and computer readable storage medium
CN116528337A (en) * 2022-01-22 2023-08-01 华为技术有限公司 Business collaboration method, electronic device, readable storage medium, and chip system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1493984A (en) * 2002-11-01 2004-05-05 英业达股份有限公司 Distribution type data synchronous system and its method
CN101521606A (en) * 2009-04-10 2009-09-02 北京星网锐捷网络技术有限公司 Log information processing method, log server and communication system
CN101540726A (en) * 2009-04-27 2009-09-23 华为技术有限公司 Method, client, server and system of synchronous data

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
MY162141A (en) * 2007-12-28 2017-05-31 Univ Sains Malaysia A method for information conferencing and a system therefor

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1493984A (en) * 2002-11-01 2004-05-05 英业达股份有限公司 Distribution type data synchronous system and its method
CN101521606A (en) * 2009-04-10 2009-09-02 北京星网锐捷网络技术有限公司 Log information processing method, log server and communication system
CN101540726A (en) * 2009-04-27 2009-09-23 华为技术有限公司 Method, client, server and system of synchronous data

Also Published As

Publication number Publication date
CN102202073A (en) 2011-09-28

Similar Documents

Publication Publication Date Title
CN102202073B (en) Distributed system and data synchronization method thereof
CN102129478B (en) Database synchronization method and system thereof
CN100449548C (en) Method and system for synchronizing data base
CN103634144B (en) The configuration file management method of many IDC clusters, system and equipment
US8321860B2 (en) Local collector
CN1691677B (en) Method, system and apparatus for managing computer identity
CN109299157B (en) Data export method and device for distributed big single table
CN101464895A (en) Method, system and apparatus for updating internal memory data
CN104657430A (en) Method and system for data acquisition
CN112052247A (en) Index updating system, method and device of search engine, electronic equipment and storage medium
CN103064757A (en) Method and system for backing up data
CN103634346A (en) Data distribution method and system for network data center
CN110765205A (en) Block chain based metadata management method, system and computer storage medium
CN105446824B (en) Table increment acquisition methods and long-distance data backup method
CN111090803A (en) Data processing method and device, electronic equipment and storage medium
CN105743952B (en) A kind of method for processing business, server and ERP client
US7599903B2 (en) Systems and methods for extracting data sets from an online relational database into a data warehouse
CN103905512A (en) Data processing method and equipment
CN107656943B (en) Task query method and server
CN108900497B (en) Data synchronization method and system between heterogeneous systems
CN105530299A (en) Directory service log realization method
CN111090648B (en) Relational database data synchronization conflict resolution method
CN102333070A (en) Method and device for obtaining information
CN102508926A (en) Catalog data parsing method and system
CN107038179B (en) Information item storage method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address

Address after: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No.

Patentee after: Xinhua three Technology Co., Ltd.

Address before: 310053 Hangzhou hi tech Industrial Development Zone, Zhejiang province science and Technology Industrial Park, No. 310 and No. six road, HUAWEI, Hangzhou production base

Patentee before: Huasan Communication Technology Co., Ltd.

CP03 Change of name, title or address