Cross-cluster message forwarding method, device and system
By introducing service agent nodes in the Kubernetes cluster to intercept and modify messages, and using communication components to complete cross-cluster forwarding, the problem of cross-cluster access port consumption and security risks between Kubernetes clusters is solved, and port resource saving and security are achieved. Risk reduction.
Patent Information
- Application Number
- CN202410865604.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-06
AI Technical Summary
Cross-cluster access between Kubernetes clusters requires opening a large number of NodePort ports, resulting in port exhaustion and increased security risks.
By intercepting messages at the service agent node and adding extended information, communication components are used to complete cross-cluster message forwarding. Only the ports used for message forwarding are opened between communication components, saving port resources and reducing security risks.
It effectively saves port resources, reduces the activation of security policies, reduces the security risks of cross-cluster packet forwarding, realizes imperceptible cross-cluster calls, and reduces the cost and risk of sorting out application call relationships.
Smart Images

Figure CN118612293A
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a method, device and system for forwarding messages across clusters. Background Art
[0002] Kubernetes is the mainstream container management platform in the industry. The industry usually abbreviates Kubernetes as K8S. Containerization technology has been developed for many years, and K8S has become the de facto standard for container orchestration. In the field of virtualization, containers have successfully replaced virtual machines. Compared with virtual machines, containers have better elasticity and speed. Now many companies are migrating existing applications from virtualization to containers. Therefore, more and more applications are designed and developed based on Kubernetes from the beginning.
[0003] Currently, K8S clusters can only forward messages through the NodePort mechanism, which opens a port for forwarding messages. Each service that needs to be accessed across clusters needs to open a new port. The default port number range of K8S is 30000-32767. If there are many services to be accessed across clusters, it is easy to exhaust the ports. At the same time, the corresponding security policies need to be opened for the open ports, which poses certain security risks. Summary of the invention
[0004] The present application provides a method for forwarding messages across clusters, wherein the cluster includes a service proxy node; the service proxy node is used to intercept messages sent by any node in the cluster and add extended information to the messages; the cluster includes a communication component for communicating with other clusters, and the method includes:
[0005] A first service proxy node in the first cluster intercepts a service request message sent by any node in the first cluster;
[0006] The first service proxy node determines whether the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster;
[0007] If yes, the first service proxy node adds extended information to the service request message; the extended information at least includes the domain name corresponding to the destination IP address;
[0008] The first service proxy node sends the message to the first communication component, so that the first communication component sends the service request message to the second communication component of the second cluster;
[0009] The second communication component forwards the service request message to a target node corresponding to the domain name in the second cluster based on the domain name corresponding to the destination IP address in the extended information and returns a service response message.
[0010] Optionally, before the first service proxy node in the first cluster intercepts the service request message sent by any node in the first cluster, the method further includes:
[0011] The first service proxy node intercepts a DNS request message sent by any node in the first cluster;
[0012] The first service proxy node determines whether the domain name requested by the DNS resolution message is in the second cluster;
[0013] If the domain name requested by the DNS resolution message is in the second cluster, a random IP address is constructed and the correspondence between the IP address and the domain name is recorded, and the IP address is returned to the node so that the node sends a service request message based on the IP address.
[0014] Optionally, the first service proxy node determines whether the domain name requested by the DNS resolution message is in the second cluster, including: the first service proxy node sends the DNS resolution message to the DNS server, so that the DNS server queries a preset domain name table to determine that the domain name requested by the DNS resolution message is in the second cluster; wherein the domain name table includes all domain names in the second cluster.
[0015] Optionally, the first service proxy node determines whether the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster, including:
[0016] Determining whether the destination IP address in the service request message is the IP address constructed by the first service proxy node;
[0017] If yes, it is determined that the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster.
[0018] Optionally, the first service proxy node adds extended information to the service request message; the extended information at least includes a domain name corresponding to the destination IP address, including:
[0019] The first service proxy node queries the correspondence between the IP address and the domain name to determine the domain name corresponding to the destination IP address;
[0020] The first service proxy node adds extended information in the request message; the extended information includes the domain name corresponding to the destination IP address.
[0021] Optionally, the method further includes:
[0022] If the destination IP address in the service request message is not the IP address constructed by the first service proxy node, the first service proxy node forwards the service request message to a target node in the first cluster based on the destination IP address.
[0023] Optionally, the second communication component sending the service request message to a second service proxy node in the second cluster includes:
[0024] The second communication component deletes the extended information, and performs DNS resolution based on the domain name in the extended information to determine a target IP address corresponding to the domain name;
[0025] The second communication component modifies the destination IP address in the service request message to the target IP address, and forwards the service request message to the target node in the second cluster based on the modified destination IP address, so that the target node in the second cluster returns a service response message.
[0026] Optionally, a NodePort port for communication is pre-opened between the first communication component and the second communication component.
[0027] The present application also provides an electronic device, comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus;
[0028] The memory stores machine-readable instructions, and the processor executes the above method by calling the machine-readable instructions.
[0029] The present application also provides a computer-readable storage medium, which stores machine-readable instructions. When the machine-readable instructions are called and executed by a processor, the above method is implemented.
[0030] In the scheme recorded in the above embodiment, the service proxy node intercepts and modifies the message and forwards it to the communication component, and the communication component completes the forwarding of the cross-cluster message, so that only the ports for message forwarding need to be opened between the communication components across the cluster, thereby saving port resources. Since the number of ports is reduced, there is no need to open redundant security policies, which can reduce the security risks between message forwarding across clusters. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 This is a schematic diagram of an architecture for cross-cluster access services through a NodePort mechanism, provided by an exemplary embodiment.
[0032] Figure 2 It is a structural diagram of a cross-cluster message forwarding method provided by an exemplary embodiment.
[0033] Figure 3 It is a flowchart of a method for forwarding messages across clusters provided by an exemplary embodiment.
[0034] Figure 4 It is a schematic diagram of a first service proxy node intercepting a DNS request message provided by an exemplary embodiment.
[0035] Figure 5 This is a schematic diagram of the interaction between cross-cluster message forwarding provided by an exemplary embodiment.
[0036] Figure 6 It is a hardware structure diagram of an electronic device where a cross-cluster message forwarding device is located, provided by an exemplary embodiment.
[0037] Figure 7 It is a block diagram of a cross-cluster message forwarding device provided by an exemplary embodiment. DETAILED DESCRIPTION
[0038] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0039] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0040] Kubernetes is the mainstream container management platform in the industry. The industry usually abbreviates Kubernetes as K8S. Containerization technology has been developed for many years, and k8s has become the de facto standard for container orchestration. In the field of virtualization, containers have successfully replaced virtual machines. Compared with virtual machines, containers have better elasticity and speed. Now many companies are migrating existing applications from virtualization to containers. Therefore, more and more applications are designed and developed based on Kubernetes from the beginning.
[0041] For information security reasons, some services originally running on the same k8s cluster are often migrated to another k8s cluster. Applications running on a cluster can only access services in the same cluster. To access services in another cluster, they can only be accessed through the NodePort mechanism. At the same time, the access path of the service needs to be modified to achieve cross-cluster access.
[0042] NodePort in Kubernetes is a service type used to import traffic outside the cluster into the Service in the Kubernetes cluster. When a Service is created and its type is set to NodePort, the Kubernetes system will allocate a port on each node for the Service, called NodePort. This means that both nodes inside and outside the cluster can access the Service through the IP address and port.
[0043] See also Figure 1 , Figure 1 This is a schematic diagram of an architecture for cross-cluster access services through a NodePort mechanism, provided by an exemplary embodiment.
[0044] like Figure 1 As shown in the figure, application A originally runs in K8S cluster 1 and accesses services Service1 and Service2 through the domain names corresponding to the services. After application A is migrated to K8S cluster 2, application A cannot directly access services Service1 and Service2 through the domain names corresponding to the services. In this case, a new NodePort must be added in K8S cluster 1, and then the address of the Nodeport must be used in cluster 2 for cross-cluster access.
[0045] If you need to implement cross-cluster access in K8S, you can only do it through the NodePort mechanism. Using NodePort means that the port must be opened to the outside world. Opening the port means that you need to deal with the security department and activate the corresponding security policy.
[0046] Each service that needs to be accessed across clusters needs to open a new port. The default port number range of K8S is 30000-32767. If there are many services that need to be accessed across clusters, it is easy to use up the ports.
[0047] In addition, within the same cluster, many internal applications are considered trustworthy at the beginning of their design, so authentication is generally not required when accessing through the Service. When accessing across clusters, there will definitely be security risks if no authentication is required, so both the service provider and the service caller need to be modified, which increases development costs.
[0048] In view of this, the present application proposes a technical solution for intercepting and modifying messages, and then forwarding the messages uniformly by a communication component.
[0049] In this specification, a cluster includes a service proxy node; the service proxy node is used to intercept a message sent by any node in the cluster and add extended information to the message; the cluster includes a load balancing component and a communication component for communicating with other clusters.
[0050] In this specification, the cluster may be a K8S cluster, and the service proxy node may be an Agent Pod. In K8S, an Agent Pod generally refers to a Pod that runs a specific task or service, and is generally designed to support management and monitoring functions within the cluster.
[0051] Agent Pods can run on any node within a Kubernetes cluster. They usually share the same node with other application Pods and communicate through the internal network. Agent Pods are different from ordinary application Pods in that their main purpose is to serve the operation and monitoring needs of the entire cluster rather than directly provide business functions.
[0052] In K8S, each node is usually referred to as a Pod. Pod is the smallest deployment unit in K8S. It is a collection of one or more containers, sharing network and storage resources, and the specifications for container operation. Each Pod has a unique IP address in the K8S cluster and can contain one or more associated containers. These containers share network namespaces and storage volumes and run on the same host.
[0053] The communication component usually refers to Cluser-Proxy, which is used to implement message forwarding across clusters. In this specification, all messages across clusters are forwarded through Cluser-Proxy, so only one NodePort port needs to be opened for Cluser-Proxy, and there is no need to open a NodePort for each Service, which can save a lot of port resources. The number of ports has decreased, which means that the security risk is reduced, and there is no need to open redundant security policies.
[0054] See also Figure 2 , Figure 2 It is a structural diagram of a cross-cluster message forwarding method provided by an exemplary embodiment.
[0055] like Figure 2As shown, Cluser-Proxy can be deployed in K8S cluster 1 and K8S cluster 2 respectively, and proxy access across clusters can be completed through Proxy. Compared with the original method through NodePort, only one NodePort needs to be opened for Cluster-Proxy, and a NodePort does not need to be opened for each Service, which can save a large number of ports and reduce the opening of security policies.
[0056] The newly added Agent-Pod is automatically injected into the Service, which can intercept the service request message sent by the node in this cluster, and automatically expand the service request message, and forward it to the Cluster-Proxy in this cluster. The Cluster-Proxy in the opposite cluster can know the correct node in this cluster to forward it based on the extended information carried in the message. For the applications in the cluster, it is not necessary to know whether the destination address of the message is in this cluster or other clusters. The application side can realize the non-perceptual cross-cluster call, so there is no need to sort out the calling relationship of the application, which can greatly reduce the cost of sorting and the risk of missing sorting.
[0057] See also Figure 3 , Figure 3 This is a flow chart of a method for forwarding messages across clusters provided by an exemplary embodiment. The method may include the following steps:
[0058] Step 302: A first service proxy node in a first cluster intercepts a service request message sent by any node in the first cluster.
[0059] In this specification, any node in the first cluster may send a service request message for a service provided within the cluster or a service provided outside the cluster.
[0060] Typically, nodes within a cluster access services provided within the cluster through the domain names of the services within the cluster, so nodes within a cluster can usually only access services provided within the cluster.
[0061] However, since applications may migrate, nodes in the first cluster may migrate to other second clusters. Therefore, nodes in the second cluster access services provided by the first cluster, which is cross-cluster access.
[0062] In this specification, the first service proxy node in the first cluster may intercept a service request message sent by any node in the first cluster.
[0063] The specific method of intercepting messages is not specifically limited in this specification. For example, the logic of intercepting and processing traffic is deployed as a Sidecar container in the target Pod. In this way, the Sidecar container can share the network namespace with the main application container, so that the traffic sent by the main application container can be intercepted. For another example, by defining an Init container in the target Pod, the Init container can perform specific operations before the main application container starts, including setting network rules, intercepting traffic, etc. For another example, deploying a service mesh such as Istio, which provides powerful traffic control and monitoring capabilities, can intercept, route and process traffic in a fine-grained manner.
[0064] Step 304: The first service proxy node determines whether the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster.
[0065] In this specification, after intercepting the service request message, the first service proxy node may determine whether the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster.
[0066] Normally, before any node in the first cluster sends a service request message, it needs to initiate a DNS resolution to the DNS server in the cluster. If the domain name requested by the node in the first cluster is not in the cluster, the DNS server cannot resolve the domain name, and therefore cannot obtain the IP address, resulting in failure to send the service request message. On the contrary, if the domain name requested by the node in the first cluster is in the cluster, the DNS server in the cluster can directly perform a DNS resolution on the domain name, directly determine the IP address, and send a message based on the IP address.
[0067] In this specification, the service proxy node can also intercept the DNS resolution message sent by any node, and determine whether the domain name requested by the node is in the cluster during DNS resolution. If the domain name requested by the node is not in the cluster, a random IP address can be constructed and returned to the node, and the corresponding relationship between the IP address and the domain name requested by the node is recorded.
[0068] It should be noted that it is necessary to ensure that the IP address constructed by the service proxy node is not an IP address that already exists in the cluster.
[0069] Therefore, after intercepting the service request message, the first service proxy node can determine whether the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster by querying the corresponding relationship.
[0070] If the destination IP address is an IP address constructed by the first service proxy node, then it means that the domain name corresponding to the IP address is a domain name in the second cluster; otherwise, it is a domain name in the current cluster.
[0071] Step 306: If yes, the first service proxy node adds extended information to the service request message; the extended information at least includes the domain name corresponding to the destination IP address.
[0072] In this specification, if the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster, the first service proxy node may add extended information to the service request message.
[0073] Since the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster, which is not in this cluster, if the message is to be forwarded correctly, the domain name corresponding to the destination IP address needs to be additionally added to the message.
[0074] It should be noted that the service request message may specifically specify a service in other clusters, so in addition to the domain name, a port number may be added to the extended information so that the request message can be correctly forwarded to the node corresponding to the target service.
[0075] Step 308: The first service proxy node sends the message to the first communication component, so that the first communication component sends the service request message to the second communication component of the second cluster.
[0076] In this specification, the service proxy node in the first cluster may send the service request message containing the extended information to the first communication component in the first cluster.
[0077] A NodePort port for forwarding messages may be opened between the first communication component in the first cluster and the second communication component in the second cluster, so that the first communication component can directly forward the service request message containing the extended information to the second communication component in the second cluster.
[0078] Step 310: The second communication component forwards the service request message to a target node corresponding to the domain name in the second cluster based on the domain name corresponding to the destination IP address in the extended information, and returns a service response message.
[0079] After receiving the service request message, the second communication of the second cluster may initiate DNS resolution to a DNS server in the second cluster based on the domain name corresponding to the destination IP address in the extended information, thereby resolving the corresponding target IP address based on the domain name in the extended information.
[0080] The second communication component may forward the service request message to the target node in the second cluster based on the resolved target IP address to complete cross-cluster message forwarding, and return a response message to the first communication component.
[0081] In the scheme recorded in the above embodiment, the service proxy node intercepts and modifies the message and forwards it to the communication component, and the communication component completes the forwarding of the cross-cluster message, so that only the ports for message forwarding need to be opened between the communication components across the cluster, thereby saving port resources. Since the number of ports is reduced, there is no need to open redundant security policies, which can reduce the security risks between message forwarding across clusters.
[0082] In one implementation, the first service proxy node of the first cluster may also intercept a DNS request message sent by any node in the first cluster.
[0083] Before sending a service request message, any node in the first cluster needs to send a DNS request message to the DNS server in the first cluster based on the domain name corresponding to the requested service, so as to resolve the domain name to obtain the destination IP address, and then send a service request message to the target node in the first cluster based on the IP address.
[0084] The first service proxy node can intercept the DNS request message sent by any node in the first cluster and send a DNS request message to the DNS server. When the domain name corresponding to the requested service is not in the first cluster, that is, the domain name corresponding to the requested service is in the second domain name, the DNS server cannot resolve the DNS request message, and therefore cannot obtain the IP address, and returns DNS resolution failure.
[0085] After the first service proxy node receives the result of the failure to resolve the DNS message returned by the DNS server, it can be determined that the domain name requested by the DNS resolution message is not in the first cluster, that is, the domain name corresponding to the requested service is in other clusters.
[0086] The first service proxy node can further construct a random IP address so that the nodes within the first cluster can send a service request message based on the IP address. At the same time, the first service proxy node can further record the correspondence between the domain name and the IP address constructed by the first service proxy node, so as to facilitate the subsequent query of the correspondence based on the IP address to obtain the domain name and add extended information to the service request message.
[0087] In one implementation, the DNS server may pre-add a domain name table containing all domain names in the second cluster; the DNS server in the first cluster may directly query the domain name table to determine whether the domain name requested by the DNS resolution message is in the second cluster.
[0088] After intercepting the DNS request message, the first service proxy node can directly send the DNS resolution message to the DNS server, so that the DNS server queries a preset domain name table to determine that the domain name requested by the DNS resolution message is in the second cluster; wherein the domain name table includes all domain names in the second cluster.
[0089] See also Figure 4 , Figure 4 It is a schematic diagram of a first service proxy node intercepting a DNS request message provided by an exemplary embodiment.
[0090] like Figure 4 As shown, any node in the first cluster can initiate DNS resolution, that is, send a DNS request message to the DNS server.
[0091] The first service proxy node can intercept the DNS request message and forward the DNS request message to the DNS server, triggering DNS local resolution, thereby obtaining the DNS resolution result.
[0092] The DNS server may query the domain name table to determine whether the domain name requested by the DNS request message is in the second cluster, and return the DNS resolution result to the first service proxy node.
[0093] After the first service proxy node obtains the DNS resolution result, if it is determined that the domain name requested by the DNS request message is within the cluster, that is, the domain name requested by the DNS request message is not in the second cluster, the DNS resolution result can be directly returned to the node in the first cluster.
[0094] If the domain name requested by the DNS request message is in the second cluster, a random reachable IP address is constructed, and the correspondence between the IP address and the domain name requested by the DNS request message is recorded, and the constructed IP address is returned as a DNS result to the node in the first cluster.
[0095] In one implementation, because the first service proxy node pre-intercepts the DNS request message, and when the domain name requested by the DNS resolution message is in the second cluster, a random IP address is constructed, and the correspondence between the IP address and the domain name is recorded.
[0096] After intercepting the service request message, the first service proxy node may determine whether the destination IP address in the service request message is the IP address constructed by the first service proxy node;
[0097] If the destination IP address in the service request message is the IP address constructed by the first service proxy node, then it can be determined that the domain name requested by the service request message is not in the first cluster and needs to be forwarded across clusters. The first service node needs to further add extended information to the message and forward it to the first communication component for forwarding.
[0098] In one embodiment, when the first service proxy node determines that the destination IP address in the service request message is an IP address constructed by the first service proxy node, it can be determined that the service request message needs to be forwarded across clusters, and the first service proxy node can query the correspondence between the IP address and the domain name recorded during DNS resolution to obtain the domain name requested by the service request message in the second cluster.
[0099] Further, the first service proxy node may include the domain name in the service request message, so that the first communication component forwards the service request message to the second communication component of the second cluster.
[0100] In one implementation, if the first service proxy determines that the destination IP address in the service request message is not the IP address constructed by the first service proxy node, it means that the domain name requested by the service request message is not in the second cluster and does not need to be forwarded across clusters.
[0101] Therefore, the first service proxy node can directly forward the service request message to the target node in the first cluster based on the destination IP address, thereby completing message forwarding within the cluster.
[0102] In one implementation, after acquiring the service request message forwarded by the first service node, the first communication component may forward the message between clusters based on the NodePort port opened in advance between the first communication component and the second cluster.
[0103] After the second communication component in the second cluster obtains the message forwarded by the first communication component in the first cluster, the second communication component may delete the extended information in the service request message.
[0104] Since the extended information includes the domain name in the second cluster requested by the service request message, the second communication component can initiate DNS resolution to the DNS server in the second cluster based on the domain name, so that the DNS server in the second cluster can resolve the target IP address based on the domain name.
[0105] The second communication component modifies the destination IP address in the service request message to the target IP address, and forwards the service request message to the target node in the second cluster based on the modified destination IP address, so that the target node in the second cluster returns a service response message.
[0106] In the scheme recorded in the above embodiment, the service proxy node intercepts and modifies the message and forwards it to the communication component, and the communication component completes the forwarding of the cross-cluster message, so that only the ports for message forwarding need to be opened between the communication components across the cluster, thereby saving port resources. Since the number of ports is reduced, there is no need to open redundant security policies, which can reduce the security risks between message forwarding across clusters.
[0107] See also Figure 5 , Figure 5 It is a schematic diagram of the interaction between cross-cluster message forwarding provided by an exemplary embodiment.
[0108] like Figure 5 As shown, after any node in the first cluster initiates DNS resolution, it can obtain an IP address after DNS resolution, and the node can send a service request message based on the IP address.
[0109] The first service proxy node may intercept the service request message, obtain the IP address in the service request message, and further determine whether the IP address is an IP address constructed by the service proxy node.
[0110] If the IP address is not an IP address constructed by the service proxy node, the service request message may be directly forwarded to the target node in the first cluster based on the IP address, and a response message may be returned.
[0111] If the IP address is an IP address constructed by the service proxy node, the service proxy node may query the corresponding relationship, determine the domain name in the second cluster corresponding to the IP address, and further add extended information to the request message, where the extended information includes the domain name.
[0112] The service proxy node may further modify the destination IP address of the service request message to the IP address of the first communication component, and forward the message to the first communication component in the first cluster based on the IP address of the first communication component.
[0113] The first communication component may forward the service request message to the second communication component of the second cluster based on the pre-opened NodePort port.
[0114] After receiving the service request message, the second communication component of the second cluster may delete the extended information in the service request message, and trigger DNS resolution to the DNS server of the second cluster based on the domain name in the extended information.
[0115] The second communication component may obtain a DNS resolution result returned by the DNS server of the second cluster, and modify the destination IP address of the message to the IP address resolved by the DNS server of the second cluster.
[0116] The second communication component may further forward the service request message to a target node in the second cluster based on the destination IP address.
[0117] The target node can return a service response message to the second communication component, and the second communication component forwards the response message to the first communication component, and the first communication further forwards the response message to the first service proxy node, and finally the first service proxy node forwards the response message to the target node that initiated the service request in the first cluster, thereby completing the entire service request.
[0118] Corresponding to the above-mentioned embodiment of the cross-cluster message forwarding method, this specification also provides an embodiment of the cross-cluster message forwarding device.
[0119] See also Figure 6 , Figure 6 It is a hardware structure diagram of an electronic device where a cross-cluster message forwarding device is located, which is shown as an exemplary embodiment. At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610, and of course may also include hardware required for other services. One or more embodiments of this specification can be implemented based on software, such as the processor 606 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to the software implementation method, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logical unit, but can also be hardware or logic devices.
[0120] See also Figure 7 , Figure 7 FIG. 1 is a block diagram of a cross-cluster message forwarding device shown in an exemplary embodiment. The cross-cluster message forwarding device can be applied to Figure 5 In the electronic device shown in the figure, the technical solution of this specification is implemented. Among them, the above-mentioned cross-cluster message forwarding device may include:
[0121] A message interception unit 702, configured for a first service proxy node in a first cluster to intercept a service request message sent by any node in the first cluster;
[0122] A domain name determining unit 704, the first service proxy node determines whether the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster;
[0123] A message extension unit 706, configured to, if yes, add extension information to the service request message by the first service proxy node; the extension information at least includes a domain name corresponding to the destination IP address;
[0124] The cross-cluster forwarding unit 708 is configured for the first service proxy node to send the message to the first communication component, so that the first communication component sends the service request message to the second communication component of the second cluster;
[0125] The message forwarding unit 710 is used for the second communication component to forward the service request message to the target node corresponding to the domain name in the second cluster based on the domain name corresponding to the destination IP address in the extended information and return a service response message.
[0126] In this embodiment, before the first service proxy node in the first cluster intercepts the service request message sent by any node in the first cluster, the device further includes:
[0127] A DNS interception subunit, configured for the first service proxy node to intercept a DNS request message sent by any node in the first cluster;
[0128] A domain name query subunit is used by the first service proxy node to determine whether the domain name requested by the DNS resolution message is in the second cluster; an IP address construction subunit is used to construct a random IP address and record the correspondence between the IP address and the domain name if the domain name requested by the DNS resolution message is in the second cluster, and return the IP address to the node so that the node can send a service request message based on the IP address.
[0129] In this embodiment, the domain name query subunit is further used for the first service proxy node to send the DNS resolution message to the DNS server, so that the DNS server queries a preset domain name table to determine that the domain name requested by the DNS resolution message is in the second cluster; wherein the domain name table includes all domain names in the second cluster.
[0130] In this embodiment, the domain name query subunit is further used to determine whether the destination IP address in the service request message is the IP address constructed by the first service proxy node;
[0131] If yes, it is determined that the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster.
[0132] In this embodiment, the message extension unit is further used for the first service proxy node to query the correspondence between the IP address and the domain name to determine the domain name corresponding to the destination IP address;
[0133] The first service proxy node adds extended information in the request message; the extended information includes the domain name corresponding to the destination IP address.
[0134] In this embodiment, the device further includes:
[0135] The intra-cluster forwarding unit is configured to forward the service request message to a target node in the first cluster based on the destination IP address if the destination IP address in the service request message is not the IP address constructed by the first service proxy node.
[0136] In this embodiment, the message forwarding unit is further used for the second communication component to delete the extended information, and perform DNS resolution based on the domain name in the extended information to determine the target IP address corresponding to the domain name;
[0137] The second communication component modifies the destination IP address in the service request message to the target IP address, and forwards the service request message to the target node in the second cluster based on the modified destination IP address, so that the target node in the second cluster returns a service response message.
[0138] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. Ordinary technicians in this field can understand and implement it without paying creative work.
[0139] See also Figure 7 , Figure 7 The block diagram of a cross-cluster message forwarding system is shown in an exemplary embodiment. The cross-cluster message forwarding system may include:
[0140] A search subsystem, configured to obtain at least one keyword in response to a data search request;
[0141] A named entity management subsystem, used to determine a named entity corresponding to the keyword, and determine a data column set associated with the named entity in a preset corresponding relationship set;
[0142] A named entity inference subsystem, configured to infer a set of data columns corresponding to the named entity based on at least one preset data column inference algorithm;
[0143] The audit subsystem is used to determine whether the data columns in the data column set are valid.
[0144] A subsystem associated with a named entity, used to generate a correspondence between the named entity and the determined valid data column set, and add the correspondence to the correspondence set. The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse. This specification also provides an embodiment of a computer-readable storage medium. The computer-readable storage medium stores machine-readable instructions, which, when called and executed by a processor, can implement the cross-cluster message forwarding method provided in any embodiment of this specification.
[0145] The computer-readable storage medium provided in the embodiments of this specification may specifically include, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or optical fiber card. That is, the readable storage medium includes a readable medium that can store or transmit information.
[0146] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0147] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0148] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0149] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0150] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0151] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0152] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "one", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0153] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0154] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.
Claims
1. A method for forwarding messages across clusters, wherein the cluster includes a service proxy node; the service proxy node is used to intercept messages sent by any node in the cluster and add extended information to the messages; the cluster includes a communication component for communicating with other clusters, and the method includes: A first service proxy node in the first cluster intercepts a service request message sent by any node in the first cluster; The first service proxy node determines whether the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster; If yes, the first service proxy node adds extended information to the service request message; The extended information includes at least the domain name corresponding to the destination IP address; The first service proxy node sends the message to the first communication component, so that the first communication component sends the service request message to the second communication component of the second cluster; The second communication component forwards the service request message to a target node corresponding to the domain name in the second cluster based on the domain name corresponding to the destination IP address in the extended information and returns a service response message.
2. The method according to claim 1, before the first service proxy node in the first cluster intercepts the service request message sent by any node in the first cluster, the method further comprises: The first service proxy node intercepts a DNS request message sent by any node in the first cluster; The first service proxy node determines whether the domain name requested by the DNS resolution message is in the second cluster; If the domain name requested by the DNS resolution message is in the second cluster, a random IP address is constructed and the correspondence between the IP address and the domain name is recorded, and the IP address is returned to the node so that the node sends a service request message based on the IP address.
3. The method according to claim 2, wherein the first service proxy node determines whether the domain name requested by the DNS resolution message is in the second cluster, comprising: The first service proxy node sends the DNS resolution message to the DNS server, so that the DNS server queries a preset domain name table to determine that the domain name requested by the DNS resolution message is in the second cluster; wherein the domain name table includes all domain names in the second cluster.
4. The method according to claim 2, wherein the first service proxy node determines whether the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster, comprising: Determining whether the destination IP address in the service request message is the IP address constructed by the first service proxy node; If yes, it is determined that the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster.
5. The method according to claim 4, wherein the first service proxy node adds extended information to the service request message; The extended information includes at least the domain name corresponding to the destination IP address, including: The first service proxy node queries the correspondence between the IP address and the domain name to determine the domain name corresponding to the destination IP address; The first service proxy node adds extended information in the request message; the extended information includes the domain name corresponding to the destination IP address.
6. The method according to claim 4, further comprising: If the destination IP address in the service request message is not the IP address constructed by the first service proxy node, the first service proxy node forwards the service request message to a target node in the first cluster based on the destination IP address.
7. The method according to claim 1, wherein the second communication component sends the service request message to a second service proxy node in the second cluster, comprising: The second communication component deletes the extended information, and performs DNS resolution based on the domain name in the extended information to determine a target IP address corresponding to the domain name; The second communication component modifies the destination IP address in the service request message to the target IP address, and forwards the service request message to the target node in the second cluster based on the modified destination IP address, so that the target node in the second cluster returns a service response message.
8. A cross-cluster message forwarding device, the cluster comprising a service proxy node; the service proxy node is used to intercept a message sent by any node in the cluster and add extended information to the message; the cluster comprises a communication component for communicating with other clusters, and the device comprises: A message interception unit, configured for a first service proxy node in a first cluster to intercept a service request message sent by any node in the first cluster; A domain name determining unit, wherein the first service proxy node determines whether the domain name corresponding to the destination IP address in the service request message is a domain name in the second cluster; a message extension unit, configured to, if yes, add extension information to the service request message by the first service proxy node; The extended information includes at least the domain name corresponding to the destination IP address; a cross-cluster forwarding unit, configured for the first service proxy node to send the message to the first communication component, so that the first communication component sends the service request message to the second communication component of the second cluster; A message forwarding unit is used for the second communication component to forward the service request message to the target node corresponding to the domain name in the second cluster based on the domain name corresponding to the destination IP address in the extended information and return a service response message.
9. An electronic device, comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus; The memory stores machine-readable instructions, and the processor executes the method according to any one of claims 1 to 7 by calling the machine-readable instructions.
10. A computer-readable storage medium storing machine-readable instructions, wherein the machine-readable instructions, when called and executed by a processor, implement the method according to any one of claims 1 to 7.
