CN112822240A - Message transmission method, device and equipment - Google Patents

Message transmission method, device and equipment Download PDF

Info

Publication number
CN112822240A
CN112822240A CN202011617619.9A CN202011617619A CN112822240A CN 112822240 A CN112822240 A CN 112822240A CN 202011617619 A CN202011617619 A CN 202011617619A CN 112822240 A CN112822240 A CN 112822240A
Authority
CN
China
Prior art keywords
server
message
role
network nodes
client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011617619.9A
Other languages
Chinese (zh)
Inventor
罗刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011617619.9A priority Critical patent/CN112822240A/en
Publication of CN112822240A publication Critical patent/CN112822240A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a message transmission method, a device and equipment, wherein the method is suitable for a communication system which comprises at least two network nodes, wherein the at least two network nodes comprise at least one client and at least one server; the method comprises the following steps: the first client acquires a first message to be sent to the server, selects at least one network node from the at least two network nodes, and sends the first message to the selected at least one network node, wherein the first message is relayed in the at least two network nodes until the first server in the at least one server stops relaying the first message in the at least two network nodes when receiving the first message. The technical scheme can avoid server crash caused by the fact that the messages simultaneously flow into the server, and saves transmission resources.

Description

Message transmission method, device and equipment
Technical Field
The present application relates to the field of monitoring, and in particular, to a method, an apparatus, and a device for transmitting a message, which are suitable for a monitoring system.
Background
The existing monitoring system is generally divided into a client and a server, which are also called as a C/S architecture, and the client is responsible for collecting information and actively sending the information to the server, or executing a script or a program issued by the server or locally preconfigured.
When the number of the clients is increased, each client sends information to the server, which may cause a large amount of information to rush to the server at the same time, so that the server is overloaded and easily crashed due to too large computation amount.
Disclosure of Invention
Embodiments of the present invention provide a data transmission method, apparatus, and device, which can avoid a problem of server crash caused by messages simultaneously rushing into a server, and can also avoid a problem of resource waste caused by a first message being transmitted continuously.
In a first aspect, a message transmission method is provided, where the method is applied to a communication system, where the communication system includes at least two network nodes, where the at least two network nodes include at least one client and at least one server, and the at least one client includes a first client; the method comprises the following steps: a first client acquires a first message to be sent;
the first client selecting at least one network node from the at least two network nodes and sending the first message to the selected at least one network node, wherein the first message is relayed in the at least two network nodes until a first server of the at least one server stops relaying the first message in the at least two network nodes when receiving the first message;
wherein the relay transmission means that the network node receives the first message and forwards the first message.
With reference to the first aspect, in a possible implementation manner, the number of servers in the at least one server is at least two, and the at least one server includes a server in a leader role and at least one server in a follow-up role, where the server in the leader role is used to manage the servers in the follow-up role;
the first server is the server in the leader role or the server in the follower role.
With reference to the first aspect, in a possible implementation manner, after the selecting, by the first client, at least one network node from the at least two network nodes and sending the first message to the selected at least one network node, the method further includes: the first client receives a broadcast message, the broadcast message includes a message identifier of the first message, and the broadcast message is used for indicating to stop relaying transmission of the first message in the at least two network nodes.
In a second aspect, a message transmission method is provided, where the method is applied to a communication system, where the communication system includes at least two network nodes, where the at least two network nodes include at least one client and at least one server, and where the at least one server includes a first server; the method comprises the following steps:
a first server receives a first message of relay transmission in the at least two network nodes, wherein the relay transmission means that the network nodes receive the first message and forward the first message;
the first server sends a second message, wherein the second message is used for triggering the first message to stop relay transmission in the at least two network nodes; wherein the second message comprises a message identification of the first message.
With reference to the second aspect, in a possible implementation manner, the sending, by the first server, the second message includes: the first server transmitting a broadcast message in the communication system; or, the first server sends a request message to a second server, the request message is used for triggering the second server to send a broadcast message in the communication system, and the second server is used for managing the first server;
wherein the broadcast message is used to indicate to stop relaying transmission of the first message in the at least two network nodes.
With reference to the second aspect, in a possible implementation manner, the number of the servers in the at least one server is at least two, and the at least one server includes a server in a leader role and at least one server in a follow-up role, where the server in the leader role is used to manage the servers in the follow-up role; after the first server receives the first message relayed transmission in the at least two network nodes, further comprising:
if the first server is the server serving as the leader role, the first server sends the first message to each server serving as a follow-up role in the at least one server serving as the follow-up role, so that the server serving as the follow-up role stores the first message in a backup manner;
if the first server is the server which is the follow-up role, the first server sends the first message to the server which is the leader role, so that the server which is the leader role stores the first message backup to each server which is the follow-up role in the at least one server which is the follow-up role.
With reference to the second aspect, in a possible implementation manner, if the first server is the server that serves as the follow-up role, the method further includes: if the first server determines that the server serving as the leader role fails, the first server sends a voting request message to each server serving as a follow-up role in the at least one server serving as a follow-up role except the first server, wherein the voting request message is used for indicating to vote for the first server; the first server receives at least one voting response message, wherein the voting response message comprises voting result information which is used for indicating whether the first server is allowed to be switched into a server serving as a leader role or not; and if the at least one voting response message meets a switching condition, switching the first server from the server serving as the following role to the server serving as the leader role.
In a third aspect, a message transmission apparatus is provided, which is applied to a first client in a communication system, where the communication system includes at least two network nodes, where the at least two network nodes include at least one client and at least one server, and the at least one client includes the first client, and the message transmission apparatus includes:
the message acquisition module is used for acquiring a first message to be sent;
a message transmission module, configured to select at least one network node from the at least two network nodes and send the first message to the selected at least one network node, where the first message is relayed in the at least two network nodes until a first server of the at least one server stops relaying the first message in the at least two network nodes when receiving the first message;
wherein the relay transmission means that the network node receives the first message and forwards the first message.
With reference to the third aspect, in a possible implementation manner, the number of servers in the at least one server is at least two, and the at least one server includes a server in a leader role and at least one server in a follow-up role, where the server in the leader role is used to manage the servers in the follow-up role;
the first server is the server in the leader role or the server in the follower role.
With reference to the third aspect, in a possible implementation manner, the message transmission module is further configured to receive a broadcast message, where the broadcast message includes a message identifier of the first message, and the broadcast message is used to indicate to stop the relay transmission of the first message in the at least two network nodes.
In a fourth aspect, a message transmission apparatus is provided, which is applied to a first server in a communication system, the communication system including at least two network nodes including at least one client and at least one server, the at least one server including the first server, the message transmission apparatus including:
a receiving module, configured to receive a first message of relay transmission in the at least two network nodes, where the relay transmission refers to that the network node receives the first message and forwards the first message;
a sending module, configured to send a second message in the communication system, where the second message is used to trigger the first message to stop relay transmission in the at least two network nodes; wherein the second message comprises a message identification of the first message.
With reference to the fourth aspect, in a possible implementation manner, the sending, by the sending module, the second message includes: a transmitting module transmits a broadcast message in the communication system; or, the sending module sends a request message to a second server, where the request message is used to trigger the second server to send a broadcast message in the communication system, and the second server is used to manage the first server;
wherein the broadcast message is used to indicate to stop relaying transmission of the first message in the at least two network nodes.
With reference to the fourth aspect, in a possible implementation manner, the number of the servers in the at least one server is at least two, and the at least one server includes one server serving as a leader role and at least one server serving as a follow role, where the server serving as the leader role is used to manage the servers serving as the follow roles; the receiving module, after receiving the first message relayed transmission in the at least two network nodes, further includes: if the first server is the server serving as the leader role, the sending module is further configured to send the first message to each server serving as a follower role in the at least one server serving as a follower role, so that the server serving as the follower role stores the first message in a backup manner;
if the first server is the server which is the follow-up role, the sending module is further configured to send the first message to the server which is the leader role, so that the server which is the leader role stores the first message backup to each of the at least one server which is the follow-up role as the server which is the follow-up role.
With reference to the fourth aspect, in a possible implementation manner, if the first server is the server that serves as the follow-up role, the method further includes:
if the first server determines that the server serving as the leader role fails, the sending module is further configured to send a voting request message to each server serving as a follow-up role in the at least one server serving as a follow-up role, except the first server, where the voting request message is used to indicate to vote to the first server;
the receiving module receives at least one voting response message, wherein the voting response message comprises voting result information which is used for indicating whether the first server is allowed to be switched into the server serving as the leader role or not;
and if the at least one voting response message meets a switching condition, switching the first server from the server serving as the following role to the server serving as the leader role.
In a fifth aspect, a message transmission device is provided, which includes a processor, a memory, and a transmission interface, where the processor, the memory, and the transmission interface are connected to each other, where the transmission interface is configured to receive or forward the first message, the memory is configured to store a program code, the processor is configured to call the program code, and the processor is configured to execute the method of the first aspect or the second aspect.
In a sixth aspect, there is provided a computer storage medium storing a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of the first or second aspect.
In the embodiment of the invention, the messages are transmitted to the server in the at least two network nodes in a relay transmission mode, and each message cannot be simultaneously loaded to the server, so that the problem of server crash caused by the fact that the messages are simultaneously loaded to the server is solved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart illustrating a message transmission method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a message transmission method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a message transmission method according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating a message transmission method according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a message transmission method according to an embodiment of the present invention;
fig. 6 is an interaction flowchart of a message transmission method according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a message transmission apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a message transmission apparatus according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a message transmission device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The scheme of the embodiment of the invention is suitable for a communication system, and the communication system comprises at least two network nodes: the system comprises at least one client and at least one server, wherein the at least one client comprises a first client; the first client acquires a first message to be sent to the server, sends the first message to at least one network node except the first client in the at least two network nodes, and the first message is relayed in the at least two network nodes until the first server in the at least one server stops the relay transmission of the first message in the at least two network nodes when receiving the first message. The relay transmission means that the network node receives the first message and forwards the first message. Because the message is transmitted among the network nodes in a manner similar to diffusion, the message can not be loaded to the server at the same time, and the server crash caused by the fact that the message is loaded to the server at the same time is avoided.
Referring to fig. 1, fig. 1 is a schematic flow chart of a message transmission method according to an embodiment of the present invention, which is particularly applied to a monitoring system with a C/S architecture, where the monitoring system includes at least two network nodes, where the at least two network nodes include at least one client and at least one server, and the method includes:
s101, a first client acquires a first message to be sent.
In this embodiment, the first client may be any one of the at least one client. Specifically, the manner in which the first client acquires the first message to be sent to the server is as follows:
the first client acquires data which is generated in the first client and needs to be monitored, wherein the data includes but is not limited to user data, optionally, the data acquired by the first client includes but is not limited to video data, audio data and the like, smoke concentration in air, mileage and speed data of a vehicle which is driven in real time and the like, and the first client encapsulates the acquired data into a first message.
And secondly, first messages received by the first client from other network nodes in the monitoring system.
S102: the first client selects at least one network node from the at least two network nodes and sends the first message to the selected at least one network node, wherein the first message is relayed among the at least two network nodes.
In the embodiment of the application, in order to prevent the problem that the server is jammed or crashed because the acquired data is loaded to the server by each client side at the same time, a new message transmission method is adopted. The first client randomly selects at least one node for sending the first message in one propagation period, and in the next propagation period, each node in the at least one node randomly selects at least one node again to relay sending. Optionally, the selection manner of each node in selecting at least one node may be to select a node within a preset range of the node as the at least one node.
Referring to fig. 2, fig. 2 is a schematic diagram of a message transmission method according to an embodiment of the present invention, where the schematic diagram mainly specifically describes relay transmission according to an embodiment of the present invention. Fig. 2 includes 5 network nodes, which is exemplified by taking a node 1 as a first client, where the node 2 acquires a first message, the node 1 selects a node 2 and a node 3, and sends the first message to the node 2 and the node 3, respectively, in a first propagation period, after receiving the first message, the node 2 may select a node 3 and a node 4, and send the first message to the node 3 and the node 4, respectively, in a second propagation period, and similarly, after receiving the first message, the node 3 may select a node 4 and a node 5, and send the first message to the node 4 and the node 5, respectively, in the second propagation period, and so on, the first message is relayed among a plurality of nodes.
S103: stopping the relayed transmission of the first message in the at least two network nodes until the first server of the at least one server receives the first message.
Referring to fig. 3, fig. 3 is a schematic diagram of a message transmission method according to an embodiment of the present invention, in a process of relay transmission of a first message, a client 1 shown in fig. 3 selects a client 2 and a first server to send the first message, where the clients 1 and 2 and the first server in fig. 3 are nodes in fig. 2, and the first server receives the first message, and stops the relay transmission of the first message between the nodes. For example, after receiving the first message, the first server sends a broadcast message to a plurality of network nodes in the monitoring system, where the broadcast message includes a message identifier of the first message, and the broadcast message is used to instruct to stop relaying the first message among the at least two network nodes. After each network node receives the broadcast message, the forwarding of the first message is stopped.
In one implementation, the first client receives a broadcast message from the first server. If the first client receives the first message again, the first client stops forwarding the first message according to the broadcast message, and because the first client can acquire the data generated in the first client and required to be monitored, and package the data into the first message, and can also receive the first message from other network nodes in the monitoring system, the first client can be any one of the at least one client, that is, any one of the at least one client can receive the broadcast message, and if the client receives the broadcast message, the first message is not forwarded any more.
Specifically, in the relay transmission process of the first message in the network node, until the first server receives the first message, the monitoring system may have both a network node that receives the first message and a network node that does not receive the first message, and when the first client receives the broadcast message from the first server, if the first client receives the first message, the forwarding of the first message is stopped according to the broadcast message.
By stopping the relay transmission of the first message in the at least two network nodes after the first message is transmitted to the first server, the unnecessary continuous transmission of the first message in the network nodes is avoided, and meanwhile, the broadcast message carries information with the information quantity far smaller than that of the first message, the broadcast message indicates the stop transmission of the first message, thereby reducing the meaningless resource overhead and reducing the network load.
In an implementation manner, if only one server is included in the at least one server, the server is a first server, and until the first server receives the first message, the relay transmission of the first message in the at least two network nodes is stopped.
In an implementation manner, the at least one server includes a server in a leader role and at least one server in a following role, and the server in the leader role is used for managing the server in the following role; the first server may be the server in the leader role or the server in the follower role.
Specifically, in this possible implementation, different implementation scenarios exist due to the different roles of the first server:
firstly, if the first server is a server with a leader role, because only one server with the leader role exists in at least one server, until the server with the leader role receives a first message, the relay transmission of the first message in the at least two network nodes is stopped, the first client receives a broadcast message from the server with the leader role, the broadcast message carries a message identifier of the first message, and the broadcast message is used for indicating that the relay transmission of the first message in the at least two network nodes is stopped.
Further, if the server in the at least one server receives the broadcast message, the forwarding of the first message is also stopped.
And if the first server is a role following server, stopping relay transmission of the first message in the at least two network nodes until any role following server receives the first message, and receiving a broadcast message from the first server by the first client, wherein the first server is any role following server which receives the first message, the broadcast message carries a message identifier of the first message, and the broadcast message is used for indicating that relay transmission of the first message in the at least two network nodes is stopped.
Further, if the server in the at least one server receives the broadcast message, the forwarding of the first message is also stopped.
If the first server is a server serving as a leader role or a server serving as a follower role, that is, the first server may be any server in the at least one server, that is, after receiving the first message, any server in the system stops the relay transmission of the first message in the at least two network nodes, and the first client receives a broadcast message from the first server, where the broadcast message carries a message identifier of the first message, and the broadcast message is used to indicate that the relay transmission of the first message in the at least two network nodes is stopped.
Through the flexible selection of the three implementation scenes, the purpose that the transmission between the network nodes is stopped after the first message is transmitted to the server can be achieved, the meaningless resource overhead is reduced to a great extent, and the network load is reduced.
Optionally, in an implementation manner, if the first server is the server that serves as the follow-up role, the method further includes:
the first client receives a broadcast message from a second server of the at least one server, wherein the broadcast message includes a message identifier of the first message, the broadcast message is used for instructing to stop relaying the first message in the at least two network nodes, and the second server is the server of the at least one server which is in the leader role. And if the first client receives the first message, the first client stops forwarding the first message according to the broadcast message. That is, after the server of the following role receives the first message, the server of the leader role sends out a broadcast message for instructing to stop relay transmission. The implementation scenario in this embodiment may also be used in combination with the implementation scenario in the previous embodiment, that is, after receiving the first message, any one of the servers stops the relay transmission of the first message in at least two network nodes.
As shown in fig. 4 and referring to fig. 4, fig. 4 is a schematic flowchart of another message transmission method provided in an embodiment of the present invention, which is particularly applied to a monitoring system with a C/S architecture, where the monitoring system includes a plurality of network nodes, and the plurality of network nodes include at least one client and at least one server, and the method includes:
s201 a first server receives a first message relayed transmission among the at least two network nodes.
The first server is a server in the at least one server, the relay transmission refers to that the network node receives the first message and forwards the first message, and with reference to fig. 5, as shown in fig. 5, the number of servers included in the monitoring system is only 1, the server is the first server, and by the relay transmission, the client 1 in fig. 5 sends the first message to the client 3 and the first server, and a specific implementation manner of the relay transmission refers to step S102, which is not described in detail herein.
S202, the first server sends a second message, and the second message is used for triggering the first message to stop relay transmission in the at least two network nodes; wherein the second message comprises a message identification of the first message.
As shown in fig. 5, in a possible implementation manner, a client 1 sends a first message to a client 3 and a first server in the figure, where the first server sends a broadcast message in the monitoring system after receiving the first message, where the broadcast message carries a message identifier of the first message, and the broadcast message is used to instruct to stop relay transmission of the first message in the at least two network nodes. As shown in fig. 5, the first server sends the broadcast message, and in the figure, the client 1 and the client 3 do not forward the first message any more after receiving the broadcast message.
In a possible implementation manner, the at least one server includes a server that serves as a leader role and at least one server that serves as a follower role, and the server that serves as the leader role is used to manage the server that serves as the follower role, and since the first server may be the server that serves as the leader role or the server that serves as the follower role, the following detailed description is made according to different scenarios generated by different roles of the first server:
scene one: if the first server is the server which is used as the leader role, the server which is used as the leader role does not send out the broadcast message until the server which is used as the leader role receives the first message, the relay transmission of the first message in at least two network nodes is stopped, and the server which is used as the leader role of the first server sends the first message to at least one server which is used as the follow role, so that the server which is used as the follow role backups and stores the first message. That is, the server in the role following function is used as a backup of the server in the role leading function, the server in the role leading function is a path for preferentially summarizing messages, and data in the server in the role leading function is earlier than data in the server in the role following function. The operation and maintenance personnel can use the data in the server with the leader role preferentially.
Scene two: if the first server is a server serving as a follow-up role, that is, the first server may be any one of at least one server serving as a follow-up role, that is, after receiving the first message, the server serving as any follow-up role sends a broadcast message to stop relay transmission of the first message in at least two network nodes, and the first server serving as a follow-up role directionally forwards the first message to the server serving as a leader role, so that the server serving as the leader role stores the first message in a backup manner to the at least one server serving as a follow-up role.
Scene three: if the first server is a server serving as a leader role or a server serving as a follow-up role, that is, the first server may be any one of the at least one server, that is, after receiving the first message, any one server in the system sends a broadcast message to stop relay transmission of the first message in the at least two network nodes, and if the server serving as the leader role receives the first message first, the server serving as the follow-up role sends the first message to at least one server serving as the follow-up role, so that the server serving as the follow-up role backs up and stores the first message; if the server of the following role receives the first message first, the server of the following role which receives the first message sends a broadcast message to stop relay transmission of the first message in at least two network nodes, and the first server of the following role directionally forwards the first message to the server of the leader role so that the server of the leader role backups and stores the first message to at least one server of the following role.
In this embodiment, the messages are transmitted in a diffused manner without loading all the messages to the server at the same time, so that the load, network congestion and instantaneous outbreak of high-load operation can be effectively balanced, the monitoring system can accommodate more clients, the capacity of the monitoring system is increased, and the need for premature splitting and deployment of multiple sets of monitoring systems of the same type is avoided.
As can be seen from the above, the server in the leader role serves as a path for preferentially summarizing messages, data in the path is the latest, and if the server in the leader role fails, a new leader role is determined from the at least one server serving as the follower role. The following is a detailed description of the determination process of the leader role:
in the embodiment of the application, when the server of the leader role fails, a new server of the leader role can be automatically elected, so that the continuous availability of the whole system is ensured.
If one server which is taken as a leader role and is included in at least one server in the system does not fail, a heartbeat message is periodically sent to at least one server which is taken as a follow role and is included in at least one server in the system, so that the server which is taken as the leader role does not fail is indicated to the server which is taken as the follow role. Each role-following server has its own clock, and if the role-following server does not receive the heartbeat message of the leader role within a preset time interval of the clock, the role-following server determines that the role-following server fails, switches to a candidate state, and sends voting messages to all other role-following servers to instruct the other role-following servers to vote to the candidate server. If the candidate has acquired most of the votes from all of the role-following servers, the candidate switches to the leader role's server and sends a broadcast message to all of the role-following servers indicating that the role-following servers are the new leader role's server.
In this embodiment, the server with the leader role is used as the server with the latest data, and the operation and maintenance staff preferentially use the data in the server with the leader role, and if there are other monitoring requirements, the operation and maintenance staff can also connect to other servers with the leader role.
Referring to fig. 5, an interaction flowchart of a message transmission method according to an embodiment of the present invention is shown, where as shown in the figure, the embodiment includes, but is not limited to, the following steps:
s301, the first client acquires a first message to be sent. S302, a first client selects at least one network node from at least two network nodes and sends a first message to the selected at least one network node, wherein the first message is relayed in the at least two network nodes. S303, the first server receives a first message relayed transmission among at least two network nodes.
After receiving the first message, the first server may perform step S304, or perform steps S305 to S306. S304, the first server sends a broadcast message, where the broadcast message includes a message identifier of the first message, and the broadcast message is used to instruct to stop the relay transmission of the first message in at least two network nodes.
In the embodiment of the present invention, when the first server receives the first message, the broadcast message is sent to stop the relay transmission of the first message in at least two network nodes.
In the communication system according to the embodiment of the present invention, when the number of servers is at least two, the first server includes a server that serves as a leader role and at least one server that serves as a follower role, and the first server may be a server that serves as a leader role or a server that serves as a follower role; that is, the server sending the broadcast message may be a server in the leader role or a server in the follow-up role, and the broadcast message is sent by the first server receiving the first message.
It should be understood that, the first server is any server in the communication system, that is, in a case that any server receives the first message, the server that receives the first message sends out a broadcast message to stop the relay transmission of the first message in at least two network nodes.
S305, the first server sends a request message to a second server, where the request message is used to trigger the second server to send a broadcast message in the communication system, and the second server is used to manage the first server.
Unlike step S304, in the communication system in this case, only the server of the leader role has the authority to send out the broadcast message, and if the first server is the server of the follower role, the server of the follower role that has received the first message sends a request message to the server of the leader role so that the server of the leader role sends the broadcast message in the communication system, and the server of the leader role is the second server in this case.
S306, the second server sends a broadcast message, and the broadcast message is used for indicating to stop relay transmission of the first message in the at least two network nodes.
S307, the first client receives the broadcast message.
Step S301 to step S307 may refer to the description of the embodiments in fig. 1 and fig. 4 in the foregoing embodiments, and are not repeated herein.
The method of the embodiments of the present invention is described above, and the apparatus of the embodiments of the present invention is described below.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a message transmission apparatus 70 according to an embodiment of the present invention, where the message transmission apparatus 70 is applied to a first client in a communication system, where the communication system includes at least two network nodes, where the at least two network nodes include at least one client and at least one server, and the at least one client includes the first client, and the message transmission apparatus 70 includes:
the message obtaining module 701 is configured to obtain a first message to be sent.
A message transmission module 702, configured to send the first message to at least one of the at least two network nodes, where the first message is relayed in the at least two network nodes until a first server of the at least one server receives the first message, and stops the relay transmission of the first message in the at least two network nodes; the relay transmission means that the network node receives the first message and forwards the first message.
In a possible design, the at least one server includes a server in a leader role and at least one server in a follower role, and the server in the leader role is used for managing the server in the follower role;
the first server is the server in the leader role or the server in the follower role.
In a possible design, the message transmission module 702 is further configured to receive a broadcast message of the first server, where the broadcast message carries a message identifier of the first message that has been received by the first server, and the message transmission module 702 stops forwarding the first message that matches the message identifier according to the broadcast message. And if the first message is received, stopping forwarding the first message according to the broadcast message.
In a possible design, if the first server is the server acting as the following role, the message transmission module 702 receives a broadcast message from a second server of the at least one server, where the broadcast message includes a message identifier of the first message, and the broadcast message is used to instruct to stop relaying the first message in the at least two network nodes, and the second server is the server acting as the leader role in the at least one server.
And if the first message is received, stopping forwarding the first message according to the broadcast message.
It should be noted that, for the content that is not mentioned in the embodiment corresponding to fig. 7, reference may be made to the description of the method embodiment, and details are not described here again.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a message transmission apparatus 80 according to an embodiment of the present invention, where the message transmission apparatus is applied to a first server in a communication system, the communication system includes at least two network nodes, where the at least two network nodes include at least one client and at least one server, and the at least one server includes the first server, and the message transmission apparatus includes:
a receiving module 801, configured to receive a first message relayed among the at least two network nodes, where the relayed transmission refers to that the network node receives the first message and forwards the first message.
A sending module 802, configured to send a broadcast message in the communication system, where the broadcast message includes a message identifier of the first message, and the broadcast message is used to instruct to stop relaying transmission of the first message in the at least two network nodes.
In a possible design, the at least one server includes a server serving as a leader role and at least one server serving as a follower role, the server serving as the leader role is configured to manage the server serving as the follower role, and if the first server is the server serving as the leader role, the sending module 802 is further configured to send the first message to the at least one server serving as the follower role, so that the server serving as the follower role stores the first message in a backup manner.
In a possible design, the at least one server includes a server in a leader role and at least one server in a follow-up role, where the server in the leader role is configured to manage the servers in the follow-up role, and if the first server is one of the servers in the at least one follow-up role, the sending module 802 is further configured to send the first message to the server in the leader role, so that the server in the leader role stores the first message in a backup manner to the server in the at least one follow-up role.
Referring to fig. 9, fig. 9 is a schematic diagram of a component structure of a message transmission device according to an embodiment of the present invention, where the message transmission device 90 includes a processor 901, a memory 902, and a transmission interface 903. The processor 901 is connected to the memory 902 and the transmission interface 903, for example, the processor 901 may be connected to the memory 902 and the transmission interface 903 through a bus.
The processor 901 is configured to support the message transmission device to perform corresponding functions in the message transmission methods described in fig. 1-6. The processor 901 may be a Central Processing Unit (CPU), a Network Processor (NP), a hardware chip, or any combination thereof. The hardware chip may be an Application Specific Integrated Circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof.
The memory 902 is used to store program codes and the like. Memory 902 may include Volatile Memory (VM), such as Random Access Memory (RAM); the memory 902 may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory (flash memory), a Hard Disk Drive (HDD) or a solid-state drive (SSD); the memory 902 may also comprise a combination of the above-described types of memory.
Optionally, the transmission interface 903 is configured to receive or forward a message.
In one possible design, where the message transmitting device corresponds to a first client, the processor 901 may invoke the program code to perform the following operations:
the method comprises the steps of obtaining a first message to be sent, sending the first message to at least one node in a plurality of nodes in a system, and stopping relay sending of the first message in the plurality of nodes included in the monitoring system until a first server in the at least one server.
In another possible design, where the message transmitting device corresponds to a first server, the processor 901 may call the program code to perform the following operations:
receiving a first message relayed transmission in the at least two network nodes, wherein the relayed transmission means that the network nodes receive the first message and forward the first message; and sending a broadcast message in the communication system, the broadcast message including a message identifier of the first message, the broadcast message being used to instruct to stop relaying transmission of the first message in the at least two network nodes.
Embodiments of the present invention also provide a computer storage medium storing a computer program, the computer program comprising program instructions, which when executed by a computer, which may be part of the above-mentioned message transmission device, cause the computer to perform the method according to the foregoing embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.

Claims (10)

1. A message transmission method, characterized in that the method is applied to a communication system, the communication system comprises at least two network nodes, the at least two network nodes comprise at least one client and at least one server, the at least one client comprises a first client; the method comprises the following steps:
the first client acquires a first message to be sent;
the first client selecting at least one network node from the at least two network nodes and sending the first message to the selected at least one network node, wherein the first message is relayed in the at least two network nodes until a first server of the at least one server stops relaying the first message in the at least two network nodes when receiving the first message;
wherein the relay transmission means that the network node receives the first message and forwards the first message.
2. The method according to claim 1, wherein the number of servers in the at least one server is at least two, and the at least one server includes a server in a leader role and at least one server in a follower role, the server in the leader role is used for managing the servers in the follower role;
the first server is the server in the leader role or the server in the follower role.
3. The method of claim 1 or 2, wherein after the first client selecting at least one network node from the at least two network nodes and sending the first message to the selected at least one network node, further comprising:
the first client receives a broadcast message, the broadcast message includes a message identifier of the first message, and the broadcast message is used for indicating to stop relaying transmission of the first message in the at least two network nodes.
4. A message transmission method, characterized in that the method is applied to a communication system, the communication system comprises at least two network nodes, the at least two network nodes comprise at least one client and at least one server, and the at least one server comprises a first server; the method comprises the following steps:
a first server receives a first message of relay transmission in the at least two network nodes, wherein the relay transmission means that the network nodes receive the first message and forward the first message;
the first server sends a second message, wherein the second message is used for triggering the first message to stop relay transmission in the at least two network nodes; wherein the second message comprises a message identification of the first message.
5. The method of claim 4, wherein the first server sending a second message comprises:
the first server transmitting a broadcast message in the communication system; alternatively, the first and second electrodes may be,
the first server sends a request message to a second server, wherein the request message is used for triggering the second server to send a broadcast message in the communication system, and the second server is used for managing the first server;
wherein the broadcast message is used to indicate to stop relaying transmission of the first message in the at least two network nodes.
6. The method according to claim 4, wherein the number of servers in the at least one server is at least two, and the at least one server includes a server in a leader role and at least one server in a follower role, the server in the leader role is used for managing the servers in the follower role;
after the first server receives the first message relayed transmission in the at least two network nodes, further comprising:
if the first server is the server serving as the leader role, the first server sends the first message to each server serving as a follow-up role in the at least one server serving as the follow-up role, so that the server serving as the follow-up role stores the first message in a backup manner;
if the first server is the server which is the follow-up role, the first server sends the first message to the server which is the leader role, so that the server which is the leader role stores the first message backup to each server which is the follow-up role in the at least one server which is the follow-up role.
7. The method of claim 6, wherein if the first server is the server acting as the follows role, the method further comprises:
if the first server determines that the server serving as the leader role fails, the first server sends a voting request message to each server serving as a follow-up role in the at least one server serving as a follow-up role except the first server, wherein the voting request message is used for indicating to vote for the first server;
the first server receives at least one voting response message, wherein the voting response message comprises voting result information which is used for indicating whether the first server is allowed to be switched into a server serving as a leader role or not;
and if the at least one voting response message meets a switching condition, switching the first server from the server serving as the following role to the server serving as the leader role.
8. A message transmission apparatus applied to a first client in a communication system, the communication system including at least two network nodes including at least one client and at least one server, the at least one client including the first client, the message transmission apparatus comprising:
the message acquisition module is used for acquiring a first message to be sent;
a message transmission module, configured to select at least one network node from the at least two network nodes and send the first message to the selected at least one network node, where the first message is relayed in the at least two network nodes until a first server of the at least one server stops relaying the first message in the at least two network nodes when receiving the first message;
wherein the relay transmission means that the network node receives the first message and forwards the first message.
9. A message transmission apparatus applied to a first server in a communication system, the communication system including at least two network nodes including at least one client and at least one server, the at least one server including the first server, the message transmission apparatus comprising:
a receiving module, configured to receive a first message of relay transmission in the at least two network nodes, where the relay transmission refers to that the network node receives the first message and forwards the first message;
a sending module, configured to send a second message, where the second message is used to trigger the first message to stop relay transmission in the at least two network nodes; wherein the second message comprises a message identification of the first message.
10. A computer storage medium, characterized in that the computer storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method of any of claims 1-3 or 4-7.
CN202011617619.9A 2020-12-30 2020-12-30 Message transmission method, device and equipment Pending CN112822240A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011617619.9A CN112822240A (en) 2020-12-30 2020-12-30 Message transmission method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011617619.9A CN112822240A (en) 2020-12-30 2020-12-30 Message transmission method, device and equipment

Publications (1)

Publication Number Publication Date
CN112822240A true CN112822240A (en) 2021-05-18

Family

ID=75855610

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011617619.9A Pending CN112822240A (en) 2020-12-30 2020-12-30 Message transmission method, device and equipment

Country Status (1)

Country Link
CN (1) CN112822240A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103036983A (en) * 2012-12-14 2013-04-10 北京小米科技有限责任公司 Method, network node, server and system of information acquisition
US20200213903A1 (en) * 2017-07-31 2020-07-02 Huawei Technologies Co., Ltd. Data transmission method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103036983A (en) * 2012-12-14 2013-04-10 北京小米科技有限责任公司 Method, network node, server and system of information acquisition
US20200213903A1 (en) * 2017-07-31 2020-07-02 Huawei Technologies Co., Ltd. Data transmission method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈鹏;朱欣娟;: "一种自适应无线移动自组织网络数据传输方法", 西安工程大学学报, no. 06 *

Similar Documents

Publication Publication Date Title
CN108712501B (en) Information sending method and device, computing equipment and storage medium
CN112118315A (en) Data processing system, method, device, electronic equipment and storage medium
EP3542272B1 (en) Systems and methods for providing a notification system architecture
CN108347476B (en) Cross-machine-room data synchronization method and device and server
CN109788068B (en) Heartbeat state information reporting method, device and equipment and computer storage medium
JPS61500751A (en) Method for stopping program processes in multiprocessing systems
CN111209110B (en) Task scheduling management method, system and storage medium for realizing load balancing
US20180145871A1 (en) Systems and methods for providing a notification system architecture
CN104092719A (en) File transmission method, device and distributed cluster file system
CN112272291A (en) Video storage method, device, management equipment and readable storage medium
KR101028298B1 (en) Method and system for distributing data processing units in a communication network
JP5408620B2 (en) Data distribution management system and data distribution management method
CN113382056A (en) Data reporting method, device, equipment, storage medium and system
CN111988391A (en) Message sending method and device
CN113765690A (en) Cluster switching method, system, device, terminal, server and storage medium
CN111274047A (en) Information processing method, terminal, system, computer device and storage medium
CN109688011B (en) Agent selection method and device based on OpenStack
CN111756800A (en) Method and system for processing burst flow
CN112822240A (en) Message transmission method, device and equipment
CN115412609B (en) Service processing method, device, server and storage medium
US9967163B2 (en) Message system for avoiding processing-performance decline
CN115220993A (en) Process monitoring method, device, vehicle and storage medium
CN114816866A (en) Fault processing method and device, electronic equipment and storage medium
CN114911577A (en) Method, device, equipment and storage medium for setting network isolation rule
CN112437146A (en) Equipment state synchronization method, device and system

Legal Events

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