Cluster node communication method and system
Patent Information
- Application Number
- CN202311256448.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2043-09-26
AI Technical Summary
[0004]然而,在目前的集群节点通信中,集中式通信容易造成整个系统的单点故障,并且在扩展性方面受限;而Gossip方式通信可能导致消息延迟、一致性问题以及网络流量增加的问题
[0038] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the cluster node communication method as described above.
Smart Images

Figure CN117319522B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a cluster node communication method and system. Background Technology
[0002] In cluster communication, nodes need to communicate with each other to perform operations such as task allocation, data exchange, coordination, and synchronization. Cluster communication itself involves the maintenance of cluster metadata, which is typically achieved through two methods: centralized and Gossip.
[0003] Centralized methods store cluster metadata (node information and fault information, etc.) on a single node, with nodes constantly communicating with each other to maintain the integrity of data across all nodes in the cluster. Gossip methods, on the other hand, use random methods to propagate information throughout the network and ensure data consistency across all nodes within the system within a certain timeframe.
[0004] However, in current cluster node communication, centralized communication is prone to causing single points of failure in the entire system and is limited in terms of scalability; while Gossip-based communication may lead to message delays, consistency issues, and increased network traffic. Therefore, there is an urgent need for a cluster node communication method and system to solve the above problems. Summary of the Invention
[0005] To address the problems existing in the prior art, this invention provides a cluster node communication method and system.
[0006] This invention provides a cluster node communication method, comprising:
[0007] Based on the identifier socket, a listening channel is built between the nodes in the server cluster;
[0008] Based on the communication task instructions obtained by each node through the listening channel, a generator end, a task processing end, and a receiver end are determined among the nodes of the server cluster, and cluster node communication is carried out through the generator end, the task processing end, and the receiver end. The task processing end refers to the other nodes in the server cluster besides the generator end and the receiver end.
[0009] According to a cluster node communication method provided by the present invention, the step of determining a generator end, a task end, and a receiver end among the nodes of the server cluster based on the communication task instructions obtained by each node through the listening channel, and performing cluster node communication through the generator end, the task end, and the receiver end, includes:
[0010] If any node in the server cluster obtains the first target communication task instruction through the listening channel, the node that obtains the first target communication task instruction is determined as the first target generator end, and any node in the server cluster other than the first target generator end is determined as the target receiver end.
[0011] The first target communication task instruction is sent to multiple task processing terminals in the server cluster via the first target generator terminal.
[0012] The first target communication task instruction is executed by multiple task processing terminals to obtain the communication task instruction execution result, and the received communication task instruction execution result is saved by the target receiving terminal.
[0013] According to a cluster node communication method provided by the present invention, the step of determining the generator end, task end, and receiver end among the nodes of the server cluster based on the communication task instructions obtained by each node through the listening channel further includes:
[0014] If any node in the server cluster other than the first target generator receives a second target communication task instruction through the listening channel, the node that receives the second target communication task instruction is identified as the second target generator, and any node in the server cluster other than the second target generator is identified as the target receiver.
[0015] According to a cluster node communication method provided by the present invention, the step of establishing a listening channel among the nodes in a server cluster includes:
[0016] Obtain the IP address and port number information of each node in the server cluster;
[0017] Based on the IP address information and the port number information, construct the identifier socket for each node;
[0018] Based on the identifier socket, the listening channel between each node is constructed.
[0019] According to a cluster node communication method provided by the present invention, the method further includes:
[0020] Based on the IP address information and port number information of each node, construct the communication channel information between the nodes;
[0021] The step of sending the first target communication task instruction to multiple task processing terminals in the server cluster through the first target generator includes:
[0022] Determine the communication channel information between the first target generator and each of the task processing terminals;
[0023] The communication channel information is parsed to obtain the IP address information and port number information of each task processing terminal;
[0024] Based on the IP address information and port number information of each of the task processing terminals, the first target communication task instruction is sent to multiple task processing terminals through the first target generator terminal.
[0025] According to a cluster node communication method provided by the present invention, the step of sending the first target communication task instruction to multiple task processing terminals in the server cluster through the first target generator terminal includes:
[0026] The first target communication task instruction is encrypted to obtain the encrypted target communication task instruction.
[0027] The encrypted target communication task instruction is sent to multiple task processing terminals in the server cluster via the target generator.
[0028] After executing the first target communication task instruction through multiple task processing terminals to obtain the communication task instruction execution result, the method further includes:
[0029] The encryption process is applied to the execution result of the communication task instruction to obtain the encrypted execution result of the communication task instruction.
[0030] The encrypted communication task instruction execution result is sent to the target receiving end through each of the task processing terminals.
[0031] According to a cluster node communication method provided by the present invention, the step of sending the first target communication task instruction to multiple task processing terminals in the server cluster through the first target generator terminal further includes:
[0032] The first target communication task instruction is split into multiple sub-task instructions;
[0033] The first target generator sends the multiple subtask instructions evenly to multiple task processing terminals in the server cluster.
[0034] The present invention also provides a cluster node communication system, comprising:
[0035] The listening channel building module is used to build listening channels between various nodes in a server cluster based on identifier sockets;
[0036] The cluster communication module is used to determine the generator end, task processing end, and receiver end among the nodes of the server cluster based on the communication task instructions obtained by each node through the listening channel, and to conduct cluster node communication through the generator end, the task processing end, and the receiver end, wherein the task processing end refers to the other nodes in the server cluster besides the generator end and the receiver end.
[0037] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the cluster node communication method described above.
[0038] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the cluster node communication method as described above.
[0039] The cluster node communication method and system provided by the present invention establishes a listening channel between various nodes in a server cluster based on an identifier socket. After each node obtains its own communication task instructions through the listening channel, the generator end, task processing end, and receiver end are determined in the nodes of the server cluster to conduct cluster node communication, which reduces resource consumption and communication latency and increases the maximum load capacity of cluster communication. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0041] Figure 1 This is a flowchart illustrating the cluster node communication method provided by the present invention.
[0042] Figure 2 This is a schematic diagram of socket-based cluster communication provided by the present invention;
[0043] Figure 3 This is a schematic diagram of the structure of the cluster node communication system provided by the present invention;
[0044] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0046] In cluster communication, centralized cluster communication has good timeliness for updating and reading metadata. Once the metadata changes, it can be updated to the centralized storage immediately, and other nodes can quickly detect it when reading. However, in centralized cluster communication, all the metadata update pressure is concentrated on one node, which may lead to a large pressure on the metadata storage.
[0047] Gossip cluster communication distributes metadata updates rather than concentrating them on a single node. Update requests are sent to all nodes sequentially to complete the update, resulting in some latency. While this reduces storage pressure, it also causes delays in metadata updates and some lag in cluster operations.
[0048] This invention establishes a listening channel between cluster communication nodes based on sockets, constructing N:M communication between cluster nodes, that is, N cluster nodes listen to each other. When one cluster node receives a communication command, it sends the communication command to N-1 other cluster nodes. This is a series of interfaces similar to a socket. The difference from the existing socket is that the ordinary socket is end-to-end (i.e., a 1:1 relationship), while this invention uses an N:M relationship to enable multiple cluster nodes to send communication commands simultaneously. Here, a node can be a host device or a process.
[0049] Compared to centralized and Gossip cluster communication protocols, the N:M communication method based on Socket listening in this invention is more efficient in resource utilization. For example, redundant Gossip communication can put a heavy load on network bandwidth and CPU resources, and this load is limited by the communication frequency, which in turn affects the convergence speed of the algorithm. In contrast, Socket communication puts less load on the CPU than Gossip communication.
[0050] Figure 1 This is a flowchart illustrating the cluster node communication method provided by the present invention, as shown below. Figure 1 As shown, the present invention provides a cluster node communication method, including:
[0051] Step 101: Based on the identifier socket, establish a listening channel between the nodes in the server cluster.
[0052] In this invention, a socket, which is a unique identifier formed by combining a unique IP address and port number on the network, constitutes a uniquely identifiable identifier for each cluster node. In cluster communication, each node has a socket; network communication is essentially communication between sockets, with data transmitted between them via input / output (IO) streams. This invention uses sockets to implement cluster communication, which, compared to current centralized and Gossip-based cluster communication methods, offers a simpler algorithm structure, lower CPU load, and significantly improves the maximum utilization of the cluster.
[0053] Furthermore, in this invention, an identifier socket is used to construct the listening channel. First, each node creates a socket and binds it to a unique identifier, which can be a combination of an IP address and a port number, to uniquely identify each node. Nodes can use these identifiers to establish communication connections. Next, a node can wait for connection requests from other nodes using a listening socket. The listening socket is responsible for listening on a specific port; once a connection request arrives, the node can accept the connection and establish a communication channel.
[0054] When other nodes want to establish a connection with a target node, they can initiate a connection request using socket client mode. The connection request includes the target node's identifier, namely its IP address and port number. Upon receiving the connection request, the target node can accept the connection and establish a communication channel. In this way, the nodes in the cluster can communicate with each other. Nodes can send and receive data by reading and writing to sockets, and the listening channel can support connections between multiple nodes simultaneously, achieving concurrent communication capabilities.
[0055] Step 102: Based on the communication task instructions obtained by each node through the listening channel, determine the generator end, task processing end, and receiver end among the nodes of the server cluster, and conduct cluster node communication through the generator end, the task processing end, and the receiver end, wherein the task processing end refers to other nodes in the server cluster other than the generator end and the receiver end.
[0056] In this invention, each node can obtain communication task instructions through the aforementioned listening channel. These instructions contain the specific tasks that need to be performed in the cluster. When a node in the cluster obtains a communication task instruction through the listening channel, the node in the cluster is divided into three key components according to its function: the generator end, the task processing end, and the receiver end.
[0057] Figure 2This is a schematic diagram of socket-based cluster communication provided by the present invention, which can be referred to. Figure 2 As shown, the generator (taskvent) is responsible for generating or providing the task data that needs to be processed. It can obtain data from external data sources according to instructions, or generate simulated data according to algorithms, and send the generated task data to the task processing end.
[0058] The taskwork receives task data from the generator and executes corresponding processing logic according to the instructions. This includes data analysis, calculation, transformation, or other operations. After completing the task, the taskwork sends the processing result to the receiver.
[0059] The task sink is responsible for receiving the processing results from the task processor and performing corresponding processing, such as decryption, storage, and sending to other nodes. The task sink may return the results to the node that issued the task instruction, or pass the results to other nodes as needed.
[0060] Through the collaborative work of the generator, task processor, and receiver, nodes in the cluster can communicate and exchange data. This communication method between cluster nodes supports distributed computing and collaboration, enabling the cluster to process tasks in parallel and improving the overall processing capacity and efficiency of the server cluster. Nodes obtain task instructions through listening channels and identify the generator, task processor, and receiver from the nodes in the cluster, thereby exchanging information and collaborating to achieve communication and task processing functions between cluster nodes.
[0061] The cluster node communication method provided by this invention establishes a listening channel between various nodes in a server cluster based on identifier sockets. After each node obtains its own communication task instructions through the listening channel, the generator end, task processing end, and receiver end are determined in the nodes of the server cluster to conduct cluster node communication, which reduces resource consumption and communication latency and increases the maximum load capacity of cluster communication.
[0062] Based on the above embodiments, the step of determining the generator end, task end, and receiver end among the nodes of the server cluster based on the communication task instructions obtained by each node through the listening channel, and performing cluster node communication through the generator end, the task end, and the receiver end, includes:
[0063] If any node in the server cluster obtains the first target communication task instruction through the listening channel, the node that obtains the first target communication task instruction is determined as the first target generator end, and any node in the server cluster other than the first target generator end is determined as the target receiver end.
[0064] The first target communication task instruction is sent to multiple task processing terminals in the server cluster via the first target generator terminal.
[0065] The first target communication task instruction is executed by multiple task processing terminals to obtain the communication task instruction execution result, and the received communication task instruction execution result is saved by the target receiving terminal.
[0066] In this invention, if any node in the cluster obtains a communication instruction (i.e., a first target communication task instruction) through a listening channel, that node will be designated as the first target generator. Simultaneously, any node in the cluster other than the first target generator will be designated as the target receiver. First, the first target generator is responsible for sending the first target communication task instruction to multiple task processing ends in the cluster. This communication task instruction is broadcast to other nodes (i.e., task processing ends) in the cluster through the communication channel, ensuring that multiple task processing ends can obtain the first target communication task instruction.
[0067] Furthermore, the first target communication task instruction is executed in multiple task processing terminals. Each task processing terminal performs corresponding calculations, processing, or transformation operations according to the requirements of the instruction. These task processing terminals execute tasks in parallel, thereby improving the processing efficiency of the cluster. After the task processing terminals complete the execution of the instruction, they send the execution result of the communication task instruction to the target receiver for storage. In this way, the first target communication task instruction can achieve distributed computing and collaborative work in the server cluster. The generator is responsible for sending the instruction to multiple task processing terminals, which execute the instruction in parallel and generate results. Finally, the target receiver saves the execution result, which can improve the processing capacity and efficiency of the cluster and is suitable for scenarios such as large-scale data processing and parallel computing.
[0068] Based on the above embodiments, the step of determining the generator end, task end, and receiver end among the nodes of the server cluster based on the communication task instructions obtained by each node through the listening channel further includes:
[0069] If any node in the server cluster other than the first target generator receives a second target communication task instruction through the listening channel, the node that receives the second target communication task instruction is identified as the second target generator, and any node in the server cluster other than the second target generator is identified as the target receiver.
[0070] In this invention, if any node in the cluster, other than the first target generator, also receives the communication task instruction (i.e., the second target communication task instruction) through its own listening channel, then that node will be identified as the second target generator. Simultaneously, any node in the cluster, other than the second target generator, will also be identified as the target receiver. In this invention, each node in the cluster can act as a generator, a task processor, and a receiver, meaning that any node can potentially receive task instructions, perform processing operations, and send the results to other nodes for storage. In this way, this invention allows the cluster to allocate and process tasks more flexibly, fully utilize cluster resources, and improve efficiency and performance.
[0071] Based on the above embodiments, the step of establishing a listening channel between the nodes in the server cluster includes:
[0072] Obtain the IP address and port number information of each node in the server cluster;
[0073] Based on the IP address information and the port number information, construct the identifier socket for each node;
[0074] Based on the identifier socket, the listening channel between each node is constructed.
[0075] In this invention, the first step is to obtain the unique identifier of each node on the network, namely its IP address. Simultaneously, each node needs to be assigned a unique port number so that other nodes can communicate with it through that port. Further, based on the obtained IP address and port number information, an identifier socket object is created. This socket will act as the interface for the node to communicate with other nodes. The identifier socket contains the node's unique identifier information to ensure that the node can be accurately located and identified in the network.
[0076] In this invention, by using identifier sockets, listening channels can be established between nodes. These channels allow bidirectional data transmission and communication between nodes. Each node can listen to its bound port to receive messages and requests from other nodes and respond accordingly. Through these listening channels, nodes can exchange information, share resources, and coordinate tasks in real time, achieving efficient transmission of data and instructions.
[0077] Based on the above embodiments, the method further includes:
[0078] Based on the IP address information and port number information of each node, construct the communication channel information between the nodes;
[0079] The step of sending the first target communication task instruction to multiple task processing terminals in the server cluster through the first target generator includes:
[0080] Determine the communication channel information between the first target generator and each of the task processing terminals;
[0081] The communication channel information is parsed to obtain the IP address information and port number information of each task processing terminal;
[0082] Based on the IP address information and port number information of each of the task processing terminals, the first target communication task instruction is sent to multiple task processing terminals through the first target generator terminal.
[0083] In this invention, the IP address and port number of each node are first obtained; then, this information is used to construct communication channels between the nodes, ensuring effective data transmission and interaction between them. These communication channels can be network protocol-based connections, such as TCP / IP, to achieve reliable communication.
[0084] Furthermore, the first target generator needs to determine the communication channel information between itself and each task processing end to ensure that it can establish a connection and communicate with them. By parsing the communication channel information, the first target generator can quickly obtain the IP address and port number information of each task processing end, thereby accurately locating each task processing end and ensuring that the instructions can be correctly sent to their location, thus realizing the distribution and execution of tasks.
[0085] Based on the above embodiments, the step of sending the first target communication task instruction to multiple task processing terminals in the server cluster through the first target generator includes:
[0086] The first target communication task instruction is encrypted to obtain the encrypted target communication task instruction.
[0087] The encrypted target communication task instruction is sent to multiple task processing terminals in the server cluster via the first target generator.
[0088] After executing the first target communication task instruction through multiple task processing terminals to obtain the communication task instruction execution result, the method further includes:
[0089] The encryption process is applied to the execution result of the communication task instruction to obtain the encrypted execution result of the communication task instruction.
[0090] The encrypted communication task instruction execution result is sent to the target receiving end through each of the task processing terminals.
[0091] In this invention, the first target communication task instruction is encrypted to ensure the security and confidentiality of the instruction content and prevent unauthorized access and tampering. This invention uses an appropriate encryption algorithm and key to convert the communication task instruction into an encrypted form; specifically, it employs Base64 encryption.
[0092] Furthermore, the encrypted target communication task instruction is sent from the first target generator to multiple task processing ends in the cluster. Through network communication or other appropriate data transmission mechanisms, it is ensured that the instruction is accurately delivered to each task processing end. Each task processing end first decrypts the encrypted target communication task instruction, then performs the corresponding task processing, and re-encrypts the result after processing. Finally, using each task processing end as a sender, the execution result of the encrypted communication task instruction is sent to the target receiver. Through this process, the encryption of the first target communication task instruction and its execution result is achieved, ensuring secure transmission from the task processing end to the target receiver. This protects the confidentiality of the instruction and execution result, preventing unauthorized access and tampering.
[0093] Based on the above embodiments, the step of sending the first target communication task instruction to multiple task processing terminals in the server cluster via the first target generator terminal further includes:
[0094] The first target communication task instruction is split into multiple sub-task instructions;
[0095] The first target generator sends the multiple subtask instructions evenly to multiple task processing terminals in the server cluster.
[0096] In this invention, the first target communication task instruction is split into multiple sub-task instructions (or the generator receives multiple communication task instructions). Specifically, firstly, the first target communication task instruction is split into multiple sub-task instructions, which can be done according to a specific task splitting strategy, such as dividing by time or by data range.
[0097] Then, the first target generator evenly sends multiple subtask instructions to multiple task processing ends in the cluster, ensuring that each task processing end receives the corresponding number of subtask instructions. This allocation process can achieve even distribution of subtask instructions through algorithms such as round-robin and load balancing. During the sending process, it is essential to ensure that multiple subtask instructions are evenly distributed among the multiple task processing ends in the cluster to avoid uneven task load. Task processing ends that fail to receive subtask instructions are resent or otherwise processed to improve the parallelism and efficiency of task execution and fully utilize the computing resources of the server cluster.
[0098] In one embodiment, a plugin can also be constructed based on the cluster node communication method provided by this invention. A listening thread is created on the cluster node where the plugin is installed. This thread listens for incoming signals and generates commands on the cluster node that can perform specified actions. When other nodes in the cluster or other clusters use the plugin together, an "M×N" effect can be achieved. That is, when N cluster nodes use the plugin together, one node simultaneously sends instructions to the other N-1 nodes. The instructions require input of the operation to be performed and the target to be transmitted. If m cluster nodes send instructions simultaneously, an "M×N" communication effect can be achieved. This plugin solves the command blocking problem when the same node sends instructions to multiple other nodes simultaneously, reduces time consumption costs and CPU load pressure, optimizes cluster communication performance, and can reduce the steps of sending public keys and direct login, thus reducing time consumption.
[0099] In this invention, the cluster nodes serve as both generators and receivers. Nodes other than the generators and receivers act as task processing ends. The generator sends a series of operations to be executed to each task processing end, and after completing the instructions, returns the execution results to the receiver. Before sending operations, the generator must establish a communication connection with the task processing ends in the cluster. This is achieved by the plugin activating the corresponding communication function after installation. When activating the communication function, the IP address and port must be provided to the plugin to provide a listening channel. After the listening channel is created, instructions can be sent to the listening server (i.e., the generator) through the listening channel.
[0100] In this invention, a communication channel name can be created between the generator and the task processing end. This channel name can store the communication IP and port between the generator and the task processing end. Further, when a cluster node (i.e., the generator) prepares to send an action interaction command (such as a query or modification command) to another node (i.e., the task processing end), it first resolves the IP and port using the channel name, then establishes a communication mechanism with the corresponding task processing end's port. After the mechanism is established, the operation to be executed is packaged, encrypted, and transmitted using Base64 encoding. The command information is decrypted after the operation command is sent to the task processing end. In this invention, the command information in the communication task serves as a key, which corresponds to the command stored locally in the node's own dictionary. After executing the issued command, the task processing end encrypts the processing result and its corresponding return value again using Base64 encoding and sends it to the target receiving end. After receiving the information (i.e., the communication task command execution result), the target receiving end decrypts the information and collects and stores the result along with the interaction command, communication server-related information (such as receiver information and task processing end information), and time information.
[0101] In this invention, the generator can send instructions to multiple task processing terminals simultaneously based on the plugin. The feasibility of communication is ensured by starting multiple threads. If the same task processing terminal executes multiple commands, the commands need to be executed sequentially according to the order of acquisition.
[0102] In this invention, when the number of devices in the cluster is small and the amount of communication between them is not large, there is no need to add extra programs to increase communication. When the amount of communication between the cluster increases, even exceeding the normal load, the communication between the cluster will generate high load, congestion and other situations. At this time, by installing a Socket-based listening plugin, the fixed operation process can be handled, thereby alleviating the congestion and increasing the maximum load of cluster communication.
[0103] The cluster node communication system provided by the present invention is described below. The cluster node communication system described below can be referred to in correspondence with the cluster node communication method described above.
[0104] Figure 3 This is a schematic diagram of the structure of the cluster node communication system provided by the present invention, as shown below. Figure 3As shown, the present invention provides a cluster node communication system, including a listening channel construction module 301 and a cluster communication module 302. The listening channel construction module 301 is used to construct a listening channel between various nodes in a server cluster based on an identifier socket. The cluster communication module 302 is used to determine a generator end, a task processing end, and a receiver end among the nodes in the server cluster based on the communication task instructions obtained by each node through the listening channel, and to perform cluster node communication through the generator end, the task processing end, and the receiver end. The task processing end represents other nodes in the server cluster besides the generator end and the receiver end.
[0105] In this invention, the listening channel construction module 301 uses a Socket, which is a unique identifier socket formed by combining a unique IP address and port number on the network. In cluster communication, each node has a Socket; network communication is essentially communication between Sockets, with data transmitted between them via I / O streams. This invention uses Sockets to implement cluster communication, which, compared to current centralized and Gossip-based cluster communication methods, has a simpler algorithm structure, lower CPU load, and significantly improves the maximum utilization of the cluster.
[0106] Furthermore, in this invention, the listening channel construction module 301 uses an identifier socket to construct the listening channel. First, each node creates a socket and binds it to a unique identifier, which can be a combination of an IP address and a port number, to uniquely identify each node. Nodes can use these identifiers to establish communication connections. Next, a node can wait for connection requests from other nodes through a listening socket. The listening socket is responsible for listening on a specific port; once a connection request arrives, the node can accept the connection and establish a communication channel.
[0107] When other nodes want to establish a connection with a target node, they can initiate a connection request using socket client mode. The connection request includes the target node's identifier, namely its IP address and port number. Upon receiving the connection request, the target node can accept the connection and establish a communication channel. In this way, the nodes in the cluster can communicate with each other. Nodes can send and receive data by reading and writing to sockets, and the listening channel can support connections between multiple nodes simultaneously, achieving concurrent communication capabilities.
[0108] Furthermore, in this invention, through the aforementioned listening channel, each node can obtain communication task instructions. These instructions contain the specific tasks that need to be performed in the cluster. When a node in the cluster obtains a communication task instruction through the listening channel, the cluster communication module 302 divides the nodes in the cluster into three key components according to their functions: a generator end, a task processing end, and a receiver end. Then, through the collaborative work of the generator end, task processing end, and receiver end, communication and data interaction are achieved. This communication method between cluster nodes can support distributed computing and collaboration, enabling the cluster to process tasks in parallel, improving the processing capacity and efficiency of the entire server cluster. Nodes obtain task instructions through the listening channel and determine the generator end, task processing end, and receiver end from the nodes in the cluster, thereby exchanging information and collaborating, realizing the communication and task processing functions between cluster nodes.
[0109] The cluster node communication system provided by this invention establishes a listening channel between various nodes in a server cluster based on identifier sockets. After each node obtains its own communication task instructions through the listening channel, the generator end, task processing end, and receiver end are determined in the nodes of the server cluster to conduct cluster node communication, which reduces resource consumption and communication latency, thereby increasing the maximum load capacity of cluster communication.
[0110] The system provided by this invention is used to execute the above-described method embodiments. For specific processes and details, please refer to the above embodiments, which will not be repeated here.
[0111] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 4 As shown, the electronic device may include: a processor 401, a communications interface 402, a memory 403, and a communication bus 404, wherein the processor 401, communications interface 402, and memory 403 communicate with each other via the communication bus 404. The processor 401 can call logical instructions in the memory 403 to execute a cluster node communication method. This method includes: establishing a listening channel between nodes in the server cluster based on identifier sockets; determining a generator end, a task processing end, and a receiver end among the nodes in the server cluster based on communication task instructions obtained by each node through the listening channel; and performing cluster node communication through the generator end, the task processing end, and the receiver end, wherein the task processing end represents other nodes in the server cluster besides the generator end and the receiver end.
[0112] Furthermore, the logical instructions in the aforementioned memory 403 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0113] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the cluster node communication method provided by the above methods, the method comprising: constructing a listening channel between nodes in a server cluster according to an identifier socket; determining a generator end, a task processing end, and a receiver end among the nodes in the server cluster based on communication task instructions obtained by each node through the listening channel, and performing cluster node communication through the generator end, the task processing end, and the receiver end, wherein the task processing end represents other nodes in the server cluster besides the generator end and the receiver end.
[0114] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the cluster node communication method provided in the above embodiments. The method includes: constructing a listening channel among the nodes in a server cluster based on an identifier socket; determining a generator end, a task processing end, and a receiver end among the nodes in the server cluster based on communication task instructions obtained by each node through the listening channel, and performing cluster node communication through the generator end, the task processing end, and the receiver end, wherein the task processing end represents other nodes in the server cluster besides the generator end and the receiver end.
[0115] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0116] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A cluster node communication method, characterized in that, include: Based on the identifier socket, a listening channel is built between the nodes in the server cluster; Based on the communication task instructions obtained by each node through the listening channel, a generator end, a task processing end, and a receiver end are determined in the nodes of the server cluster, and cluster node communication is carried out through the generator end, the task processing end, and the receiver end. The task processing end refers to other nodes in the server cluster other than the generator end and the receiver end. The process of determining the generator, task, and receiver ends among the nodes of the server cluster based on the communication task instructions obtained by each node through the listening channel, and conducting cluster node communication through the generator, task, and receiver ends, includes: If any node in the server cluster obtains the first target communication task instruction through the listening channel, the node that obtains the first target communication task instruction is determined as the first target generator end, and any node in the server cluster other than the first target generator end is determined as the target receiver end. The first target communication task instruction is sent to multiple task processing terminals in the server cluster via the first target generator terminal. The first target communication task instruction is executed by multiple task processing terminals to obtain the communication task instruction execution result, and the received communication task instruction execution result is saved by the target receiver terminal.
2. The cluster node communication method according to claim 1, characterized in that, The step of determining the generator, task, and receiver ends among the nodes of the server cluster based on the communication task instructions obtained by each node through the listening channel also includes: If any node in the server cluster other than the first target generator receives a second target communication task instruction through the listening channel, the node that receives the second target communication task instruction is identified as the second target generator, and any node in the server cluster other than the second target generator is identified as the target receiver.
3. The cluster node communication method according to claim 1, characterized in that, The process of establishing listening channels between the nodes of the server cluster includes: Obtain the IP address and port number information of each node in the server cluster; Based on the IP address information and the port number information, construct the identifier socket for each node; Based on the identifier socket, the listening channel between each node is constructed.
4. The cluster node communication method according to claim 3, characterized in that, The method further includes: Based on the IP address information and port number information of each node, construct the communication channel information between the nodes; The step of sending the first target communication task instruction to multiple task processing terminals in the server cluster through the first target generator includes: Determine the communication channel information between the first target generator and each of the task processing terminals; The communication channel information is parsed to obtain the IP address information and port number information of each task processing terminal; Based on the IP address information and port number information of each of the task processing terminals, the first target communication task instruction is sent to multiple task processing terminals through the first target generator terminal.
5. The cluster node communication method according to claim 1 or 4, characterized in that, The step of sending the first target communication task instruction to multiple task processing terminals in the server cluster through the first target generator includes: The first target communication task instruction is encrypted to obtain the encrypted target communication task instruction. The encrypted target communication task instruction is sent to multiple task processing terminals in the server cluster via the first target generator. After executing the first target communication task instruction through multiple task processing terminals to obtain the communication task instruction execution result, the method further includes: The encryption process is applied to the execution result of the communication task instruction to obtain the encrypted execution result of the communication task instruction. The encrypted communication task instruction execution results are sent to the target receiver through each of the task processing terminals.
6. The cluster node communication method according to claim 1, characterized in that, The step of sending the first target communication task instruction to multiple task processing terminals in the server cluster via the first target generator terminal further includes: The first target communication task instruction is split into multiple sub-task instructions; The first target generator sends the multiple subtask instructions evenly to multiple task processing terminals in the server cluster.
7. A cluster node communication system, characterized in that, include: The listening channel building module is used to build listening channels between various nodes in a server cluster based on identifier sockets; The cluster communication module is used to determine the generator end, task processing end, and receiver end among the nodes of the server cluster based on the communication task instructions obtained by each node through the listening channel, and to conduct cluster node communication through the generator end, the task processing end, and the receiver end, wherein the task processing end refers to other nodes in the server cluster other than the generator end and the receiver end. The cluster communication module is specifically used for: If any node in the server cluster obtains the first target communication task instruction through the listening channel, the node that obtains the first target communication task instruction is determined as the first target generator end, and any node in the server cluster other than the first target generator end is determined as the target receiver end. The first target communication task instruction is sent to multiple task processing terminals in the server cluster via the first target generator terminal. The first target communication task instruction is executed by multiple task processing terminals to obtain the communication task instruction execution result, and the received communication task instruction execution result is saved by the target receiver terminal.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the cluster node communication method as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the cluster node communication method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Server node, local area network server cluster and realizing method thereof
CN105897827A
Synchronization communication method and system for computer cluster system
CN107147663A