CN114422335A - Communication method, communication device, server and storage medium - Google Patents

Communication method, communication device, server and storage medium Download PDF

Info

Publication number
CN114422335A
CN114422335A CN202111677714.2A CN202111677714A CN114422335A CN 114422335 A CN114422335 A CN 114422335A CN 202111677714 A CN202111677714 A CN 202111677714A CN 114422335 A CN114422335 A CN 114422335A
Authority
CN
China
Prior art keywords
server
state information
servers
network
cluster
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
CN202111677714.2A
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.)
CYG Sunri Co Ltd
Original Assignee
CYG Sunri 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 CYG Sunri Co Ltd filed Critical CYG Sunri Co Ltd
Priority to CN202111677714.2A priority Critical patent/CN114422335A/en
Publication of CN114422335A publication Critical patent/CN114422335A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/0668Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40169Flexible bus arrangements
    • H04L12/40176Flexible bus arrangements involving redundancy
    • H04L12/40189Flexible bus arrangements involving redundancy by using a plurality of bus systems
    • 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/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • 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
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Hardware Redundancy (AREA)

Abstract

The application is applicable to the technical field of computer communication, and provides a communication method, a device, a server and a storage medium, wherein the method comprises the following steps: the method comprises the steps that a first server acquires network state information, wherein the network state information comprises connection state information between a plurality of servers and a plurality of networks respectively, and the plurality of servers comprise the first server; the first server determines a first network which is normally connected with the plurality of servers in the plurality of networks according to the network state information; the first server carries out information interaction with other servers in the plurality of servers through a first network. The method ensures the information interaction among the multiple servers while ensuring the network connection of the multiple services.

Description

Communication method, communication device, server and storage medium
Technical Field
The present application belongs to the field of computer communication technologies, and in particular, to a communication method, apparatus, server, and storage medium.
Background
With the development of computer technology, more and more management problems develop towards intellectualization, and therefore a large number of management systems are derived. Such as substation monitoring systems, train control systems, stock exchange systems, etc.
For a system with complex functional requirements, multiple servers are generally required to support the system, and message interaction is performed among the multiple servers through a platform bus. In order to ensure the robustness of the system network, the system also needs to adopt a multi-network mode to communicate among a plurality of networks without mutual influence; in the operation process of the system, when one network fails, the data communication between the servers is switched to the other network for processing; similarly, in the event of a failure in one of the networks, the platform bus also needs to have the capability to respond quickly and switch to the other network for message interaction.
The stable and reliable platform bus is an important technical support of a system (such as a substation monitoring system), the real-time performance and the reliability of system data acquisition and transmission are determined by the rationality of a communication framework and a network switching mode of the platform bus, so that the communication technology of the system needs to be analyzed, and a proper communication scheme is very necessary to be designed according to the operation requirement of the system.
Disclosure of Invention
The embodiment of the application provides a communication method, a communication system, a server and a storage medium, which ensure information interaction among multiple servers while ensuring network connection of multiple services.
In a first aspect, an embodiment of the present application provides a communication method, including:
a first server acquires network state information, wherein the network state information comprises connection state information between a plurality of servers and a plurality of networks respectively, and the plurality of servers comprise the first server;
the first server determines a first network which is normally connected with the plurality of servers in the plurality of networks according to the network state information;
the first server performs information interaction with other servers in the plurality of servers through the first network.
In the above embodiment, when a network for performing information interaction fails, the communication method may switch the plurality of servers to another normal network at the same time, so as to ensure that the network connection of the servers is normal, and as the plurality of servers may be switched to the same network at the same time, the interaction of messages between the servers is ensured.
In a possible implementation manner of the first aspect, the connection state information between the plurality of servers and the plurality of networks respectively includes first connection state information between the first server and the plurality of networks respectively, and second connection state information between the other servers and the plurality of networks respectively; the acquiring, by the first server, the network state information specifically includes:
the first server acquires the first connection state information;
the first server issues the first connection state information in a server cluster corresponding to a second network, so that the other servers acquire the first connection state information, the second network is a network normally connected with the first server, and the server cluster corresponding to the second network comprises a plurality of message queue servers respectively deployed on a plurality of servers;
and the first server receives the subscribed second connection state information at the server side clusters respectively corresponding to the plurality of networks.
In a possible implementation manner of the first aspect, the communication method further includes:
the first server acquires local cluster state information, wherein the local cluster state information comprises state information of a plurality of first service end clusters, and the plurality of first service end clusters are service end clusters where a plurality of message queue service ends respectively corresponding to the plurality of networks in the first server are respectively located;
and if the local cluster state information does not have abnormal state information, the first server sends the local cluster state information to the other servers, and the local cluster state information is first normal cluster state information.
In a possible implementation manner of the first aspect, the communication method further includes:
if the local cluster state information has abnormal state information, the first server updates the local cluster state information according to the abnormal state information to obtain first normal cluster state information, and sends the obtained first normal cluster state information to other servers.
In a possible implementation manner of the first aspect, the updating the local cluster state information according to the abnormal state information to obtain first normal cluster state information specifically includes:
if the abnormal state information comprises first abnormal information, the first server informs the other servers to restart the message queue server belonging to the first server cluster, and acquires the first normal cluster state information; the first abnormal information indicates that the first service end cluster has an abnormally working message queue service end;
and if the abnormal state information comprises second abnormal information, the second abnormal information indicates that a first message queue server stops working, and the first server deletes the first message queue server from the first server cluster and acquires the first normal cluster state information.
In a possible implementation manner of the first aspect, the method further includes:
the first server receives second normal cluster state information sent by the other servers;
and updating a plurality of first service end clusters according to the first normal cluster state information and the second normal cluster state information.
In a possible implementation manner of the first aspect, the performing, by the first server, information interaction with other servers in the plurality of servers through the first network specifically includes:
the first server acquires a first subscription message corresponding to the first message topic from a server cluster corresponding to the first network, wherein the first message topic is a message topic respectively subscribed by the first server from all server clusters corresponding to multiple networks, and the subscription message is published by other servers in the multiple servers;
and the first server publishes a backed-up second subscription message to a server set corresponding to the first network, wherein the second subscription message is a subscription message corresponding to a second message topic subscribed by the other servers.
In a second aspect, an embodiment of the present application provides a server configured to perform the communication method described in any implementation manner of the first aspect.
In a third aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the communication method as described in any implementation manner in the first aspect above.
In a fourth aspect, an embodiment of the present application provides a communication system, including a plurality of servers according to the second aspect, where the plurality of servers are respectively connected to a plurality of networks, each network corresponds to a server cluster, and the server cluster includes a plurality of message queue servers deployed on the plurality of servers.
In a fifth aspect, the present application provides a computer program product, which when run on a server, causes the server to execute the communication method of any one of the above first aspects.
It is understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description of the first aspect, and are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a communication method according to an embodiment of the present application;
fig. 2 is a flowchart of a communication method according to an embodiment of the present application;
fig. 3 is a flowchart of a cluster state maintenance method in a communication method according to an embodiment of the present application;
fig. 4 is a schematic block diagram of a communication device according to an embodiment of the present application;
fig. 5 is a schematic internal structural diagram of a server according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The application provides a communication method, which is applied to a multi-server system, wherein a plurality of servers are respectively connected to a plurality of networks through a plurality of switches, and clients on the servers are carried out through the same network during interactive communication. When the connected network fails, all the station servers switch to the network in any one of the plurality of networks for communication.
And a message queue server is operated on each network connected with each server, and all the message queue servers operated on the same network form a server cluster corresponding to the network. And all the clients issue messages to one of the server clusters and acquire subscribed messages from all the server clusters.
Fig. 1 is a diagram of an application scenario of a communication method in an embodiment of the present application, where four servers and two networks are taken as an example. As shown in fig. 1, each server is connected to the a network through switch a and to the B network through switch B. And a corresponding message queue server A is operated on the network A of each server, and a corresponding message queue server B is operated on the network B. All the message queue service terminals A form a service terminal cluster A, all the message queue service terminals B form a service terminal cluster B, wherein the service terminal cluster A is a first bus between the servers, the first bus is connected to the network A, the service terminal cluster B is a second bus between the servers, and the second bus is connected to the network B.
Optionally, a cluster daemon is run on each server, and the cluster daemon monitors the local network state through an MII (Media Independent Interface), updates the local network state to a local cache, and sends the local network state to the server cluster a and the server cluster B. In addition, the cluster daemon process respectively checks the local cluster state information and manages according to the cluster state information.
And the server also runs clients for realizing specific functions, each client is respectively connected with the server cluster A and the server cluster B, and all the clients publish messages through the same server cluster and subscribe messages from all the server clusters.
Optionally, each client creates two client objects client1 and client2 for connecting to the server cluster a and the server cluster B, respectively; the client1 and the client2 respectively start a node management thread for managing the connection with the message queue server in the server cluster A and the server cluster B.
The communication method in the embodiment of the application can be applied to communication among multiple servers in the transformer substation monitoring system, and specifically, the transformer substation monitoring system host comprises one master and one slave safety I area integrated monitoring host and one master and one slave safety II area integrated application host. Each host bears four main functions of monitoring the operation of the station control system, operation control, intelligent application, main station support service and the like, and provides remote service support for the main station through a real-time gateway machine and a service gateway machine. The main and auxiliary monitoring hosts of the safety I area are two servers, the main and auxiliary monitoring hosts of the safety II area are two servers, so that four servers are totally arranged, a double network is generally arranged in the system, the communication method is adopted, each server in the four servers is provided with two message queue service ends corresponding to the network, two service end clusters are formed, the four servers realize information interaction according to the communication method in the embodiment of the application, specific contents refer to the discussion of other parts of the communication method of the application, and the detailed description is omitted.
A communication method provided by the present application is exemplarily described below with reference to specific embodiments. For example, testing software may be installed on the mobile terminal, and the testing software is used for executing the steps executed by the mobile terminal in the bluetooth connection testing method.
Fig. 2 shows a method flow diagram of a communication method provided in an embodiment of the present application. The first service is any one of a plurality of servers, and the first server is used for explaining the application, and other servers in the plurality of servers execute the same steps. By way of example and not limitation, the communication method comprises the steps of:
step S201, the first server obtains network state information, where the network state information includes connection state information between the plurality of servers and the plurality of networks, respectively, and the plurality of servers includes the first server.
In an embodiment, the first server is any one of a plurality of servers, the network state information represents that the connection state between the corresponding server and the network is available or unavailable, and the connection of the server and the network may be unavailable when the server is disconnected from the network, the switch is abnormal, the network is abnormal, and the like.
In one embodiment, the connection state information between the plurality of servers and the plurality of networks respectively comprises first connection state information between a first server and the plurality of networks respectively and second connection state information between other servers and the plurality of networks respectively; wherein step S201 specifically includes the following steps: the first server acquires first connection state information; the method comprises the steps that a first server issues first connection state information in a server cluster corresponding to a second network so that other servers can acquire the first connection state information, the second network is a network normally connected with the first server, and the server cluster corresponding to the second network comprises a plurality of message queue servers respectively deployed on a plurality of servers; and the first server receives the subscribed second connection state information at the server side clusters respectively corresponding to the plurality of networks.
Specifically, taking the case of only the a network and the B network as an example, if the a network on the first server is abnormal and the B network is normal, the first server switches to the B network, that is, the message is sent to the server cluster corresponding to the B network, and because the multi-subscription mechanism exists, other servers can subscribe to the message from the server cluster corresponding to the B network, the other servers will receive the message that the a network of the first server is abnormal, and thus the other servers are also switched to the B network.
In one example, the second network may be a network used for current information interaction, for example, an a network, and the first server may determine a connection state of the a network before receiving the subscription message, and continue to use the a network if the connection state of the a network is normal. In another example, the second network may also be a switched network, for example, if the network connection of the currently used a network is not normal, the B network is switched to, and the message interaction is performed through the B network.
In the embodiment, all the servers publish messages only through one server cluster, but subscribe messages from all the server clusters. The client side subscribes in a plurality of server side clusters respectively aiming at the same message topic needing to subscribe; aiming at the message to be sent, the client selects a server cluster with a normal network state in a plurality of networks to send the message, so that the reliability of message interaction is ensured.
Step S202, the first server determines a first network which is normally connected with the plurality of servers in the plurality of networks according to the network state information.
In the embodiment, a client in a first server establishes connection with a server cluster corresponding to a plurality of networks, and the client subscribes a message of network state information from all server clusters, so that network connection state information of a local server and other servers can be obtained. In order to ensure the interaction among different clients, all the clients need to judge the network states corresponding to all the servers, the network is determined to be the first network only if a certain network is normally connected with a plurality of servers, and the network is possible to be a network for server information interaction only if the network is determined to be the first network.
For convenience of understanding, the following different network number cases describe the "first network" in the embodiment of the present application:
if the connection states of the four servers and the network A are normal, the network A is a first network; if the connection state of one server and the A network is abnormal, the A network is not the first network. The first network may be a network used for current information interaction or an unused network.
Step S203, the first server performs information interaction with other servers in the plurality of servers through the first network.
In an embodiment, the information interaction between the servers comprises information interaction between clients running on the servers. The client is connected to the corresponding server cluster through the message queue server.
The following describes network switching of a client in the case of two networks.
The first client runs on a first server, the first server is connected with the network A and the network B, a message queue server A1 corresponding to the network A, and a cluster where the message queue server A1 is located is a server cluster A1; a message queue server B1 corresponding to the B1 network, wherein the cluster where the message queue server B1 is located is a server cluster B1; the first client creates two client objects client-A1 and client-B1 for connecting to the message queue service A1 and the message queue service B1, respectively. At the current moment, the first client sends a message to the server cluster a1 through the message queue server a1, the first client subscribes to the message topic from both the server cluster a1 and the server cluster B1, and backs up all subscribed message topics:
if the first client determines that the A networks on the first server and other servers are normal according to the network state information, continuing to send messages to a server cluster A1 through a message queue server A1;
if the first client determines from the network state information that an A-network anomaly on the first server or other servers is present, the first client chooses to send a message to server cluster B1 via message queue server B1.
Optionally, after the first client switches networks and establishes a connection with a new server cluster, the first client re-subscribes to the message topic that the first client has subscribed before re-establishing the connection (backups all subscribed message topics), and re-subscribes to the network state information message topic, so as to be used for receiving network connection states of other servers and multiple networks.
The following describes the selection of the message queue server of the client in the case of two networks.
The first client runs on a first server and comprises two networks, namely an A network and a B network, a message queue server A1 corresponding to the A network, and a cluster where the message queue server A1 is located is a server cluster A1; a message queue server B1 corresponding to the B1 network, wherein the cluster where the message queue server B1 is located is a server cluster B1; the first client creates two client objects client-A1 and client-B1 for connecting to the message queue service A1 and the message queue service B1, respectively. At the current moment, the first client sends a message to the server cluster a1 through the message queue server a1, the first client subscribes to the message topic from both the server cluster a1 and the server cluster B1, and backs up all subscribed message topics:
if the first client determines that the networks A and B on the first server and other servers are both normal according to the network state information and determines that the connection between the first client and the message queue server A1 is normal, the first client continues to send messages (such as backup messages in a local cache) to the server cluster A1.
If the first client determines that the networks A and B on the first server and other servers are both normal according to the network state information and judges that the connection between the first client and the message queue server A1 is abnormal, the first client disconnects the message queue server A1 and selects other message queue servers on other servers in the server cluster A1 to connect.
Optionally, when the first client selects another message queue server located on the network a to connect, if the connection is unsuccessful, the first client may select a next message queue server on the network a to connect.
In the embodiment, the first client preferentially selects the message queue server of the local server to connect, and if the server network is normal but the message queue server itself is abnormal, the first client sequentially traverses the message queue servers on other servers of the same network as the local message queue server to connect. In this case, only the message queue server is switched, and the network is not switched.
In an embodiment, one server cluster is a cluster formed by message queue servers, and plays a role of a message bus, and is connected with all clients in the same server cluster, and interaction with other clients can be realized by sending messages to the server cluster and receiving subscription messages. And the message interaction is carried out by a server cluster method, and because each service is provided with a message queue server, the load balance of the message can be ensured.
In one embodiment, step S203 specifically includes:
the first server acquires a first subscription message corresponding to the first message topic from a server cluster corresponding to the first network, wherein the first message topic is a message topic respectively subscribed by the first server from all server clusters corresponding to multiple networks, and the subscription message is published by other servers in the multiple servers;
and the first server publishes a backed-up second subscription message to a server set corresponding to the first network, wherein the second subscription message is a subscription message corresponding to a second message topic subscribed by the other servers.
In an embodiment, the first subscription message is obtained from the server cluster by the first server in a subscription manner, and the second subscription message is sent to other servers by the first server. By backing up the published message (second subscription message), loss of the message is prevented. For example, the backup message can be sent again when the network is switched, so that the loss of the message in the network switching process can be prevented, and the safety and the integrity of the message can be ensured.
In an embodiment, the first server backs up the second subscription message, specifically, backs up a preset number of second subscription messages within a preset time period.
Specifically, the preset time period is preferably the time period closest to the current time, and may be specifically determined according to needs. Alternatively, the greater the preset number, the higher the safety, and the more the safety, the skilled person can determine the safety according to the actual needs. In an alternative embodiment, the predetermined number is 2000.
In an embodiment, the communication method includes a process of maintaining a cluster state, as shown in fig. 3, which is a flowchart of a cluster state maintaining method, as shown in fig. 3, the cluster state maintaining method includes:
step S301, the first server obtains local cluster state information, where the local cluster state information includes state information of a plurality of first service end clusters, and the plurality of first service end clusters are service end clusters where a plurality of message queue service ends respectively corresponding to a plurality of networks in the first server are respectively located.
In an embodiment, the first service end cluster is any one of all the service end clusters, each first service end cluster includes a plurality of message queue service ends, and each service end cluster corresponds to one network.
It will be appreciated that the cluster state information includes the name and status of the message queue servers included in the cluster. And the first server of the local cluster state information queries the obtained result from the local message queue server. Specifically, the cluster daemon queries the local message queue server for the cluster state information of the corresponding server cluster.
Step S302, if the local cluster state information does not have abnormal state information, the first server sends the local cluster state information to other servers, and the local cluster state information is first normal cluster state information.
In the embodiment, the cluster state information is not abnormal, which mainly means that the cluster state information includes names of all message queue servers and states of all the message queue servers are normal. In this case, the normal local cluster state information is sent to other servers.
In an embodiment, as shown in fig. 3, the cluster state maintenance method further includes:
step S303, if the local cluster state information has the abnormal state information, the first server updates the local cluster state information according to the abnormal state information to obtain first normal cluster state information, and sends the obtained first normal cluster state information to the other servers.
In the embodiment, if the cluster state information is abnormal, the first server manages the abnormal server cluster so as to enable the corresponding cluster state to be recovered to be normal.
In one embodiment, the updating the local cluster state information according to the abnormal state information in step S303 to obtain the first normal cluster state information specifically includes:
if the abnormal state information comprises first abnormal information, the first server informs other servers to restart the message queue server belonging to the first server cluster, and acquires first normal cluster state information; the first abnormal information indicates that the first server cluster has an abnormally working message queue server;
and if the abnormal state information comprises second abnormal information, the second abnormal information indicates that the first message queue server stopping working exists, and the first server deletes the first message queue server from the first server cluster and acquires the first normal cluster state information.
In an embodiment, the first server cluster is a server cluster whose abnormal state information is the first abnormal information. For ease of understanding, the following description is made with respect to various abnormal situations.
In an embodiment, the recovery of the abnormal condition of the first abnormal information may be implemented by restarting the server. In one example, the message queue may not work properly, such as the message queue cannot be self-started after being closed, the message queue cannot join the cluster, and the like. Under the first abnormal condition, the message queue server in the first server cluster can be restarted, and the message queue server with the abnormality can be selectively restarted.
For example, "no self-start after message queue close" can be expressed as "not reserving" and status lasting 20 seconds after the message queue server name appears in the cluster status information. The "message queue cannot join the cluster" may specifically be represented that the state information after the message queue server name appears in the cluster state information is "Exit" and is not recovered in 60 seconds.
In another abnormal case in the embodiment, the second abnormal information cannot be recovered by restarting the message queue server, so that the corresponding message queue server is kicked out of the cluster, and a new server cluster is formed only by using the normal message queue server. If the server cluster is a cluster in which the client performs data interaction, the client originally connected to the kicked message queue server can switch the message queue server in the updated cluster.
Optionally, the condition that the message queue server stops working may be represented as that the state information after the name of the message queue server appears in the cluster state information is "stopping _ nodes". And kicking out the message queue server corresponding to the stopping _ nodes from the cluster in which the stopping _ nodes are positioned during specific recovery operation.
Optionally, after the first server deletes the first message queue server from the first server cluster, the method further includes:
and the first server acquires the local cluster state information again, and if the local cluster state information shows that the first message queue server side is recovered to be normal, the first server rejoins the first message queue server side into the corresponding server side cluster.
Specifically, a cluster daemon is arranged in each server, and the cluster daemon is responsible for kicking out a message queue server which stops working from a server cluster, and rejoining a message queue server which is recovered to be normal after kicked out of the cluster into the cluster.
Optionally, if the server 1 is connected to a network a and a network B, a message queue server a corresponding to the network a, and a message queue server B corresponding to the network B; when the network A is abnormal, the message queue server A is abnormal and cannot work, so cluster daemons on other servers kick the message queue server out of the cluster. When the network A returns to normal, the message queue server A returns to normal, and the cluster daemon process on the server 1 adds the message queue server A into the cluster.
In an embodiment, the sending of the normal cluster state information may be performed in a UDP (User data packet Protocol) message through a network. Alternatively, the normal cluster state information may be sent over a network corresponding to the cluster.
In an embodiment, as shown in fig. 3, the cluster state maintenance method further includes:
and step S304, the first server receives the second normal cluster state information sent by other servers.
In the embodiment, the servers send and receive normal cluster state information to each other.
Step S305, the first server updates the plurality of first service end clusters according to the first normal cluster state information and the second normal cluster state information.
In the embodiment, a plurality of first service end clusters are updated according to the state information of the first normal cluster and the state information of the second normal cluster, and the update is mainly used for dealing with the split-brain condition of the clusters, wherein the split-brain of the clusters means that the same cluster is split into a plurality of clusters. Because different servers obtain the cluster state information of the corresponding server cluster through respective inquiry of the message queue server, if the cluster split occurs, the cluster state information detected by different servers is different, and different clusters need to be restored to the same cluster in order to ensure the cluster state information.
In an embodiment, the cluster state information includes names of message queue servers included in each cluster state information, and the step S305 specifically includes:
comparing the names in the first normal cluster state information and the second normal cluster state information to obtain a comparison result;
judging whether the first normal cluster state information and the second normal cluster state information are the same according to the comparison result;
if yes, returning to the step S301;
if not, the first normal cluster state information and the second normal cluster state information are recovered to be the same cluster state information.
For example, assume that the number of names in the first normal cluster state information is N1 and the number of names in the second normal cluster state information is N2. According to different comparison results, the recovery mode of the cluster state information is different and specifically described as follows:
if N1 > N2, the first server receives the name in the second normal cluster state information to add to the first normal cluster state information and deletes the duplicate name.
If N1 < N2, the first server adds the name in the first normal cluster state information to the first normal cluster state information and deletes the duplicate name.
If N1 is N2 > 1, comparing the first IP address corresponding to the first server with the second IP addresses corresponding to other servers: if the first IP address is larger than the second IP address, the first server adds the name in the first normal cluster state information into the first normal cluster state information and deletes the repeated name; and if the first IP address is smaller than the second IP address, the first server receives the name in the second normal cluster state information, adds the name into the first normal cluster state information, and deletes the repeated name.
If the N1 is equal to N2 is equal to 1, comparing the first IP address corresponding to the first server with a third IP address, which is received by the first server within 5 seconds and has the smallest all IP addresses corresponding to other servers, where the first IP address is greater than the third IP address, and adding the name in the first normal cluster state information to the first normal cluster state information by the first server, and deleting the duplicate name; and if the first IP address is larger than the third IP address, the first server receives the name in the second normal cluster state information, adds the name into the first normal cluster state information, and deletes the repeated name.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Fig. 4 shows a block diagram of a communication device provided in the embodiment of the present application, corresponding to the communication method described in the above embodiment, and only the relevant parts to the embodiment of the present application are shown for convenience of description.
Referring to fig. 4, the communication device 40 includes:
a first obtaining unit 41, configured to obtain network status information, where the network status information includes connection status information between a plurality of servers and a plurality of networks, respectively, and the plurality of servers include the first server;
a determining unit 42, configured to determine, according to the network state information, a first network of the multiple networks, where the first network is normally connected to the multiple servers;
an information interaction unit 43, configured to perform information interaction with other servers in the multiple servers through the first network.
Optionally, the connection status information between the plurality of servers and the plurality of networks respectively includes first connection status information between the first server and the plurality of networks respectively, and second connection status information between the other servers and the plurality of networks respectively; when the first obtaining unit 41 is configured to obtain the network status information, specifically: acquiring the first connection state information; the first connection state information is issued in a server cluster corresponding to a second network, so that the other servers can acquire the first connection state information, the second network is a network normally connected with the first server, and the server cluster corresponding to the second network comprises a plurality of message queue servers respectively deployed on a plurality of servers; and receiving the subscribed second connection state information at the server side clusters respectively corresponding to the plurality of networks.
Optionally, the communication device 40 further includes a second obtaining unit and a first sending unit: the second obtaining unit is configured to obtain local cluster state information, where the local cluster state information includes state information of a plurality of first server clusters, and the plurality of first server clusters are server clusters where a plurality of message queue servers corresponding to the plurality of networks in the first server are respectively located; the first sending unit is configured to send the local cluster state information to the other servers if the local cluster state information does not have abnormal state information, where the local cluster state information is first normal cluster state information.
Optionally, the communication device 40 further includes a first updating unit, where the first updating unit is configured to update the local cluster state information according to the abnormal state information if the local cluster state information has the abnormal state information, to obtain first normal cluster state information, and send the obtained first normal cluster state information to another server.
Optionally, the first updating unit is configured to, when updating the local cluster state information according to the abnormal state information to obtain first normal cluster state information: if the abnormal state information comprises first abnormal information, the updating unit informs the other servers to restart the message queue server belonging to the first server cluster and acquires the first normal cluster state information; the first abnormal information indicates that the first service end cluster has an abnormally working message queue service end; if the abnormal state information comprises second abnormal information which indicates that a first message queue server stops working, the updating unit deletes the first message queue server from the first server cluster and acquires the first normal cluster state information.
Optionally, the communication device 40 further includes a receiving unit and a second updating unit: the receiving unit is used for receiving second normal cluster state information sent by the other servers; and the second updating unit is used for updating the plurality of first service end clusters according to the first normal cluster state information and the second normal cluster state information.
Optionally, when the information interaction unit 43 is configured to perform information interaction with other servers in the multiple servers through the first network, specifically, to: when subscribing the target message theme, backing up the messages corresponding to all the target message themes; issuing a message to a server cluster corresponding to the first network; and backing up a preset number of messages issued in a preset time period.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Based on the same inventive concept, an embodiment of the application further provides a server. As shown in fig. 5, the server 500 of this embodiment includes: a processor 501, a memory 502, and a computer program 504 stored in the memory 502 and executable on the processor 501. The computer program 504 may be executed by the processor 501 to generate instructions 503, and the processor 501 may implement the steps in the above-described embodiments of the image color optimization method according to the instructions 503. Alternatively, the processor 501, when executing the computer program 504, implements the functions of the modules/units in the above-described device embodiments, such as the functions of the first obtaining unit 41 to the information interacting unit 43 shown in fig. 4.
Illustratively, the computer program 504 may be partitioned into one or more modules/units, which are stored in the memory 502 and executed by the processor 501 to accomplish the present application. One or more modules/units may be a series of computer program instruction segments capable of performing specific functions that describe the execution of computer program 504 in server 500.
The Processor 501 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 502 may be an internal storage unit of the server 500, such as a hard disk or a memory of the server 500. The memory 502 may also be an external storage device of the server 500, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the server 500. Further, memory 502 may also include both internal storage units of server 500 and external storage devices. Memory 502 is used to store computer programs and other programs and data needed by server 500. The memory 502 may also be used to temporarily store data that has been output or is to be output.
The embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, and when being executed by a processor, the computer program implements the steps performed by the first server in the above method embodiments.
The embodiments of the present application provide a computer program product, which when running on a server, enables the server to implement the steps performed by the first server in the above method embodiments when executed.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in 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 can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a device/server, recording medium, computer Memory, Read-Only Memory (ROM), Random-Access Memory (RAM), electrical carrier signals, telecommunications signals, and software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other ways. For example, the above-described apparatus/server embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method of communication, comprising:
a first server acquires network state information, wherein the network state information comprises connection state information between a plurality of servers and a plurality of networks respectively, and the plurality of servers comprise the first server;
the first server determines a first network which is normally connected with the plurality of servers in the plurality of networks according to the network state information;
the first server performs information interaction with other servers in the plurality of servers through the first network.
2. The communication method according to claim 1, wherein the connection state information between the plurality of servers and the plurality of networks respectively comprises first connection state information between the first server and the plurality of networks respectively, and second connection state information between the other servers and the plurality of networks respectively; the acquiring, by the first server, the network state information specifically includes:
the first server acquires the first connection state information;
the first server issues the first connection state information in a server cluster corresponding to a second network, so that the other servers acquire the first connection state information, the second network is a network normally connected with the first server, and the server cluster corresponding to the second network comprises a plurality of message queue servers respectively deployed on a plurality of servers;
and the first server receives the subscribed second connection state information at the server side clusters respectively corresponding to the plurality of networks.
3. The communication method according to claim 1, further comprising:
the first server acquires local cluster state information, wherein the local cluster state information comprises state information of a plurality of first service end clusters, and the plurality of first service end clusters are service end clusters where a plurality of message queue service ends respectively corresponding to the plurality of networks in the first server are respectively located;
and if the local cluster state information does not have abnormal state information, the first server sends the local cluster state information to the other servers, and the local cluster state information is first normal cluster state information.
4. The communication method according to claim 3, further comprising:
if the local cluster state information has abnormal state information, the first server updates the local cluster state information according to the abnormal state information to obtain first normal cluster state information, and sends the obtained first normal cluster state information to other servers.
5. The communication method according to claim 4, wherein the updating the local cluster state information according to the abnormal state information to obtain first normal cluster state information specifically includes:
if the abnormal state information comprises first abnormal information, the first server informs the other servers to restart the message queue server belonging to the first server cluster, and acquires the first normal cluster state information; the first abnormal information indicates that the first service end cluster has an abnormally working message queue service end;
and if the abnormal state information comprises second abnormal information, the second abnormal information indicates that a first message queue server stops working, and the first server deletes the first message queue server from the first server cluster and acquires the first normal cluster state information.
6. The communication method according to claim 4 or 5, further comprising:
the first server receives second normal cluster state information sent by the other servers;
and the first server updates a plurality of first service end clusters according to the first normal cluster state information and the second normal cluster state information.
7. The communication method according to claim 2, wherein the first server performs information interaction with other servers of the plurality of servers through the first network, and specifically includes:
the first server acquires a first subscription message corresponding to a first message topic from a server cluster corresponding to the first network, wherein the first message topic is a message topic respectively subscribed by the first server from all server clusters corresponding to multiple networks, and the subscription message is published by other servers in the multiple servers;
and the first server publishes a backed-up second subscription message to a server set corresponding to the first network, wherein the second subscription message is a subscription message corresponding to a second message topic subscribed by the other servers.
8. A server, characterized in that the server is configured to perform the communication method of any one of claims 1 to 7.
9. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the communication method according to any one of claims 1 to 7.
10. A communication system, comprising a plurality of servers according to claim 8, wherein the plurality of servers are respectively connected to a plurality of networks, each network corresponds to a server cluster, and the server cluster comprises a plurality of message queue servers respectively deployed on the plurality of servers.
CN202111677714.2A 2021-12-31 2021-12-31 Communication method, communication device, server and storage medium Pending CN114422335A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111677714.2A CN114422335A (en) 2021-12-31 2021-12-31 Communication method, communication device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111677714.2A CN114422335A (en) 2021-12-31 2021-12-31 Communication method, communication device, server and storage medium

Publications (1)

Publication Number Publication Date
CN114422335A true CN114422335A (en) 2022-04-29

Family

ID=81270802

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111677714.2A Pending CN114422335A (en) 2021-12-31 2021-12-31 Communication method, communication device, server and storage medium

Country Status (1)

Country Link
CN (1) CN114422335A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114885010A (en) * 2022-06-06 2022-08-09 中国工商银行股份有限公司 Request response method, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060235972A1 (en) * 2005-04-13 2006-10-19 Nokia Corporation System, network device, method, and computer program product for active load balancing using clustered nodes as authoritative domain name servers
US20090100289A1 (en) * 2007-10-15 2009-04-16 Benson Kwuan-Yi Chen Method and System for Handling Failover in a Distributed Environment that Uses Session Affinity
CN103718477A (en) * 2011-12-28 2014-04-09 Sk电信有限公司 Multi-network-based simultaneous data transmission method and apparatus applied to same
CN108337274A (en) * 2017-01-19 2018-07-27 贵州白山云科技有限公司 A kind of message distributing method and system
CN112291224A (en) * 2020-10-23 2021-01-29 上海淇玥信息技术有限公司 Real-time communication interaction method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060235972A1 (en) * 2005-04-13 2006-10-19 Nokia Corporation System, network device, method, and computer program product for active load balancing using clustered nodes as authoritative domain name servers
US20090100289A1 (en) * 2007-10-15 2009-04-16 Benson Kwuan-Yi Chen Method and System for Handling Failover in a Distributed Environment that Uses Session Affinity
CN103718477A (en) * 2011-12-28 2014-04-09 Sk电信有限公司 Multi-network-based simultaneous data transmission method and apparatus applied to same
CN108337274A (en) * 2017-01-19 2018-07-27 贵州白山云科技有限公司 A kind of message distributing method and system
CN112291224A (en) * 2020-10-23 2021-01-29 上海淇玥信息技术有限公司 Real-time communication interaction method and device and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114885010A (en) * 2022-06-06 2022-08-09 中国工商银行股份有限公司 Request response method, device, equipment and medium
CN114885010B (en) * 2022-06-06 2024-01-05 中国工商银行股份有限公司 Request response method, device, equipment and medium

Similar Documents

Publication Publication Date Title
US7518983B2 (en) Proxy response apparatus
CN103581276A (en) Cluster management device and system, service client side and corresponding method
CN103036719A (en) Cross-regional service disaster method and device based on main cluster servers
WO2012155630A1 (en) Method, device, and system for disaster recovery
CN111585835B (en) Control method and device for out-of-band management system and storage medium
EP2774323B1 (en) Method, communication system and non-transitory computer readable medium for optimizing network performance after a temporary loss of connection
CN112787918B (en) Data center addressing and master-slave switching method based on service routing tree
CN114422335A (en) Communication method, communication device, server and storage medium
JPH09259096A (en) System for enhancing reliability of network
CN113765690A (en) Cluster switching method, system, device, terminal, server and storage medium
CN112214377A (en) Equipment management method and system
CN114598593B (en) Message processing method, system, computing device and computer storage medium
KR100363523B1 (en) Method for controlling distributed processing in cluster severs
CN112437146B (en) Equipment state synchronization method, device and system
CN114090342A (en) Storage disaster tolerance link management method, message execution node and storage control cluster
CN112948177A (en) Disaster recovery backup method and device, electronic equipment and storage medium
CN114301763A (en) Distributed cluster fault processing method and system, electronic device and storage medium
CN108616597B (en) Distributed operation method for realizing service uninterrupted forever
CN112187542A (en) Data communication clustering method and system
CN113821334A (en) Method, device and system for configuring edge side equipment
CN110716827A (en) Hot backup method suitable for distributed system and distributed system
CN110890989A (en) Channel connection method and device
CN104702422A (en) Method, device and system for realizing high availability of communication equipment
CN115190005B (en) Redis-based high availability method of double-host system
CN114979037B (en) Multicast method, device, switch and storage medium

Legal Events

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