Communication method and device
By selecting the bond port or physical port as the network port for sending and receiving messages during storage node initialization and recording the MAC address mapping relationship, the storage node communication problem without IP parameters is solved and low-cost network communication is achieved.
Patent Information
- Application Number
- CN202411320779.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-09-20
AI Technical Summary
If the IP parameters of the storage node are not configured, network communication and interaction between the various software cannot be carried out, resulting in increased operation and maintenance costs and management risks.
By obtaining the information of each network port during storage node initialization and selecting the enabled bond port or physical port as the network port for sending and receiving messages, the master node broadcasts the detection message and records the MAC address mapping relationship to achieve Layer 2 Ethernet link layer communication.
It enables communication and interaction between storage nodes without configuring IP parameters, reducing operation and maintenance costs and management risks.
Smart Images

Figure CN119052172B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to a communication method and device. Background Art
[0002] Network configuration and management are crucial and fundamental functions in storage installation and deployment plans and strategies. However, due to the lack of IP addresses configured for each server, communication between software components at the network IP layer is impossible. Therefore, manual IP configuration of each server or the use of an external DHCP server is required for access. However, both manual IP configuration and external DHCP server deployment increase operational costs and management risks.
[0003] Therefore, how to achieve communication and interaction between storage nodes without configuring IP parameters becomes a technical problem that needs to be solved urgently. Summary of the Invention
[0004] The present invention provides a communication method and device to solve the problem in the prior art that storage nodes cannot communicate and interact when IP parameters are not configured.
[0005] According to a first aspect of an embodiment of the present invention, there is provided a communication method, applied to a storage node, the method comprising:
[0006] During the initialization operation of the storage node, obtaining the network port information of each network port of the node;
[0007] Based on the network port information of each network port of the current node, select a target network port in the enabled state from the network ports of the current node as the network port for sending and receiving messages; wherein the target network port is an aggregate bond port or a physical port;
[0008] In the case where the storage node is the master node, a detection message is broadcast through the target network port, so that when the storage node as a slave node receives the detection message through the determined transceiver network port, it records the mapping relationship between the source MAC address of the detection message and the MAC address of the transceiver network port determined by the slave node, and returns a response message to the master node through the transceiver network port determined by the slave node; wherein the source MAC address of the detection message is the MAC address of the target network port; the source MAC address of the response message is the MAC address of the transceiver network port determined by the slave node, and the destination MAC address of the response message is the MAC address of the target network port;
[0009] When the storage node is the master node and receives a response message sent by a remote storage node through the target network port, the mapping relationship between the MAC address of the target network port and the source MAC address of the response message is recorded, and based on the recorded mapping relationship, the second layer Ethernet link layer communication is performed with the remote storage node.
[0010] According to a first aspect of an embodiment of the present invention, there is provided a communication device, which is deployed on a storage node, and includes:
[0011] An acquiring unit, configured to acquire network port information of each network port of the node during the initialization operation of the storage node;
[0012] A selection unit is configured to select a target network port in an enabled state from the network ports of the node as a message sending and receiving network port based on the network port information of each network port of the node; wherein the target network port is an aggregate bond port or a physical port;
[0013] A communication unit, configured to, when the storage node is a master node, broadcast a detection message through the target network port, so that when the storage node, as a slave node, receives the detection message through the determined message-transmitting and receiving network port, it records the mapping relationship between the source MAC address of the detection message and the MAC address of the message-transmitting and receiving network port determined by the slave node, and returns a response message to the master node through the message-transmitting and receiving network port determined by the slave node; wherein, the source MAC address of the detection message is the MAC address of the target network port; the source MAC address of the response message is the MAC address of the message-transmitting and receiving network port determined by the slave node, and the destination MAC address of the response message is the MAC address of the target network port;
[0014] a recording unit, configured to record a mapping relationship between the MAC address of the target network port and the source MAC address of the response message when the storage node is a master node and the communication unit receives a response message sent by the remote storage node through the target network port;
[0015] The communication unit is further configured to perform Layer 2 Ethernet link layer communication with the remote storage node based on the recorded mapping relationship.
[0016] By applying the technical solution disclosed in the present invention, the storage node obtains the network port information of each network port of the node during the initialization operation process, and selects an enabled bond port or physical port from the network ports of the node as the message sending and receiving network port based on the network port information of each network port of the node. When the storage node is the master node, the detection message can be broadcast through the target network port, so that the storage node as the slave node records the influence relationship between the source MAC address of the detection message and the MAC address of the message sending and receiving network port determined by the slave node when receiving the detection message through the determined message sending and receiving network port, and returns a response message to the master node through the message sending and receiving network port determined by the slave node. Furthermore, when the storage node as the master node receives the response message sent by the remote storage node through the target network port, the storage node records the mapping relationship between the MAC address of the target network port and the source MAC address of the response message, and performs Layer 2 Ethernet link layer communication with the remote storage node based on the recorded mapping relationship, thereby realizing communication interaction between storage nodes without configuring IP parameters. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a flow chart of a communication method provided by an embodiment of the present invention;
[0018] Figure 2 This is a schematic diagram of the structure of SCE software provided by an embodiment of the present invention;
[0019] Figure 3 This is a schematic diagram of a flow chart of selecting a network port for sending and receiving messages provided by an embodiment of the present invention;
[0020] Figure 4 This is a schematic diagram of an Ethernet message frame format provided by an embodiment of the present invention;
[0021] Figure 5 This is a flow chart of an Ethernet message distribution process provided by an embodiment of the present invention;
[0022] Figure 6 This is a logical diagram of switching of a network port for sending and receiving messages provided by an embodiment of the present invention;
[0023] Figure 7 It is a structural diagram of a communication device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention and to make the above-mentioned purposes, features and advantages of the embodiments of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention are further described in detail below with reference to the accompanying drawings.
[0025] See Figure 1, is a flow chart of a communication method provided by an embodiment of the present invention, wherein the communication method can be applied to a storage node. Figure 1 As shown, the communication method may include the following steps:
[0026] Step 101: During the initialization process of the storage node, obtain the network port information of each network port of the node.
[0027] Step 102: Based on the network port information of each network port of the node, select a target network port in an enabled state from the network ports of the node as a message sending and receiving network port; wherein the target network port is a bond port or a physical port.
[0028] In an embodiment of the present invention, in order to realize communication interaction of storage nodes without configuring IP parameters, the storage node can select a specific network port from the network port of the node as the message sending and receiving network port (which can be called the management port), and based on the selected message sending and receiving network port, realize communication interaction between storage nodes at the second-layer Ethernet link layer.
[0029] In one example, in order to realize the selection of the network port for sending and receiving messages and the communication interaction based on the network port for sending and receiving messages, SCE (Storage Scan Engine) software can be run in the storage node, and the selection of the network port for sending and receiving messages and the communication interaction based on the network port for sending and receiving messages can be realized through the SCE software.
[0030] For example, the SCE software can be integrated into a self-developed storage image, installed on a storage node as an independent component following the image, and can run as a daemon process.
[0031] In the embodiment of the present invention, during the initialization operation of the storage node, the network port information of each network port of the node may be obtained.
[0032] For example, when the SCE software is initialized, it can actively obtain the network port information of each network port of the storage node.
[0033] For example, the network port information may include but is not limited to the network port status, the network port MAC address, the current attributes of the network port, and the current rate of the network port.
[0034] The network port status may include an enabled (UP) state or a disabled (DOWN) state.
[0035] The current attributes of a network port may include a bond (aggregation) port, a bond slave (aggregation member port), a VLAN (Virtual Local Area Network) port, or a physical port.
[0036] In the embodiment of the present invention, the storage node may select a target network port in the UP state from the network ports of the node as the network port for sending and receiving messages based on the information of each network port of the node.
[0037] Since bond slave or VLAN ports are not usually used for Layer 2 packet transmission and reception, the target network port must be a network port other than a bond slave or VLAN port. For example, the target network port can be a bond port or a physical port.
[0038] Step 103. When the storage node is the master node, a detection message is broadcast through the target network port, so that when the storage node as a slave node receives the detection message through the determined transceiver network port, it records the mapping relationship between the source MAC address of the detection message and the MAC address of the transceiver network port determined by the slave node, and returns a response message to the master node through the transceiver network port determined by the slave node; wherein, the source MAC address of the detection message is the MAC address of the target network port; the source MAC address of the response message is the MAC address of the transceiver network port determined by the slave node, and the destination MAC address of the response message is the MAC address of the target network port.
[0039] In the embodiment of the present invention, for the storage node serving as the master node, when the target network port is determined in the above manner, a detection message may be broadcast through the target network port.
[0040] For a storage node serving as a slave node, when the network port for sending and receiving messages is determined in the above manner, the determined network port for sending and receiving messages can be monitored to determine whether a message sent by the master node is received.
[0041] When a storage node serving as a slave node receives a detection message broadcast by a master node through a determined network port for transmitting and receiving messages, on the one hand, it can obtain the source MAC address of the detection message (i.e., the MAC address of the target network port of the master node) and record the mapping relationship between the source MAC address of the detection message and the MAC address of the network port for transmitting and receiving messages determined by the slave node. On the other hand, it can construct a response message using the MAC address of the network port for transmitting and receiving messages determined by the slave node as the source MAC address and the MAC address of the target network port as the destination MAC address, and return the response message to the master node through the determined network port for transmitting and receiving messages.
[0042] Step 104: When the storage node is the master node and receives a response message sent by the remote storage node through the target network port, the mapping relationship between the MAC address of the target network port and the source MAC address of the response message is recorded, and Layer 2 Ethernet link layer communication is performed with the remote storage node based on the recorded mapping relationship.
[0043] In an embodiment of the present invention, when the storage node serving as the master node receives a response message sent by a remote storage node through a target network port, the storage node can obtain the source MAC address of the response message (i.e., the MAC address of the network port for sending and receiving messages determined by the remote storage node), and record the mapping relationship between the MAC address of the target network port and the source MAC address of the response message. Furthermore, based on the recorded mapping relationship, the storage node can perform Layer 2 Ethernet link layer communication with the remote storage node, thereby realizing communication interaction without IP parameters.
[0044] It can be seen that in Figure 1 In the method flow shown, the storage node obtains the network port information of each network port of the node during the initialization operation process, and selects an enabled bond port or physical port from the network ports of the node as the message sending and receiving network port based on the network port information of each network port of the node. When the storage node is the master node, the detection message can be broadcast through the target network port, so that the storage node as the slave node records the influence relationship between the source MAC address of the detection message and the MAC address of the message sending and receiving network port determined by the slave node when receiving the detection message through the determined message sending and receiving network port, and returns a response message to the master node through the message sending and receiving network port determined by the slave node. Furthermore, when the storage node as the master node receives the response message sent by the remote storage node through the target network port, it records the mapping relationship between the MAC address of the target network port and the source MAC address of the response message, and communicates with the remote storage node on the second layer Ethernet link layer based on the recorded mapping relationship, thereby realizing communication interaction between storage nodes without configuring IP parameters.
[0045] In some embodiments, the network port information includes the network port status, the network port MAC address, the current attributes of the network port, and the current rate of the network port; the network port status includes the enabled state or the disabled state; the current attributes of the network port include the bond port, the bond slave port, the VLAN port, or the physical port;
[0046] The target network port is the bond port or physical port with the lowest current network rate.
[0047] For example, in order to reduce the impact of communication interactions between storage nodes on the normal services of the storage nodes, when selecting a network port for sending and receiving messages, a bond port or physical port in UP state with the lowest current rate can be selected as the target network port.
[0048] In some embodiments, the above-mentioned selecting, based on the network port information of each network port of the local node, a target network port in an enabled state from the network ports of the local node as the network port for sending and receiving messages includes:
[0049] Traverse all network ports of this node;
[0050] For the currently traversed network port, if the network port is in the DOWN state, or the network port is a bond slave port or a VLAN port, traverse to the next network port; otherwise, compare the current network port rate with the current minimum rate; the initial value of the minimum rate is infinity;
[0051] If the current rate of the network port is less than the current minimum rate, the current rate of the network port is used as the latest current minimum rate, the corresponding MAC address is recorded, and the next network port is traversed; if the current rate of the network port is greater than the current minimum rate, the next network port is traversed; if the current rate of the network port is equal to the current minimum rate, based on the MAC address of the network port and the MAC address corresponding to the current minimum rate, it is determined whether the MAC address corresponding to the current minimum rate needs to be updated;
[0052] If it is determined that the MAC address corresponding to the current lowest speed does not need to be updated, traverse the next network port; if it is determined that the MAC address corresponding to the current lowest speed needs to be updated, use the MAC address of the network port as the latest MAC address corresponding to the current lowest speed;
[0053] When the network port traversal is completed, the corresponding network port is determined as the target network port based on the MAC address corresponding to the recorded current lowest rate.
[0054] For example, for a storage node, a network port that is in UP state and has an attribute other than a bond slave port or a VLAN port can be determined based on the network port status and current attributes of each network port of the storage node.
[0055] For network ports that are in the Up state and are not bond slave ports or VLAN ports, the network port with the lowest current rate can be determined based on the current rate of the network ports. If there are multiple network ports with the lowest current rate, the network ports are sorted by their MAC addresses and the target network port is determined based on the sorting results.
[0056] For example, among the multiple network ports with the lowest current speed, the network port with the smallest MAC address or the network port with the largest MAC address can be selected as the target network port.
[0057] For example, the network port with the smallest MAC address among the network ports with the lowest current speed is selected as the target network port.
[0058] The determining whether the MAC address corresponding to the current lowest speed needs to be updated based on the MAC address of the network port and the MAC address corresponding to the current lowest speed may include:
[0059] If the MAC address of the network port is less than the MAC address corresponding to the current lowest speed, it is determined that the MAC address corresponding to the current lowest speed needs to be updated;
[0060] Otherwise, it is determined that there is no need to update the MAC address corresponding to the current lowest rate.
[0061] In some embodiments, after selecting the target network port in the enabled state from the network ports of the node as the network port for sending and receiving messages based on the network port information of each network port of the node, the method further includes:
[0062] Regularly detecting the target network port;
[0063] If the target network port is in the DOWN state, or the current attribute of the target network port is a bond slave port, or the current attribute of the target network port is a bond port and IFINDEX changes, a new target network port is selected as the network port for sending and receiving messages.
[0064] For example, if the network port status switches to DOWN or the network port is managed by a bond slave, Ethernet packets cannot be transmitted. In addition, if the IFINDEX (Interface Index Port Sequence Number) of the network port changes, socket communication needs to be re-established.
[0065] Therefore, when the target network port is determined in the above manner, the determined target network port may be detected periodically to detect the network port status and current attributes of the target network port.
[0066] If the target network port is in DOWN state, or the current attribute of the target network port is a bond slave port, or the current attribute of the target network port is a bond port and IFINDEX changes, you need to select a new target network port as the network port for sending and receiving messages.
[0067] Exemplarily, resources of the original target network port may be released, and when a new target network port is determined, resources may be applied for the new target network port, and the new target network port may be used as the network port for sending and receiving messages.
[0068] For example, the specific implementation process of selecting a new target network port can refer to the processing process of selecting a target network port in the above embodiment, which will not be repeated here in the embodiment of the present invention.
[0069] In one example, after selecting a new target network port as the network port for sending and receiving messages, the method further includes:
[0070] The MAC address of the target network port recorded by the local node is updated, and based on the MAC address of the remote storage node recorded by the local node, the updated MAC address of the target network port is sent to the remote storage node through the new target network port.
[0071] Exemplarily, for a storage node that serves as a master node, when the target network port is updated in the above manner, the MAC address of the target network port recorded by this node can be updated, and based on the MAC address of the remote storage node recorded by this node, the updated MAC address of the target network port can be sent to the remote storage node through the new target network port, so that the remote storage node can update the recorded MAC address of the target network port of the master node.
[0072] It should be noted that, in an embodiment of the present invention, the update of the above-mentioned target network port can also be applied to the storage node acting as a slave node. When the storage node acting as a slave node updates the target network port in the above-mentioned manner, the updated MAC address of the target network port can be sent to the master node. The specific implementation thereof will not be elaborated here.
[0073] In some embodiments, the response message further includes a cluster flag for indicating whether the remote storage node joins the cluster;
[0074] When the storage node is a master node and receives a response message sent by a remote storage node through a target network port, the following steps may also be included:
[0075] The remote storage nodes that have not joined the cluster are determined according to the cluster flag included in the response message, and the remote storage nodes that have not joined the cluster are selected to build the cluster.
[0076] For example, when a storage node serving as a slave node receives a detection message broadcast by a master node, when returning a response message, it may also add a cluster flag in the response message to indicate whether the slave node has joined the cluster, depending on whether the slave node has joined the cluster.
[0077] For example, when the value of the cluster flag is the first value, it indicates that the slave node has joined the cluster; when the value of the cluster flag is the second value, it indicates that the slave node has not joined the cluster.
[0078] Accordingly, when the storage node serving as the master node receives a response message sent by a remote storage node through the target network port, it can determine whether the remote storage node has joined the cluster based on the cluster flag included in the response message, and select some or all of the remote storage nodes that have not joined the cluster from the remote storage nodes that have not joined the cluster to build a cluster.
[0079] In some embodiments, the above-mentioned layer 2 Ethernet link layer communication with the remote storage node based on the recorded mapping relationship may include:
[0080] Based on the recorded MAC address of the remote storage node, a network port information acquisition request message is sent to the remote storage node through the target network port, and based on the network port information acquisition response message received from the remote storage node, the network port information of the remote storage node is acquired and stored; the network port information includes the network port MAC address;
[0081] When a network port configuration instruction is received and the MAC address of the network port to be configured in the network port configuration instruction is not the network port MAC address of this node, the target remote storage node to which the network port to be configured belongs is determined based on the network port information of the remote storage node stored in this node, and the network port configuration instruction is sent to the target remote storage node through the target network port using the Layer 2 Ethernet link layer, so that the target remote storage node configures the network port to be configured according to the network port configuration instruction when it receives the network port configuration instruction.
[0082] Illustratively, in order to implement the network port configuration of the storage node, the storage node serving as the master node may obtain the network port information of the remote storage node through Layer 2 Ethernet link layer communication.
[0083] The network port information at least includes the network port MAC address.
[0084] Exemplarily, the storage node serving as the master node may send a network port information acquisition request message to the remote storage node through the target network port and using the Layer 2 Ethernet link layer based on the recorded MAC address of the remote storage node.
[0085] After receiving the network port information acquisition request message sent by the master node, the remote storage node may return the network port information of each network port of the node to the master node via a network port information acquisition response message.
[0086] When the master node receives the network port information acquisition response message returned by the remote storage node, it can acquire and store the network port information of the remote storage node.
[0087] When receiving the network port configuration instruction, the storage node serving as the master node may obtain the MAC address of the network port to be configured in the network port configuration instruction and determine whether the MAC address of the network port to be configured is the network port MAC address of the local node.
[0088] When the MAC address of the network port to be configured is not the network port MAC address of this node, the master node can determine the remote storage node (which can be called the target remote storage node) to which the network port to be configured belongs based on the network port information of the remote storage node stored in this node, and send the network port configuration instruction to the target remote storage node through the target network port using the Layer 2 Ethernet link layer.
[0089] When the target remote storage node receives the network port configuration instruction, it can configure the network port to be configured according to the network port configuration instruction.
[0090] Exemplarily, the network port configuration may include but is not limited to network port IP parameter configuration, bond configuration, VLAN configuration, etc.
[0091] In some embodiments, the communication method provided in the embodiments of the present application may further include:
[0092] When there is a need for Layer 2 Ethernet link layer communication and the size of the data to be sent exceeds the maximum data transmission size of a single message, the data to be sent is fragmented and different fragments are transmitted through different Ethernet messages; wherein the size of a single fragment does not exceed the maximum data transmission size of a single message, and the Ethernet frame header of the Ethernet message used to transmit the last fragment carries a file end flag.
[0093] For example, considering that the data size that can be transmitted by a single Layer 2 message is usually limited, during the process of Layer 2 Ethernet link layer communication interaction between storage nodes, the size of the data to be transmitted may exceed the maximum transmission data size of a single message, such as MTU (Maximum Transmission Unit). In this case, the data to be transmitted can be fragmented.
[0094] Accordingly, when there is a Layer 2 Ethernet link layer communication requirement and the size of the data to be sent exceeds the maximum transmission data size of a single message, the data to be sent is fragmented, and different fragments are transmitted through different Ethernet messages.
[0095] For example, in order to ensure the integrity of data received by the receiving end, the Ethernet frame header of the Ethernet message used to transmit the last fragment carries an end-of-file marker, such as an EOF (End Of File) marker.
[0096] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present invention, the technical solutions provided by the embodiments of the present invention are described below in conjunction with specific application scenarios.
[0097] In this embodiment, in order to solve the problem of manual IP configuration during storage software installation and deployment, SCE software can be integrated into the self-developed storage image and installed on all cluster nodes as an independent component along with the image. It runs as a daemon process, listens to HTTP (Hypertext Transfer Protocol) requests from the web server (web server, hereinafter referred to as HANDY), and performs operations according to the request content in the HTTP body, such as network card IP configuration, bond configuration, etc.
[0098] like Figure 2 As shown, for example, the SCE software can mainly include three modules: HTTP module, DRV (Driver) module, and transmission protocol module.
[0099] HTTP module:
[0100] It mainly listens to requests from the web server, parses JSON (JavaScript Object Notation) data, and then sends it to the DRV module or transmission protocol module for processing.
[0101] DRV module:
[0102] It is mainly responsible for executing queries and setting services on the local machine according to the content of the request, and returning the results of the request response.
[0103] Transport protocol module:
[0104] It is mainly responsible for sending and receiving Layer 2 messages at the Ethernet link layer, and performing UDP (User Datagram Protocol) communication interaction between multiple terminals and nodes.
[0105] The following is a detailed description of some implementation details of the transmission protocol module.
[0106] 1. Transmission protocol module sending and receiving threads.
[0107] When the SCE software is initialized, it will actively query the network port information of all network ports in the current node.
[0108] Exemplarily, the network port information may include the current rate of the network port, the MAC address of the network port, the negotiated rate supported by the network port, the network port name, the current attributes of the network port (VLAN port, bond port, etc.), the port number, and the network port status.
[0109] Illustratively, the negotiation rate supported by the network port can be used to indicate whether the network port is a service port or a management port (the negotiation rate supported by the management port is usually lower than the negotiation rate supported by the service port).
[0110] In an example, the management port may be preferentially selected as the network port for sending and receiving messages.
[0111] Exemplarily, the network port for sending and receiving messages may be determined based on the current rate of the network port, the MAC address of the network port, the current attributes of the network port, the status of the network port, and the like.
[0112] For example, the network port with the lowest current rate, in UP state, and not a bond slave or VLAN port is selected as the network port for sending and receiving messages. If there are multiple such network ports, the network port with the smallest MAC address is selected as the network port for sending and receiving messages. The network port selection process can be found in Figure 3 .
[0113] like Figure 3 As shown, a network port list can be constructed based on all network ports of the node, and the network port list can be traversed.
[0114] For the currently traversed network port (which may be recorded as network port A), it may be determined whether the network port status is DOWN, or whether the network port is a bond slave or a VLAN port.
[0115] If the network port is in DOWN state or is a bond slave or VLAN port, traverse to the next network port.
[0116] When the network port is in UP state and is not a bond slave or VLAN port, you can compare the current rate of the network port (which can be recorded as speed_A) with the currently recorded minimum rate (which can be called speed_min).
[0117] When speed_min is less than speed_A, the next network port is traversed.
[0118] When speed_min>speed_A, the recorded minimum speed is updated.
[0119] In the case of speed_min=speed_A, the MAC address of the current network port (which may be recorded as mac_A) may be compared with the MAC address corresponding to the recorded lowest speed (which may be recorded as mac_min).
[0120] When mac_min<mac_A, traverse the next network port.
[0121] When mac_min=mac_A, traverse the next network port.
[0122] When mac_min>mac_A, the MAC address corresponding to the lowest recorded rate is updated.
[0123] When all the network ports in the network port list are traversed, the traversal ends.
[0124] Exemplarily, according to the above sorting logic, a physical network port or bond port with a network port status of UP and the lowest current network port rate is selected from the current node as the network port for sending and receiving messages.
[0125] It should be noted that if no valid port is found in the above manner, the SCE will continue polling until a valid network port is found and then continue the registration process.
[0126] Exemplarily, the registration process may include creating a socket, adding the network port handle to the epoll listening handle for reading and writing, and its specific implementation is not described here in detail.
[0127] 2. Transport protocol module message fragmentation mechanism.
[0128] The size of message frames sent by the Layer 2 Ethernet link layer is limited by the MTU. Under normal circumstances, the default MTU is 1500 bytes. However, when a storage node obtains remote data through the SCE, the size may exceed 1500 bytes. For example, when obtaining network port list information, the data size of a single network port is 300 bytes. If the number of network ports exceeds 5, internal slicing processing is required in the software to prevent communication data loss.
[0129] In addition, considering that the HANDY request is a single send, the data integrity of the SCE receipt to the HANDY also needs to be considered. Therefore, an EOF flag can be added to the message interaction logic to confirm that the data returned by the remote end has ended transmission.
[0130] For example, the Ethernet message frame format can be found in Figure 4 .
[0131] like Figure 4 As shown in the figure, the Type, Length, and Value (hereinafter referred to as TLV) represent Ethernet data frames, storing the data content of client / server (C / S) interactions. The frames preceding this are collectively referred to as the Ethernet frame header. The DMAC+SMAC+TYPE headers are used for kernel UPD interaction confirmation between the sender and receiver, as well as protocol parsing. From Magic to Reset frames, these are data frame headers used for custom processing within the software.
[0132] In this embodiment, the slicing mechanism can make full use of the frame format for slicing and reassembly.
[0133] like Figure 5 As shown, the client SCE software (i.e., the SCE software in the slave node) receives the request and confirms whether the request requires slicing by parsing the opcode in the message.
[0134] If not required, a single packet response is made; if required, slice preparation is made based on the data to be transmitted.
[0135] For example, data can be sub-packetized according to the smallest internal unit, such as encapsulating one Ethernet packet for every 4 network port data, and the last Ethernet packet carries an EOF flag in the Reserve of the data frame header, and the server (such as the master node) recognizes the flag to complete the closed loop of the request.
[0136] It should be noted that, when there is a sequence requirement for fragment transmission, a Seq number may be added to each Ethernet frame corresponding to the fragment data, and the Seq number is used to identify the sequence of the fragment data.
[0137] It should be noted that, in the embodiment of the present invention, a timeout waiting time can be pre-set. If the server does not receive an Ethernet frame with an EOF flag within the timeout waiting time (such as 30s), it can return an operation timeout to the web side.
[0138] 3. Transmission protocol module network port status monitoring and re-screening switching.
[0139] In this embodiment, if the network port selected during the initialization process is fixed as the network port for sending and receiving messages, then when the network port status is NO CARRIAR (no actual physical connection), Ethernet packets will not be transmitted, resulting in the server or client being unable to interact with the outside world.
[0140] Therefore, a monitoring process can be constructed to confirm whether it is necessary to switch the network port to restore the interaction between the transmission protocol modules.
[0141] like Figure 6 As shown, in each SCE software package delivery process, add monitoring of the package delivery network port:
[0142] 6.1. When entering the sending process, check the network port status: whether the status has changed from UP to DOWN, whether the network port has been configured as a bond member port, and whether the network port is a bond port;
[0143] 1) When the network port status is set to DOWN or is included in the management of a bond member port, re-screening of the network port is triggered;
[0144] 2) When IP is configured, the network port DOWN / UP will be triggered. If the sending port is the object of IP configuration, IFINDEX will change and the network port needs to be re-screened to establish socket communication.
[0145] 6.2. If the network port does not need to be re-screened and switched, the data packet will be sent. If the sending fails, try again.
[0146] 6.3. If the network port MAC changes after re-screening, the local SCE sends a unicast message to the original DMAC to refresh the MAC mapping relationship between the C / S ends for the continuous delivery of subsequent requests.
[0147] 4. Protocol transmission module protocol function.
[0148] Example 1: Initiate a scan broadcast.
[0149] The SCE engine is allowed to initiate several broadcast messages to scan all nodes in the LAN that have SCE software installed. The SCE master engine (i.e., the SCE software deployed on the master node) uses the scanned data to determine whether remote nodes have joined the cluster. It then selects remote nodes that have not yet joined the cluster to build a new cluster environment and control nodes without cluster management.
[0150] For example, HANDY may initiate a scan request, SCE may initiate a broadcast detection message, and within the scan cycle, screen the returned data for updates or additions;
[0151] The SCE software of the master node constructs a List linked list to store the mapping relationship (SMAC-DMAC) with the remote SCE.
[0152] Example 2: Network port configuration.
[0153] After the SCE completes the MAC address mapping, it allows the HANDY to control the remote node to perform operations such as IP configuration, bond configuration, and VLAN configuration.
[0154] Exemplarily, HANDY obtains the scanned network port list from the master node SCE software, selects the MAC address of one of the storage nodes as input, and initiates an IP configuration request.
[0155] The master node SCE software identifies whether the MAC address is local. If not, it is transferred to the transmission protocol module for forwarding and sent to the designated storage node (the storage node to which the MAC address belongs) through the Ethernet layer.
[0156] If it is forwarded to a remote node, the master node SCE software creates a timeout waiting thread and constructs a session ID to be filled in the message data frame header for storage to identify the uniqueness of the C / S session.
[0157] If a configuration success response message is received from the remote node within the timeout waiting period, the HANDY operation timeout is returned and a retry is requested.
[0158] It should be noted that, in the embodiment of the present invention, since the message sending and receiving framework of the transmission protocol module is not restricted by the business function, a more convenient iterative version can be used to add business functions based on actual business needs, such as:
[0159] 1) Find the hardware resource information related to the remote server;
[0160] 2) Set up the remote server related software functions;
[0161] 3) Maintain Ethernet heartbeat interaction with the remote server.
[0162] See Figure 7 , is a schematic diagram of the structure of a communication device provided by an embodiment of the present invention, wherein the communication device can be deployed in a storage node, such as Figure 7 As shown, the communication device may include:
[0163] An acquiring unit 710 is configured to acquire network port information of each network port of the node during the initialization operation of the storage node;
[0164] A selection unit 720 is configured to select a target network port in an enabled state from the network ports of the node as a message sending and receiving network port based on the network port information of each network port of the node; wherein the target network port is an aggregate bond port or a physical port;
[0165] The communication unit 730 is used to broadcast a detection message through the target network port when the storage node is the master node, so that the storage node as a slave node records the mapping relationship between the source MAC address of the detection message and the MAC address of the message sending and receiving network port determined by the slave node when receiving the detection message through the determined message sending and receiving network port, and returns a response message to the master node through the message sending and receiving network port determined by the slave node; wherein the source MAC address of the detection message is the MAC address of the target network port; the source MAC address of the response message is the MAC address of the message sending and receiving network port determined by the slave node, and the destination MAC address of the response message is the MAC address of the target network port;
[0166] a recording unit 740 configured to, when the storage node is a master node and the communication unit 730 receives a response message sent by the remote storage node through the target network port, record a mapping relationship between the MAC address of the target network port and the source MAC address of the response message;
[0167] The communication unit 730 is further configured to perform Layer 2 Ethernet link layer communication with the remote storage node based on the recorded mapping relationship.
[0168] In some embodiments, the network port information includes the network port status, the network port MAC address, the current attributes of the network port, and the current rate of the network port; the network port status includes an enabled state or a disabled state; the current attributes of the network port include an aggregate bond port, a bond slave port, a virtual local area network VLAN port, or a physical port;
[0169] The target network port is the bond port or physical port with the lowest current network rate.
[0170] In some embodiments, the selection unit 720 selects an enabled target network port from the network ports of the node as the message sending and receiving network port based on the network port information of each network port of the node, including:
[0171] Traverse all network ports of this node;
[0172] For the currently traversed network port, if the network port is in the DOWN state, or the network port is a bond slave port or a VLAN port, traverse to the next network port; otherwise, compare the current network port rate with the current minimum rate; the initial value of the minimum rate is infinity;
[0173] If the current rate of the network port is less than the current minimum rate, the current rate of the network port is used as the latest current minimum rate, the corresponding MAC address is recorded, and the next network port is traversed; if the current rate of the network port is greater than the current minimum rate, the next network port is traversed; if the current rate of the network port is equal to the current minimum rate, based on the MAC address of the network port and the MAC address corresponding to the current minimum rate, it is determined whether the MAC address corresponding to the current minimum rate needs to be updated;
[0174] If it is determined that the MAC address corresponding to the current lowest speed does not need to be updated, traverse the next network port; if it is determined that the MAC address corresponding to the current lowest speed needs to be updated, use the MAC address of the network port as the latest MAC address corresponding to the current lowest speed;
[0175] When the network port traversal is completed, the corresponding network port is determined as the target network port based on the MAC address corresponding to the recorded current lowest rate.
[0176] In some embodiments, after the selection unit 720 selects the target network port in the enabled state from the network ports of the node as the network port for sending and receiving messages based on the network port information of each network port of the node, the selection unit 720 further includes:
[0177] Regularly detecting the target network port;
[0178] When the network port status of the target network port is DOWN, or the current network port attribute of the target network port is a bond slave port, or the current network port attribute of the target network port is a bond port and the port serial number IFINDEX changes, a new target network port is selected as the network port for sending and receiving messages.
[0179] In some embodiments, the response message further includes a cluster flag for indicating whether the remote storage node joins the cluster;
[0180] The selection unit 720 is also used to determine the remote storage nodes that have not joined the cluster based on the cluster flag included in the response message when the storage node is the master node and the communication unit receives a response message sent by the remote storage node through the target network port, and select the remote storage nodes that have not joined the cluster to build the cluster.
[0181] In some embodiments, the communication unit 730 performs Layer 2 Ethernet link layer communication with the remote storage node based on the recorded mapping relationship, including:
[0182] Based on the recorded MAC address of the remote storage node, a network port information acquisition request message is sent to the remote storage node through the target network port, and based on the network port information acquisition response message received from the remote storage node, the network port information of the remote storage node is acquired and stored; the network port information includes the network port MAC address;
[0183] When a network port configuration instruction is received and the MAC address of the network port to be configured in the network port configuration instruction is not the network port MAC address of this node, the target remote storage node to which the network port to be configured belongs is determined based on the network port information of the remote storage node stored in this node, and the network port configuration instruction is sent to the target remote storage node through the target network port using the second layer Ethernet link layer, so that the target remote storage node configures the network port to be configured according to the network port configuration instruction when it receives the network port configuration instruction.
[0184] In some embodiments, the communication unit 730 is also used to fragment the data to be sent and transmit different fragments through different Ethernet messages when there is a need for Layer 2 Ethernet link layer communication and the size of the data to be sent exceeds the maximum transmission data size of a single message; wherein the size of a single fragment does not exceed the maximum transmission data size of a single message, and the Ethernet frame header of the Ethernet message used to transmit the last fragment carries a file end flag.
Claims
1. A communication method, characterized in that: Applied to a storage node, the method includes: During the initialization operation of the storage node, obtaining the network port information of each network port of the node; Based on the network port information of each network port of the current node, select a target network port in the enabled state from the network ports of the current node as the network port for sending and receiving messages; wherein the target network port is an aggregate bond port or a physical port; In the case where the storage node is the master node, a detection message is broadcast through the target network port, so that when the storage node as a slave node receives the detection message through the determined transceiver network port, it records the mapping relationship between the source MAC address of the detection message and the MAC address of the transceiver network port determined by the slave node, and returns a response message to the master node through the transceiver network port determined by the slave node; wherein the source MAC address of the detection message is the MAC address of the target network port; the source MAC address of the response message is the MAC address of the transceiver network port determined by the slave node, and the destination MAC address of the response message is the MAC address of the target network port; When the storage node is the master node and receives a response message sent by a remote storage node through the target network port, the mapping relationship between the MAC address of the target network port and the source MAC address of the response message is recorded, and based on the recorded mapping relationship, the second layer Ethernet link layer communication is performed with the remote storage node.
2. The method according to claim 1, characterized in that The network port information includes the network port status, network port MAC address, current network port attributes and current network port rate; the network port status includes enabled or disabled; the current network port attributes include aggregate bond port, bond slave port, virtual local area network VLAN port or physical port; The target network port is the bond port or physical port with the lowest current network rate.
3. The method according to claim 2, characterized in that The step of selecting an enabled target network port from the network ports of the node as the message sending and receiving network port according to the network port information of each network port of the node includes: Traverse all network ports of this node; For the currently traversed network port, if the network port is in the DOWN state, or the network port is a bond slave port or a VLAN port, traverse to the next network port; otherwise, compare the current network port rate with the current minimum rate; the initial value of the minimum rate is infinity; If the current rate of the network port is less than the current minimum rate, the current rate of the network port is used as the latest current minimum rate, the corresponding MAC address is recorded, and the next network port is traversed; if the current rate of the network port is greater than the current minimum rate, the next network port is traversed; if the current rate of the network port is equal to the current minimum rate, based on the MAC address of the network port and the MAC address corresponding to the current minimum rate, it is determined whether the MAC address corresponding to the current minimum rate needs to be updated; If it is determined that the MAC address corresponding to the current lowest speed does not need to be updated, traverse the next network port; if it is determined that the MAC address corresponding to the current lowest speed needs to be updated, use the MAC address of the network port as the latest MAC address corresponding to the current lowest speed; When the network port traversal is completed, the corresponding network port is determined as the target network port based on the MAC address corresponding to the recorded current lowest rate.
4. The method according to claim 1, wherein After selecting, based on the network port information of each network port of the current node, a target network port in an enabled state from the network ports of the current node as the network port for sending and receiving messages, the method further includes: Regularly detecting the target network port; When the network port status of the target network port is DOWN, or the current network port attribute of the target network port is a bondslave port, or the current network port attribute of the target network port is a bond port and the port serial number IFINDEX changes, a new target network port is selected as the network port for sending and receiving messages.
5. The method according to claim 1, wherein The response message also includes a cluster flag for indicating whether the remote storage node has joined the cluster; In the case where the storage node is a master node and receives a response message sent by a remote storage node through the target network port, the method further includes: The remote storage nodes that have not joined the cluster are determined according to the cluster flag included in the response message, and the remote storage nodes that have not joined the cluster are selected to build the cluster.
6. The method according to claim 1, wherein The performing Layer 2 Ethernet link layer communication with the remote storage node based on the recorded mapping relationship includes: Based on the recorded MAC address of the remote storage node, a network port information acquisition request message is sent to the remote storage node through the target network port, and based on the network port information acquisition response message received from the remote storage node, the network port information of the remote storage node is acquired and stored; the network port information includes the network port MAC address; When a network port configuration instruction is received and the MAC address of the network port to be configured in the network port configuration instruction is not the network port MAC address of this node, the target remote storage node to which the network port to be configured belongs is determined based on the network port information of the remote storage node stored in this node, and the network port configuration instruction is sent to the target remote storage node through the target network port using the second layer Ethernet link layer, so that the target remote storage node configures the network port to be configured according to the network port configuration instruction when it receives the network port configuration instruction.
7. The method according to claim 1, characterized in that The method further comprises: When there is a need for Layer 2 Ethernet link layer communication and the size of the data to be sent exceeds the maximum data transmission size of a single message, the data to be sent is fragmented and different fragments are transmitted through different Ethernet messages; wherein the size of a single fragment does not exceed the maximum data transmission size of the single message, and the Ethernet frame header of the Ethernet message used to transmit the last fragment carries a file end flag.
8. A communication device, characterized in that: Deployed on a storage node, the device includes: An acquiring unit, configured to acquire network port information of each network port of the node during the initialization operation of the storage node; A selection unit is configured to select a target network port in an enabled state from the network ports of the node as a message sending and receiving network port based on the network port information of each network port of the node; wherein the target network port is an aggregate bond port or a physical port; A communication unit, configured to, when the storage node is a master node, broadcast a detection message through the target network port, so that when the storage node, as a slave node, receives the detection message through the determined message-transmitting and receiving network port, it records the mapping relationship between the source MAC address of the detection message and the MAC address of the message-transmitting and receiving network port determined by the slave node, and returns a response message to the master node through the message-transmitting and receiving network port determined by the slave node; wherein, the source MAC address of the detection message is the MAC address of the target network port; the source MAC address of the response message is the MAC address of the message-transmitting and receiving network port determined by the slave node, and the destination MAC address of the response message is the MAC address of the target network port; a recording unit, configured to record a mapping relationship between the MAC address of the target network port and the source MAC address of the response message when the storage node is a master node and the communication unit receives a response message sent by the remote storage node through the target network port; The communication unit is further configured to perform Layer 2 Ethernet link layer communication with the remote storage node based on the recorded mapping relationship.
9. The device according to claim 8, characterized in that The network port information includes the network port status, network port MAC address, current network port attributes and current network port rate; the network port status includes enabled or disabled; the current network port attributes include aggregate bond port, bond slave port, virtual local area network VLAN port or physical port; The target network port is the bond port or physical port with the lowest current network rate; The selecting unit selects a target network port in an enabled state from the network ports of the node as the message sending and receiving network port based on the network port information of each network port of the node, including: Traverse all network ports of this node; For the currently traversed network port, if the network port is in the DOWN state, or the network port is a bond slave port or a VLAN port, traverse to the next network port; otherwise, compare the current network port rate with the current minimum rate; the initial value of the minimum rate is infinity; If the current rate of the network port is less than the current minimum rate, the current rate of the network port is used as the latest current minimum rate, the corresponding MAC address is recorded, and the next network port is traversed; if the current rate of the network port is greater than the current minimum rate, the next network port is traversed; if the current rate of the network port is equal to the current minimum rate, based on the MAC address of the network port and the MAC address corresponding to the current minimum rate, it is determined whether the MAC address corresponding to the current minimum rate needs to be updated; If it is determined that the MAC address corresponding to the current lowest speed does not need to be updated, traverse the next network port; if it is determined that the MAC address corresponding to the current lowest speed needs to be updated, use the MAC address of the network port as the latest MAC address corresponding to the current lowest speed; When the network port traversal is completed, the corresponding network port is determined as the target network port based on the MAC address corresponding to the recorded current lowest rate.
10. The device according to claim 8, characterized in that After the selection unit selects a target network port in an enabled state from the network ports of the node as the network port for sending and receiving messages based on the network port information of each network port of the node, the method further includes: Regularly detecting the target network port; When the network port status of the target network port is DOWN, or the current network port attribute of the target network port is a bondslave port, or the current network port attribute of the target network port is a bond port and the port sequence number IFINDEX changes, a new target network port is selected as the network port for sending and receiving messages; and / or, The response message also includes a cluster flag for indicating whether the remote storage node has joined the cluster; The selection unit is further configured to, when the storage node is a master node and the communication unit receives a response message sent by a remote storage node through the target network port, determine a remote storage node that has not joined the cluster based on a cluster flag included in the response message, and select the remote storage node that has not joined the cluster to build a cluster; and / or, The communication unit performs Layer 2 Ethernet link layer communication with the remote storage node based on the recorded mapping relationship, including: Based on the recorded MAC address of the remote storage node, a network port information acquisition request message is sent to the remote storage node through the target network port, and based on the network port information acquisition response message received from the remote storage node, the network port information of the remote storage node is acquired and stored; the network port information includes the network port MAC address; Upon receiving a network port configuration instruction, and if the MAC address of the network port to be configured in the network port configuration instruction is not the MAC address of the network port of the local node, determining the target remote storage node to which the network port to be configured belongs based on the network port information of the remote storage node stored in the local node, and sending the network port configuration instruction to the target remote storage node through the target network port by using the Layer 2 Ethernet link layer, so that the target remote storage node configures the network port to be configured according to the network port configuration instruction when receiving the network port configuration instruction; and / or, The communication unit is also used to fragment the data to be sent and transmit different fragments through different Ethernet messages when there is a need for Layer 2 Ethernet link layer communication and the size of the data to be sent exceeds the maximum transmission data size of a single message; wherein the size of a single fragment does not exceed the maximum transmission data size of a single message, and the Ethernet frame header of the Ethernet message used to transmit the last fragment carries a file end flag.
Citation Information
Patent Citations
Message forwarding method and equipment
CN103227757A
Network equipment
CN103490961A