CN111158928B - Distributed system and communication method - Google Patents

Distributed system and communication method Download PDF

Info

Publication number
CN111158928B
CN111158928B CN201911311187.6A CN201911311187A CN111158928B CN 111158928 B CN111158928 B CN 111158928B CN 201911311187 A CN201911311187 A CN 201911311187A CN 111158928 B CN111158928 B CN 111158928B
Authority
CN
China
Prior art keywords
event
server
address information
micro
message
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
CN201911311187.6A
Other languages
Chinese (zh)
Other versions
CN111158928A (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.)
Neusoft Corp
Original Assignee
Neusoft Corp
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 Neusoft Corp filed Critical Neusoft Corp
Priority to CN201911311187.6A priority Critical patent/CN111158928B/en
Publication of CN111158928A publication Critical patent/CN111158928A/en
Application granted granted Critical
Publication of CN111158928B publication Critical patent/CN111158928B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • G06F16/24561Intermediate data storage techniques for performance improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The present disclosure relates to a distributed system and communication method, wherein the system includes message middleware and a plurality of micro servers; the first micro server is used for generating an event message according to the data updating information in the first micro server, wherein the event message comprises event processing information and address information of a destination server, and sending the event message to the message middleware; the second micro server is used for acquiring the event message in the message middleware, judging whether the address information of the destination server included in the event message is consistent with the address information of the second micro server, and generating a local event according to the event processing information included in the event message when the address information of the destination server is consistent with the address information of the second micro server.

Description

Distributed system and communication method
Technical Field
The present disclosure relates to the field of information technology, and in particular, to a distributed system and a communication method.
Background
In the distributed system, each micro server keeps data synchronization, when one micro server updates data, updated data information is uploaded to the message middleware, and after other micro servers monitor the updated data information, the data in the micro servers can be updated according to the information.
However, in some cases, some of the data only needs to be updated, other micro servers do not need to be updated, and if the data between the micro servers remains synchronized, the data that does not need to be synchronized needs to be manually deleted, increasing the manpower burden and wasting computing resources.
Disclosure of Invention
The disclosure is directed to a distributed system and a communication method, so as to solve the above technical problems.
To achieve the above object, a first aspect of the present disclosure provides a distributed system including message middleware and a plurality of micro servers; the first micro server is used for generating an event message according to the data updating information in the first micro server, wherein the event message comprises event processing information and address information of a destination server, and sending the event message to the message middleware; the second micro server is used for acquiring the event message in the message middleware, judging whether the address information of the destination server included in the event message is consistent with the address information of the second micro server, and generating a local event according to the event processing information included in the event message when the address information of the destination server is consistent with the address information of the second micro server.
Optionally, the first micro server is further configured to: before the event message is sent to a message middleware, determining that the address information of the destination server included in the event message is inconsistent with the address information of the first micro server; the first micro server is further configured to generate a local event according to the event processing information when it is determined that address information of the destination server included in the event message is consistent with address information of the first micro server.
Optionally, the event message generated by the first micro server further includes source address information and event topic information, where the source address information is address information of the first micro server.
Optionally, the address information includes IP address information and port information of the destination server.
Optionally, the second micro server is further configured to determine, before determining whether address information of a destination server included in the event message is consistent with address information of the second micro server, that event topic information included in the event message matches with a topic of the second micro server; the second server is further configured to: and stopping processing the event message when determining that the event topic information included in the event message does not match with the topic of the second micro server.
Optionally, the event message further includes source address information, where the source address information is address information of a micro server that issues the event message; the second micro server is further used for judging whether the source address information is consistent with the address information of the second micro server; and stopping processing the event message when the source address information is consistent with the address information of the second micro server.
In a second aspect of the present disclosure, there is provided a communication method of a distributed system, the method comprising: a first micro server of the distributed system generates an event message according to data updating information in the first micro server, wherein the event message comprises event processing information and address information of a destination server, and the event message is sent to a message middleware; and the second micro server of the distributed system acquires the event message in the message middleware, judges whether the address information of the destination server included in the event message is consistent with the address information of the second micro server, and generates a local event according to the event processing information included in the event message when the address information of the destination server is consistent with the address information of the second micro server.
Optionally, the sending, by the first micro server, the event message to a message middleware includes: when the address information of the destination server included in the event message is inconsistent with the address information of the first micro server, the event message is sent to a message middleware; the method further comprises the steps of: and when the first micro server determines that the address information of the destination server included in the event message is consistent with the address information of the first micro server, generating a local event according to the event processing information.
Optionally, before determining whether the address information of the destination server included in the event message is consistent with the address information of the second micro server, the method further includes: the second micro server determines that the event topic information included in the event message is matched with the topic of the second micro server;
the method further comprises the steps of: and the second micro server stops processing the event message when determining that the event topic information included in the event message is not matched with the topic of the second micro server.
Optionally, before determining whether the address information of the destination server included in the event message is consistent with the address information of the second micro server, the method further includes: the second micro server determines that the source address information included in the event message is consistent with the address information of the second micro server;
The method further comprises the steps of: and the second micro server stops processing the event message when determining that the source address information included in the event message is inconsistent with the address information of the second micro server.
According to the technical scheme, when the first micro server performs data synchronization, the data to be synchronized is not directly uploaded to the message middleware, but is packaged into the data updating information, and the data updating information and the address information of the target server together form an event message to be uploaded to the message middleware, so that the second server can judge whether the address information of the target server is consistent with the address information of the second server after obtaining the event message, and a local event is generated according to the data updating information when the address information of the target server is consistent with the address information of the second server. In this way, the message and the update data in the message middleware are decoupled, and the micro server does not update the data of the micro server according to the update data uploaded to the message middleware by other micro servers, but issues a local event for updating the data according to the data update information in the event message of which the address information in the message middleware is matched with the address information of the micro server, so that the logic of event processing is optimized, and the effect of directionally issuing the update data to the designated micro server in the distributed system can be achieved.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of the disclosure, and are incorporated in and constitute a part of this specification, illustrate the disclosure and together with the description serve to explain, but do not limit the disclosure. In the drawings:
FIG. 1 is a block diagram of a distributed system, according to an exemplary disclosed embodiment.
Fig. 2 is a flow chart illustrating a method of communication of a distributed system according to an exemplary disclosed embodiment.
Fig. 3 is a flow chart illustrating a method of communication for a distributed system applied to a first micro server according to an exemplary disclosed embodiment.
FIG. 4 is a flow diagram illustrating a first micro server publishing event according to an exemplary disclosed embodiment.
Fig. 5 is a flow chart illustrating a method of communication for a distributed system applied to a second micro server, according to an exemplary disclosed embodiment.
FIG. 6 is a flow diagram illustrating a second micro server processing an event according to an exemplary disclosed embodiment.
FIG. 7 is a block diagram of a micro server, according to an exemplary disclosed embodiment.
Detailed Description
Specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating and illustrating the disclosure, are not intended to limit the disclosure.
First, an implementation scenario of the present disclosure will be described. The distributed system of the present disclosure may be a system requiring data synchronization, such as a corporate system, a gaming system, etc., where different micro-servers assume different functions, for example, in a corporate system, a financial module may be integrated in one micro-server, a personnel module may be integrated in another micro-server, and a business process module may be integrated in another micro-server, where upon a data update (e.g., personnel change in a personnel module), the other micro-servers may or may not need to synchronize the updated data (e.g., the financial module needs to update the data for the personnel change).
FIG. 1 is a block diagram of a distributed system, according to an exemplary disclosed embodiment. As shown in fig. 1, the system includes a message middleware and a plurality of micro servers (such as a micro server 1, a micro server 2 and a micro server 3), where each micro server may be used as a first micro server or may be used as a second micro server, that is, each micro server may issue its own event message, and obtain the event message from the message middleware.
The first micro server is used for generating an event message according to the data updating information in the first micro server, wherein the event message comprises event processing information and address information of a destination server, and sending the event message to a message middleware;
the second micro server is used for acquiring the event message in the message middleware, judging whether the address information of the destination server included in the event message is consistent with the address information of the second micro server, and generating a local event according to the event processing information included in the event message when the address information of the destination server is consistent with the address information of the second micro server.
The event processing information may be information indicating what kind of data update is performed by the first micro server, and may be in a form of combining an event type with variable data when a predefined event exists in the system. For example, when a user data is newly added in the first micro server, event processing information indicating the newly added user data of other micro servers can be generated according to the data updating information of the newly added event; alternatively, the code of the event of the newly added user data may be predefined as a1 in the system, and the event processing information may be a combination of the code a1 and the data specifically required to perform the operation.
The address information may include IP (Internet Protocol, network protocol) information and port information. Several micro servers may be located in the same host, share the same IP, and different micro servers on the same host may have different ports, so that one micro server may be uniquely determined according to the IP information and the port information. For example, the two micro servers designated by 127.0.0.1:8080 and 127.0.0.1:8090 have an IP of 127.0.0.1 and ports of 8080 and 8090, respectively.
There may be address information of a plurality of destination servers in an event message, so that a plurality of designated micro servers may update data according to the event message. It should be noted that, the port information in the address information may be a specific port name, such as 8080 or 8090, or may be replaced by a predetermined symbol, and when the port information is a predetermined symbol, the micro server pointed to by the address information is all the micro servers included in the IP information in the address information.
For example, the event message may have first address information 127.0.0.1:8080 and second address information 127.0.0.1:8090, and the destination server of the event message is a micro server with an IP of 127.0.0.1 and a port of 8080, and a micro server with an IP of 127.0.0.1 and a port of 8090; the address information of the destination server in the event message may be 127.0.0.1, where "" is the predetermined symbol, and the destination servers of the event message are all micro servers with an IP of 127.0.0.1, including 127.0.0.1:8080 and 127.0.0.1:8090.
It should be noted that, when one data does not need to be updated by a specified destination server, but needs to be updated by all micro servers, the address information of the destination server may also be null, and all the micro servers that receive the event message may generate a local event for updating the data according to the event processing information.
For an event message generated by a first micro-server, the event message may include source address information and event topic information, where the source address information is address information of the first micro-server.
Wherein the event topic information may correspond to topics of the micro-server, e.g., the micro-server may have a plurality of topics (software topics, financial topics, department topics, etc.), while a single data update may relate to a certain type or types of topics, e.g., a personnel change data update may relate to a personnel topic and a financial topic, the event topic information contained in the event message generated by the personnel change data update may include the personnel topic and the financial topic. Thus, when the micro server of the personnel topic or the financial topic acquires the event message, the event processing can be performed according to the event message, and the micro servers of other topics can ignore the event message.
Although the event topic information can classify the micro servers to a certain extent and achieve a preliminary screening effect, the micro servers needing to update data are specified only through the event topic information, and an effect of accurate positioning cannot be achieved, for example, a piece of data update related to personnel change of a practice student is achieved, the event topic of the generated event message may be personnel topic, financial topic and the like, however, in the micro servers related to personnel topic and financial topic, a part of micro servers only relate to personnel information management or financial information management of formal staff, and the part of micro servers do not need to update the data related to personnel change of the practice student.
Therefore, the accurate positioning of the micro server can be performed by utilizing the address information of the target server on the basis of screening through the theme, and the effect of accurately designating the micro server needing to perform data updating is achieved.
The message middleware can send the event message sent by the micro server to all the micro servers at regular time, and the micro server can monitor the event message in the message middleware in real time or acquire the event message from the message middleware at regular time.
In one possible implementation, before the first micro server sends the event message to the message middleware, it may determine whether the address information of the destination server is consistent with the address information of the first micro server; and when the address information of the destination server is inconsistent with the address information of the first micro server, sending the event message to a message middleware.
It should be noted that, when only address information of one destination server exists in the event message, and the address information of the destination server is consistent with the address information of the first micro server, the first micro server may directly generate a local event according to the event processing information in the event message, and does not send the event message to the message middleware.
In one possible implementation manner, the local event generated by the micro server may be a local unique event or a public event stored in the message middleware, when the feature code corresponding to the public event exists in the event processing information, the defined public event may be directly obtained from the message middleware, or definable data in the public event may be modified after the defined public event is obtained, so as to generate the local event, and when the feature code of the defined public event does not exist in the event processing information, a new local event may be directly generated according to the event processing information.
For example, the first micro server adds the personnel change data, and issues an event message, and the event processing information in the event message includes the feature code a1 of the public event with the event content of "adding one employee data", so that when other micro servers process the event, the other micro servers can acquire the public event with the code a1 from the message middleware, redefine definable data (such as employee name, gender, department and the like) in the public event according to the data in the event processing information, thereby generating the local event of the micro server.
When the event processing information does not include the feature code, other micro servers can directly generate a new local event according to the event processing information when the event processing is performed, for example, if the event content represented by the event processing information is "open B authority for employee a", a local event for open B authority for employee a can be generated according to the event processing information.
For the second micro server, the second micro server may have address information of a plurality of destination servers in the event message acquired from the message middleware, and if one address information is consistent with the address information of the second server, the second server may be determined to be the destination server.
The event message may further include source address information, where the source address information is address information of the micro server that issues the event message, and in this case, the second micro server may further determine whether the source address information is consistent with address information of the second micro server, and determine whether address information of a destination server is consistent with address information of the second micro server when determining that the source address information is inconsistent with address information of the second micro server; and stopping processing the event message when the source address information is identical to the address information of the second micro server. When the message middleware acquires the event message issued by the micro server, the micro server does not process the event message.
Because the first micro server and the second micro server may be the same micro server, and the first micro server may determine whether the destination server of the event message is itself before the event message is issued, if so, a local event is generated, and in order to prevent repeated data update caused by repeated generation of the local event, in this embodiment, the second micro server may also determine whether the micro server that issues the event message is itself, if so, the event message may be ignored, and no subsequent processing is performed on the event message.
When the first micro server performs data synchronization, the data to be synchronized is not directly uploaded to the message middleware, but encapsulated into data update information, and the data update information and the address information of the destination server together form an event message to be uploaded to the message middleware, so that the second server can judge whether the address information of the destination server is consistent with the address information of the second server after obtaining the event message, and a local event is generated according to the data update information when the address information of the destination server is consistent with the address information of the second server. In this way, the message and the update data in the message middleware are decoupled, and the micro server does not update the data of the micro server according to the update data uploaded to the message middleware by other micro servers, but issues a local event for updating the data according to the data update information in the event message of which the address information in the message middleware is matched with the address information of the micro server, so that the logic of event processing is optimized, and the effect of directionally issuing the update data to the designated micro server in the distributed system can be achieved.
Fig. 2 is a flow chart illustrating a method of communication of a distributed system according to an exemplary disclosed embodiment. As shown in fig. 2, the method comprises the steps of:
S21, a first micro server of the distributed system generates an event message according to data updating information in the first micro server, wherein the event message comprises event processing information and address information of a destination server, and the event message is sent to a message middleware.
S22, the second micro server of the distributed system acquires the event message in the message middleware, judges whether the address information of the destination server included in the event message is consistent with the address information of the second micro server, and generates a local event according to the event processing information included in the event message when the address information of the destination server is consistent with the address information of the second micro server.
With respect to the steps in the above embodiments, the specific implementation of each step has been described in detail in the embodiments related to the distributed system, and will not be described in detail herein.
According to the technical scheme, when the first micro server performs data synchronization, the data to be synchronized is not directly uploaded to the message middleware, but is packaged into the data updating information, and the data updating information and the address information of the target server together form an event message to be uploaded to the message middleware, so that the second server can judge whether the address information of the target server is consistent with the address information of the second server after obtaining the event message, and a local event is generated according to the data updating information when the address information of the target server is consistent with the address information of the second server. In this way, the message and the update data in the message middleware are decoupled, and the micro server does not update the data of the micro server according to the update data uploaded to the message middleware by other micro servers, but issues a local event for updating the data according to the data update information in the event message of which the address information in the message middleware is matched with the address information of the micro server, so that the logic of event processing is optimized, and the effect of directionally issuing the update data to the designated micro server in the distributed system can be achieved.
Fig. 3 is a flow chart illustrating a method of communication for a distributed system applied to a first micro server according to an exemplary disclosed embodiment. Wherein the first micro server may be any micro server in a distributed system.
The method comprises the following steps:
s31, generating an event message according to the data updating information in the first micro server, wherein the event message comprises event processing information and address information of a destination server.
The event processing information may be information indicating what kind of data update is performed by the first micro server, and may be in a form of combining an event type with variable data when a predefined event exists in the system. For example, when a user data is newly added in the first micro server, event processing information indicating the newly added user data of other micro servers can be generated according to the data updating information of the newly added event; alternatively, the code of the event of the newly added user data may be predefined as a1 in the system, and the event processing information may be a combination of the code a1 and the data specifically required to perform the operation.
The address information may include IP (Internet Protocol, internetworking protocol) information and port information. Several micro servers may be located in the same host, share the same IP, and different micro servers on the same host may have different ports, so that one micro server may be uniquely determined according to the IP information and the port information. For example, the two micro servers designated by 127.0.0.1:8080 and 127.0.0.1:8090 have an IP of 127.0.0.1 and ports of 8080 and 8090, respectively.
There may be address information of a plurality of destination servers in an event message, so that a plurality of designated micro servers may update data according to the event message. It should be noted that, the port information in the address information may be a specific port name, such as 8080 or 8090, or may be replaced by a predetermined symbol, and when the port information is a predetermined symbol, the micro server pointed to by the address information is all the micro servers included in the IP information in the address information.
For example, the event message may have first address information 127.0.0.1:8080 and second address information 127.0.0.1:8090, and the destination server of the event message is a micro server with an IP of 127.0.0.1 and a port of 8080, and a micro server with an IP of 127.0.0.1 and a port of 8090; the address information of the destination server in the event message may be 127.0.0.1, where "" is the predetermined symbol, and the destination servers of the event message are all micro servers with an IP of 127.0.0.1, including 127.0.0.1:8080 and 127.0.0.1:8090.
It should be noted that, when one data does not need to be updated by a specified destination server, but needs to be updated by all micro servers, the address information of the destination server may also be null, and all the micro servers that receive the event message may generate a local event for updating the data according to the event processing information.
The event message may further include source address information and event topic information, where the source address information is address information of the first micro server.
Wherein the event topic information may correspond to topics of the micro-server, e.g., the micro-server may have a plurality of topics (software topics, financial topics, department topics, etc.), while a single data update may relate to a certain type or types of topics, e.g., a personnel change data update may relate to a personnel topic and a financial topic, the event topic information contained in the event message generated by the personnel change data update may include the personnel topic and the financial topic. Thus, when the micro server of the personnel topic or the financial topic acquires the event message, the event processing can be performed according to the event message, and the micro servers of other topics can ignore the event message.
Although the event topic information can classify the micro servers to a certain extent and achieve a preliminary screening effect, the micro servers needing to update data are specified only through the event topic information, and an effect of accurate positioning cannot be achieved, for example, a piece of data update related to personnel change of a practice student is achieved, the event topic of the generated event message may be personnel topic, financial topic and the like, however, in the micro servers related to personnel topic and financial topic, a part of micro servers only relate to personnel information management or financial information management of formal staff, and the part of micro servers do not need to update the data related to personnel change of the practice student.
Therefore, the accurate positioning of the micro server can be performed by utilizing the address information of the target server on the basis of screening through the theme, and the effect of accurately designating the micro server needing to perform data updating is achieved.
S32, sending the event message to a message middleware.
The message middleware can send the event message sent by the micro server to all the micro servers at regular time, and the micro server can monitor the event message in the message middleware in real time or acquire the event message from the message middleware at regular time.
In one possible implementation, before sending the event message to the message middleware, it may be determined whether the address information of the destination server is consistent with the address information of the first micro server; and when the address information of the destination server is inconsistent with the address information of the first micro server, sending the event message to a message middleware.
It should be noted that, when only address information of one destination server exists in the event message, and the address information of the destination server is consistent with the address information of the first micro server, the first micro server may directly generate a local event according to the event processing information in the event message, and does not send the event message to the message middleware.
In one possible implementation manner, the local event generated by the micro server may be a local unique event or a public event stored in the message middleware, when the feature code corresponding to the public event exists in the event processing information, the defined public event may be directly obtained from the message middleware, or definable data in the public event may be modified after the defined public event is obtained, so as to generate the local event, and when the feature code of the defined public event does not exist in the event processing information, a new local event may be directly generated according to the event processing information.
For example, the first micro server adds the personnel change data, and issues an event message, and the event processing information in the event message includes the feature code a1 of the public event with the event content of "adding one employee data", so that when other micro servers process the event, the other micro servers can acquire the public event with the code a1 from the message middleware, redefine definable data (such as employee name, gender, department and the like) in the public event according to the data in the event processing information, thereby generating the local event of the micro server.
When the event processing information does not include the feature code, other micro servers can directly generate a new local event according to the event processing information when the event processing is performed, for example, if the event content represented by the event processing information is "open B authority for employee a", a local event for open B authority for employee a can be generated according to the event processing information.
As shown in fig. 4, a flow chart of an event release of a first micro server is shown, and as shown in fig. 4, when the first micro server needs to release an event, an event message can be generated through data update information, then whether address information of a destination server is consistent with address information of the first micro server or not is judged, if so, a local event is directly released, and if not, the event message is sent to a message middleware.
It should be noted that, in the above process, when the address information of only one destination server exists in the event message, when address information of a plurality of destination servers exist in the event message, after the first micro server issues a local event, the event message still needs to be sent to the message middleware.
According to the scheme, when the first micro server performs data synchronization, the data to be synchronized is not directly uploaded to the message middleware, but is encapsulated into the data updating information, and the data updating information and the address information of the target server together form an event message to be uploaded to the message middleware, so that after the event message is obtained, other servers can judge whether the address information of the target server is consistent with the address information of the target server or not, and local events are generated according to the data updating information when the address information of the target server is consistent with the address information of the target server. In this way, the message and the update data in the message middleware are decoupled, and the micro server does not update the data of the micro server according to the update data uploaded to the message middleware by other micro servers, but issues a local event for updating the data according to the data update information in the event message of which the address information in the message middleware is matched with the address information of the micro server, so that the logic of event processing is optimized, and the effect of directionally issuing the update data to the designated micro server in the distributed system can be achieved.
Fig. 5 is a flow chart illustrating a method of communication for a distributed system applied to a second micro server, according to an exemplary disclosed embodiment. The second micro server may be any micro server in the distributed system, and the second micro server may be the same micro server as the first micro server.
The method comprises the following steps:
s51, acquiring an event message in the message middleware, wherein the event message comprises event processing information and address information of a destination server.
The event processing information may be information indicating what kind of data update is performed by the first micro server, and may be in a form of combining an event type with variable data when a predefined event exists in the system. For example, when a user data is newly added in the first micro server, event processing information indicating the newly added user data of other micro servers can be generated according to the data updating information of the newly added event; alternatively, the code of the event of the newly added user data may be predefined as a1 in the system, and the event processing information may be a combination of the code a1 and the data specifically required to perform the operation.
The address information may include IP information and port information. Several micro servers may be located in the same host, share the same IP, and different micro servers on the same host may have different ports, so that one micro server may be uniquely determined according to the IP information and the port information. For example, the two micro servers designated by 127.0.0.1:8080 and 127.0.0.1:8090 have an IP of 127.0.0.1 and ports of 8080 and 8090, respectively.
There may be address information of a plurality of destination servers in an event message, so that a plurality of designated micro servers may update data according to the event message. It should be noted that, the port information in the address information may be a specific port name, such as 8080 or 8090, or may be replaced by a predetermined symbol, and when the port information is a predetermined symbol, the micro server pointed to by the address information is all the micro servers included in the IP information in the address information.
For example, the event message may have first address information 127.0.0.1:8080 and second address information 127.0.0.1:8090, and the destination server of the event message is a micro server with an IP of 127.0.0.1 and a port of 8080, and a micro server with an IP of 127.0.0.1 and a port of 8090; the address information of the destination server in the event message may be 127.0.0.1, where "" is the predetermined symbol, and the destination servers of the event message are all micro servers with an IP of 127.0.0.1, including 127.0.0.1:8080 and 127.0.0.1:8090.
It should be noted that, when one data does not need to be updated by a specified destination server, but needs to be updated by all micro servers, the address information of the destination server may also be null, and all the micro servers that receive the event message may generate a local event for updating the data according to the event processing information.
S52, judging whether the address information of the destination server is consistent with the address information of the second micro server.
The address information of the destination server may include IP information and port information, and when the IP information and the port information of the second micro server are corresponding to and consistent with the IP information and the port information in the address information of the destination server, it may be determined that the address information of the destination server is consistent with the address information of the second micro server, which is the destination server.
It should be noted that, the port information in the address information may be a specific port name, such as 8080 or 8090, or may be replaced by a predetermined symbol, and when the port information is a predetermined symbol, the micro server pointed to by the address information is all the micro servers included in the IP information in the address information.
That is, when the port information in the address information of the destination server is a predetermined symbol, it is determined that the address information of the destination server matches the address information of the second micro server, which is the destination server, as long as the IP information of the second server matches the IP information of the destination server.
For example, when the address information of the second server is 127.0.0.1:8090, where 127.0.0.1 is IP information, 8090 is port information, and the address information of the destination server in the event message obtained by the second server is 127.0.0.1:8090 or 127.0.0.1: (where ". X" is the predetermined symbol), it may be determined that the second server is the destination server.
The event message may include address information of a plurality of destination servers, and if one of the address information is consistent with the address information of the second server, the second server may be determined to be the destination server.
In one possible implementation, the event message may further include event topic information.
Before judging whether the address information of the destination server is consistent with the address information of the second micro server, whether the event theme information is matched with the theme of the second micro server can be also judged, and when the event theme information is not matched with the theme of the second micro server, the processing of the event message is stopped.
The event topic information may correspond to topics of the micro-server, e.g., the micro-server may have multiple topics (software topics, financial topics, department topics, etc.), while a single data update may relate to a certain type or types of topics, e.g., a personnel change data update may relate to a personnel topic and a financial topic, and the event topic information contained in the event message generated from the personnel change data update may include the personnel topic and the financial topic. Thus, when the micro server of the personnel topic or the financial topic acquires the event message, the event processing can be performed according to the event message, and the micro servers of other topics can ignore the event message.
Although the event topic information can classify the micro servers to a certain extent and achieve a preliminary screening effect, the micro servers needing to update data are specified only through the event topic information, and an effect of accurate positioning cannot be achieved, for example, a piece of data update related to personnel change of a practice student is achieved, the event topic of the generated event message may be personnel topic, financial topic and the like, however, in the micro servers related to personnel topic and financial topic, a part of micro servers only relate to personnel information management or financial information management of formal staff, and the part of micro servers do not need to update the data related to personnel change of the practice student.
Therefore, the accurate positioning of the micro server can be performed by utilizing the address information of the target server on the basis of screening through the theme, and the effect of accurately designating the micro server needing to perform data updating is achieved.
In a possible implementation manner, the event message may further include source address information, where the source address information is address information of the micro server that issues the event message.
Before judging whether the address information of the destination server is consistent with the address information of the second micro server, judging whether the source address information is consistent with the address information of the second micro server; and stopping processing the event message when the source address information is consistent with the address information of the second micro server.
Because the first micro server in the previous embodiment and the second micro server in the present embodiment may be the same micro server, and in the previous embodiment, the first micro server may determine whether the destination server of the event message is itself before issuing the event message, if so, generate the local event, and in order to prevent the repeated update of the data caused by the repeated generation of the local event, in the present embodiment, the second micro server may also determine whether the micro server issuing the event message is itself, if so, ignore the event message, and not perform the subsequent processing on the event message.
And S53, when the address information of the target server is consistent with the address information of the second micro server, generating a local event according to the event processing information.
The local event generated by the micro server can be a local unique event or a public event stored in the message middleware, when the feature code corresponding to the public event exists in the event processing information, the defined public event can be directly obtained from the message middleware, or definable data in the public event can be modified after the defined public event is obtained, so that the local event is generated, and when the feature code of the defined public event does not exist in the event processing information, a new local event can be directly generated according to the event processing information.
For example, the first micro server adds the personnel change data, and issues an event message, and the event processing information in the event message includes the feature code a1 of the public event with the event content of "adding one employee data", so that when other micro servers process the event, the other micro servers can acquire the public event with the code a1 from the message middleware, redefine definable data (such as employee name, gender, department and the like) in the public event according to the data in the event processing information, thereby generating the local event of the micro server.
When the event processing information does not include the feature code, other micro servers can directly generate a new local event according to the event processing information when the event processing is performed, for example, if the event content represented by the event processing information is "open B authority for employee a", a local event for open B authority for employee a can be generated according to the event processing information.
FIG. 6 is a flow diagram of processing events according to a second micro server. As shown in fig. 6, the second location server may monitor the event message consistent with the subject of itself in the message middleware, analyze the address information and the source address information of the destination server in the event message, determine whether the event message is issued by itself, if yes, ignore the event message, if not, determine whether the destination server is itself, if yes, generate a local event, if not ignore the event message.
Through the technical scheme, after the second server obtains the event message, whether the address information of the target server is consistent with the address information of the second server or not is judged, and when the address information of the target server is consistent with the address information of the second server, a local event is generated according to the data updating information. The second micro server directly updates own data according to the update data uploaded to the message middleware by other micro servers, but issues a local event for updating the data according to the data update information in the event message of which the address information in the message middleware is matched with the own address information, so that the logic of event processing is optimized, and the effect of directionally issuing the update data to the appointed micro server in the distributed system can be achieved.
Fig. 7 is a block diagram of an electronic device 700, according to an example embodiment. For example, the electronic device 700 may be provided as a micro-server. Referring to fig. 7, the electronic device 700 includes a processor 722, which may be one or more in number, and a memory 732 for storing computer programs executable by the processor 722. The computer program stored in memory 732 may include one or more modules each corresponding to a set of instructions. Further, the processor 722 may be configured to execute the computer program to perform the communication method of the distributed system described above.
In addition, the electronic device 700 can further include a power component 726 and a communication component 750, the power component 726 can be configured to perform power management of the electronic device 700, and the communication component 750 can be configured to enable communication of the electronic device 700, e.g., wired or wireless communication. In addition, the electronic device 700 may also include an input/output (I/O) interface 757. The electronic device 700 may operate based on an operating system stored in memory 732, such as Windows Server, mac OS XTM, unixTM, linuxTM, and the like.
In another exemplary embodiment, a computer readable storage medium is also provided comprising program instructions which, when executed by a processor, implement the steps of the communication method of the distributed system described above. For example, the computer readable storage medium may be the memory 732 described above that includes program instructions executable by the processor 722 of the electronic device 700 to perform the communication method of the distributed system described above.
In another exemplary embodiment, a computer program product is also provided, comprising a computer program executable by a programmable apparatus, the computer program having code portions for performing the communication method of the distributed system described above when executed by the programmable apparatus.
The preferred embodiments of the present disclosure have been described in detail above with reference to the accompanying drawings, but the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solutions of the present disclosure within the scope of the technical concept of the present disclosure, and all the simple modifications belong to the protection scope of the present disclosure.
In addition, the specific features described in the foregoing embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, the present disclosure does not further describe various possible combinations.
Moreover, any combination between the various embodiments of the present disclosure is possible as long as it does not depart from the spirit of the present disclosure, which should also be construed as the disclosure of the present disclosure.

Claims (10)

1. A distributed system comprising message middleware and a plurality of micro servers; wherein,
the first micro server is used for generating an event message according to the data updating information in the first micro server, wherein the event message comprises event processing information, address information of a target server and event theme information, and sending the event message to the message middleware;
The second micro server is used for acquiring the event message in the message middleware, determining whether the event theme information included in the event message is matched with the theme of the second micro server, judging whether the address information of the destination server included in the event message is consistent with the address information of the second micro server when the event theme information included in the event message is matched with the theme of the second micro server, and generating a local event for updating data according to the event processing information included in the event message when the address information of the destination server is consistent with the address information of the second micro server;
when the feature codes corresponding to the public events exist in the event processing information, the second micro server acquires the public events corresponding to the feature codes from the message middleware and modifies definable data in the public events to generate the local events; and when the feature codes corresponding to the public events do not exist in the event processing information, the second micro server generates the local events according to the event processing information.
2. The system of claim 1, wherein the first micro server is further configured to: before the event message is sent to the message middleware, determining that the address information of the destination server included in the event message is inconsistent with the address information of the first micro server;
The first micro server is further configured to generate a local event according to the event processing information when it is determined that address information of the destination server included in the event message is consistent with address information of the first micro server.
3. The system of claim 1, wherein the event message generated by the first micro server further comprises source address information, the source address information being address information of the first micro server.
4. A system according to any of claims 1-3, wherein the address information comprises internet protocol, IP, address information and port information of the destination server.
5. The system of claim 1, wherein the second micro server is further configured to stop processing the event message when it is determined that the event topic information included in the event message does not match the topic of the second micro server.
6. The system of claim 1, wherein the second micro server is further configured to, when an event message is obtained from the message middleware, stop processing the event message if source address information in the event message is consistent with address information of the second micro server, where the source address information is an address of a micro server that issues the event message.
7. A method of communication for a distributed system, the method comprising:
a first micro server of the distributed system generates an event message according to data updating information in the first micro server, wherein the event message comprises event processing information, address information of a target server and event subject information, and the event message is sent to a message middleware;
a second micro server of the distributed system acquires an event message in the message middleware, determines whether event theme information included in the event message is matched with a theme of the second micro server, judges whether address information of a destination server included in the event message is consistent with address information of the second micro server when the event theme information included in the event message is matched with the theme of the second micro server, and generates a local event for updating data according to the event processing information included in the event message when the address information of the destination server is consistent with the address information of the second micro server;
when the feature codes corresponding to the public events exist in the event processing information, the second micro server acquires the public events corresponding to the feature codes from the message middleware and modifies definable data in the public events to generate the local events; and when the feature codes corresponding to the public events do not exist in the event processing information, the second micro server generates the local events according to the event processing information.
8. The method of claim 7, wherein the first micro-server sending the event message to message middleware comprises:
when the address information of the destination server included in the event message is inconsistent with the address information of the first micro server, the event message is sent to a message middleware;
the method further comprises the steps of: and when the first micro server determines that the address information of the destination server included in the event message is consistent with the address information of the first micro server, generating a local event according to the event processing information.
9. The method of claim 7, wherein the method further comprises:
and the second micro server stops processing the event message when determining that the event topic information included in the event message is not matched with the topic of the second micro server.
10. The method of claim 7, wherein the second micro server, before determining whether the address information of the destination server included in the event message is consistent with the address information of the second micro server, further comprises: the second micro server determines that the source address information included in the event message is consistent with the address information of the second micro server;
The method further comprises the steps of: and the second micro server stops processing the event message when determining that the source address information included in the event message is inconsistent with the address information of the second micro server.
CN201911311187.6A 2019-12-18 2019-12-18 Distributed system and communication method Active CN111158928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911311187.6A CN111158928B (en) 2019-12-18 2019-12-18 Distributed system and communication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911311187.6A CN111158928B (en) 2019-12-18 2019-12-18 Distributed system and communication method

Publications (2)

Publication Number Publication Date
CN111158928A CN111158928A (en) 2020-05-15
CN111158928B true CN111158928B (en) 2024-04-05

Family

ID=70557772

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911311187.6A Active CN111158928B (en) 2019-12-18 2019-12-18 Distributed system and communication method

Country Status (1)

Country Link
CN (1) CN111158928B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007112618A (en) * 2005-10-24 2007-05-10 Nippon Telegr & Teleph Corp <Ntt> Radio tag id information transfer destination address solving system and method
CN107111508A (en) * 2014-09-30 2017-08-29 亚马逊技术有限公司 Procedural event detection and message for the request of configuration processor code are generated
CN107273228A (en) * 2017-07-13 2017-10-20 焦点科技股份有限公司 Method for message transmission based on star topology framework
CN107657532A (en) * 2016-07-25 2018-02-02 武汉票据交易中心有限公司 The processing method and system of a kind of operation flow
CN110209986A (en) * 2019-06-06 2019-09-06 海尔优家智能科技(北京)有限公司 Internal storage state method of data synchronization and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110185082A1 (en) * 2009-12-29 2011-07-28 Tervela, Inc. Systems and methods for network virtualization

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007112618A (en) * 2005-10-24 2007-05-10 Nippon Telegr & Teleph Corp <Ntt> Radio tag id information transfer destination address solving system and method
CN107111508A (en) * 2014-09-30 2017-08-29 亚马逊技术有限公司 Procedural event detection and message for the request of configuration processor code are generated
CN107657532A (en) * 2016-07-25 2018-02-02 武汉票据交易中心有限公司 The processing method and system of a kind of operation flow
CN107273228A (en) * 2017-07-13 2017-10-20 焦点科技股份有限公司 Method for message transmission based on star topology framework
CN110209986A (en) * 2019-06-06 2019-09-06 海尔优家智能科技(北京)有限公司 Internal storage state method of data synchronization and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于消息中间件的航班信息显示系统的设计与实现;李小智 等;《计算机系统应用》;20101015;第19卷(第10期);第7-11页 *

Also Published As

Publication number Publication date
CN111158928A (en) 2020-05-15

Similar Documents

Publication Publication Date Title
CN109388417B (en) Communication protocol updating method, system and terminal equipment
US10972564B2 (en) System and method for automating actions in distributed computing
WO2020244307A1 (en) Vulnerability detection method and apparatus
CN110851468A (en) Method and device for making simulation response to test request of client
CN111464646B (en) Information processing method, information processing apparatus, electronic device, and medium
CN110990008B (en) Page updating method and device, storage medium and electronic equipment
US20180123900A1 (en) Scenario driven, technology agnostic network simulation
CN107133160B (en) Server and client
CN112887451B (en) Domain name resolution method and device and computer equipment
CN112269588B (en) Algorithm upgrading method, device, terminal and computer readable storage medium
CN111158928B (en) Distributed system and communication method
CN110780915B (en) Data processing method, device and storage medium
CN111131373B (en) Breathing machine data synchronization system, method, device and storage medium
CN111881209A (en) Data synchronization method and device for heterogeneous database, electronic equipment and medium
CN111639086A (en) Data reconciliation method, device, equipment and storage medium
CN115203977B (en) Power grid simulation system
US9456046B2 (en) Dynamic generation of proxy connections
US20190384493A1 (en) Method, device, and computer program prouct for managing virtual machines
CN115883512A (en) DNS domain name processing method, device, system, equipment and medium
CN111626802A (en) Method and apparatus for processing information
US7805715B2 (en) Model publishing framework
CN109117152B (en) Service generation system and method
CN110765610A (en) PDM (product data management) integration method and device, computer equipment and storage medium
CN110262756B (en) Method and device for caching data
CN110221869B (en) Method and device for configuring data center operating environment

Legal Events

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