A Kafka inter-cluster data transmission method and related equipment
By introducing the Nginx server for data transmission between Kafka clusters, and utilizing its high availability and secure socket protocol, the problem of long links and high costs in Kafka's cross-machine room transmission is solved, and safe, concise and efficient data transmission is achieved.
Patent Information
- Application Number
- CN202210652624.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-07
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-06-07
AI Technical Summary
Kafka's cross-computer room data transmission process has problems such as long data transmission links, network delay risks and high costs, especially the complex architecture and high costs caused by the need to build multiple additional intermediary servers.
The data transmission method between Kafka clusters based on virtual IP is used to transmit data through the Nginx server. The high availability features of Nginx are used to reduce the number of intermediary servers and the public network transmission is encrypted through the secure socket protocol to ensure the security and safety of data transmission. Simplicity.
It reduces data transmission costs, improves the implementability and security of data transmission between Kafka clusters, simplifies transmission links, and reduces network delay risks.
Smart Images

Figure CN115022325B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of Internet technology, and in particular, relates to a method, system and device for data transmission between Kafka clusters. Background Art
[0002] Kafka is an open source stream processing platform. Kafka is a high-throughput distributed publish-subscribe messaging system that can handle all the action streams of consumers on the website. This action (web browsing, search and other user actions) is a key factor in many social functions on the modern network. This data is usually solved by processing logs and log aggregation due to throughput requirements. The purpose of Kafka is to unify online and offline message processing through Hadoop's parallel loading mechanism, and to provide real-time messages through clusters.
[0003] Different enterprises usually have a Kafka platform built on the enterprise intranet to process internal data. However, as business needs change, the information in Kafka often needs to be synchronized with the Kafka platforms of different enterprises. At this time, for the security of data transmission, it is often necessary to set up an additional Kafka cluster with a public IP as a transit point to transfer data from one enterprise's intranet Kafka platform to another enterprise's intranet Kafka platform.
[0004] This process becomes the main problem of Kafka's cross-data center transmission solution. The data transmission link is long, which increases the risk of network delay. In addition, the transmission requires the establishment of an additional Kafka trans cluster. The number of cluster machines is too large, resulting in excessive costs. Summary of the invention
[0005] A first aspect of an embodiment of the present application provides a method for transmitting data between Kafka clusters, wherein the method is applied to a first Kafka cluster and includes:
[0006] The first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, so that the first Nginx server transmits the first data to the second Nginx server based on the secure socket protocol, and the second Nginx server transmits the first data to the second Kafka cluster;
[0007] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0008] Based on the Kafka inter-cluster data transmission method provided by the first aspect of the embodiment of the present application, optionally, the first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, including:
[0009] The first Kafka cluster transmits the first data to a Kafka Mirror service, so that the KafkaMirror service transmits the first data to a first Nginx server.
[0010] Based on the Kafka inter-cluster data transmission method provided in the first aspect of the embodiment of the present application, optionally, the first Nginx server and the second Nginx server are both in active-active mode.
[0011] A second aspect of an embodiment of the present application provides a method for transmitting data between Kafka clusters, the method being applied to a first Nginx server, comprising:
[0012] The first Nginx server receives first data, where the first data is transmitted to the first Nginx server by the first Kafka cluster based on the virtual IP;
[0013] The first Nginx server sends the first data to the second Nginx server based on the secure socket protocol, so that the second Nginx server transmits the first data to the second Kafka cluster;
[0014] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0015] The present application implements three aspects to provide a method for data transmission between Kafka clusters, the method being applied to a first Nginx server, including:
[0016] The first Nginx server receives first data, where the first data is transmitted to the first Nginx server by the first Kafka cluster based on the virtual IP;
[0017] The first Nginx server sends the first data to the second Nginx server based on the secure socket protocol, so that the second Nginx server transmits the first data to the second Kafka cluster;
[0018] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0019] A fourth aspect of an embodiment of the present application provides a method for transmitting data between Kafka clusters, the method being applied to a second Nginx server, comprising:
[0020] The second Nginx server receives the first data, where the first data is transmitted from the first Kafka cluster to the first Nginx server based on the virtual IP, and the first Nginx server sends the first data to the second Nginx server based on the secure socket protocol;
[0021] The second Nginx server sends the first data to a second Kafka cluster;
[0022] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0023] A fifth aspect of an embodiment of the present application provides a method for data transmission between Kafka clusters, the method being applied to a second Kafka cluster;
[0024] The second kafka cluster receives first data, where the first data is transmitted from the first Kafka cluster to the first Nginx server based on the virtual IP, and then sent from the first Nginx server to the second Nginx server based on the secure socket protocol, and then sent from the second Nginx server to the second kafka cluster;
[0025] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0026] A sixth aspect of an embodiment of the present application provides a Kafka inter-cluster data transmission system, including:
[0027] The first Kafka cluster, the first Nginx server, the second Kafka cluster and the second Nginx server;
[0028] The first Kafka cluster is used to transmit the first data to the first Nginx server based on the virtual IP;
[0029] The first Nginx server is used to receive the first data, and send the first data to the second Nginx server based on the secure socket protocol;
[0030] The second Nginx server is used to receive the first data and send the first data to the second Kafka cluster;
[0031] The second Kafka cluster is used to receive the first data;
[0032] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0033] A sixth aspect of the embodiments of the present application provides a Kafka cluster device, including:
[0034] CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply;
[0035] The memory is a transient storage memory or a persistent storage memory;
[0036] The central processing unit is configured to communicate with the memory and execute instruction operations in the memory on the device to perform the method described in any one of the first aspects of the embodiments of the present application.
[0037] A seventh aspect of an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute a method as described in any one of the first aspects of the embodiment of the present application.
[0038] From the above technical scheme, it can be seen that the embodiment of the present application has the following advantages: the present application provides a method for data transmission between Kafka clusters, the method is applied to the first Kafka cluster, including: the first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, so that the first Nginx server transmits the first data to the second Nginx server based on the secure socket protocol, and the second Nginx server transmits the first data to the second Kafka cluster; the first Kafka cluster and the first Nginx server are set in the first intranet, the second Kafka cluster and the second Nginx server are set in the second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server have external network IPs respectively. Based on this scheme, it can be seen that the method for data transmission between Kafka clusters provided by the present application uses Nginx for transmission, and utilizes the high availability characteristics of the Nginx server, thereby reducing the number of intermediary servers required to be set in the transmission link, thereby reducing the data transmission cost, and at the same time, the public network transmission process is encrypted by Nginx ssl, which ensures the security of data transmission and improves the feasibility of the data transmission process between Kafka clusters. In addition, the data transmission link of the current architecture has become simple, and the risk of data delay has been solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work. It is understood that the drawings provided in this section are only used to better understand the present solution and do not constitute a limitation of the present application.
[0040] Figure 1 A structural diagram of an embodiment of a Kafka inter-cluster data transmission system provided in this application;
[0041] Figure 2 A structural diagram of a Kafka cluster device embodiment provided in this application;
[0042] Figure 3 A schematic diagram of the structure of an Nginx server device embodiment provided in this application;
[0043] Figure 4 Another structural diagram of the Nginx server device embodiment provided by the present application;
[0044] Figure 5 This is another structural schematic diagram of the Kafka cluster device embodiment provided in this application. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application are clearly and completely described below. Obviously, the described embodiments are only embodiments of a part of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should belong to the scope of protection of the present application. At the same time, for the sake of clarity and simplicity, the description of well-known functions and structures is omitted in the following description.
[0046] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0047] Kafka is an open source stream processing platform. Kafka is a high-throughput distributed publish-subscribe messaging system that can handle all the action streams of consumers on the website. This action (web browsing, search and other user actions) is a key factor in many social functions on the modern network. This data is usually solved by processing logs and log aggregation due to throughput requirements. The purpose of Kafka is to unify online and offline message processing through Hadoop's parallel loading mechanism, and to provide real-time messages through clusters.
[0048] Different enterprises usually have a Kafka platform built on the enterprise intranet to process internal data. However, as business needs change, the information in Kafka often needs to be synchronized with the Kafka platforms of different enterprises. At this time, for the security of data transmission, it is often necessary to set up an additional Kafka cluster with a public IP as a transit point to transfer data from one enterprise's intranet Kafka platform to another enterprise's intranet Kafka platform.
[0049] The general transmission path in this process includes: the first Kafka cluster at the starting point of data transmission, the Kafka Mirror service that transfers the data in the first Kafka cluster to the Kafka trans cluster set up on the public network, the Kafka trans cluster used for transferring data, the Kafka Mirror service used to transfer the Kafka trans cluster to the second Kafka cluster, and the second Kafka cluster at the end point of data transmission. There are many problems with the entire data transmission link. First, due to the processing capacity of the Kafka system, the Kafka trans cluster used for transfer needs to set up multiple machines and equipment to support the implementation of the data transfer process, resulting in high data transmission process costs and is not conducive to implementation. Secondly, the data transmission process based on the above method requires multiple data landing processes, and the data transmission link is long, which increases the risk of network delays. Finally, the above architecture involves many links and the architecture is relatively complex, which is not conducive to the production and troubleshooting links in the actual implementation process. In order to solve the above problems, the first aspect of the embodiment of the present application provides a Kafka cluster-to-cluster data transmission system. For details, please refer to Figure 1 , an embodiment of the Kafka inter-cluster data transmission system provided by the present application includes:
[0050] A first Kafka cluster 101 , a Kafka Mirror service 102 , a first Nginx server 103 , a second Nginx server 104 , and a second Kafka cluster 105 .
[0051] The first Kafka cluster 101, the Kafka Mirror service 102 and the first Nginx server 103 are arranged in the first intranet, that is, the intranet of the enterprise at the transmission starting point. The second Kafka cluster 104 and the second Nginx server 105 are arranged in the second intranet, that is, the intranet of the enterprise at the data transmission end point. The first intranet and the second intranet are different intranets, that is, the data transmission cannot be completed directly between the two intranets. It can be understood that the setting units of the first intranet and the second intranet are not limited to enterprises, but can also be institutions such as schools, scientific research institutions or hospitals that have data sharing and use needs, which are not specifically limited here. In order to ensure the data transmission process between the first Nginx server 103 and the second Nginx server 104, the first Nginx server 103 and the second Nginx server 104 respectively have external network IPs so that data can be transmitted between the two through the public network.
[0052] The first Kafka cluster 101 is used to transmit the first data to the first Nginx server 103 based on the virtual IP. Specifically, the first Kafka cluster is the starting point cluster for data transmission, and the first Kafka cluster can be a Kafka cluster used to manage internal enterprise data within any enterprise. In the actual implementation process, the number of machines in the first Kafka cluster can be set according to demand, which is not limited here. The first Kafka cluster is used to process and store data generated by the enterprise. The specific data types can be determined according to actual conditions, such as order data, payment data, and log data, etc., which are not limited here. In the process of enterprise operation, it is often necessary to synchronize certain data in the first Kafka cluster to another enterprise so that the other enterprise can complete production and operation activities based on these data, such as between the e-commerce platform and the actual merchant. After the consumer places an order on the e-commerce platform, the e-commerce platform needs to forward the corresponding order information to the actual merchant so that the actual merchant can provide goods to the consumer and complete the entire transaction process. For another enterprise, the server used to process its own enterprise data is the second Kafka cluster 105. The first Kafka cluster 101 and the second Kafka cluster 105 are both set up in the intranet of their own enterprise for security needs, but data needs to be transmitted through the public network. Before transmission based on the public network, the first Kafka cluster 101 needs to transmit the data to the first Nginx server 103.
[0053] In this embodiment, the process of the first Kafka cluster transmitting the first data to the first Nginx server based on the virtual IP can be completed through the Kafka Mirror service 102. Kafka Mirror: Kafka Mirror is a Kafka monitoring tool that can monitor Kafka applications in real time, track throughput, events per second, and directly access the log data of your Kafka cluster. KafkaMirror can provide accurate and reliable feedback, which can be used to improve system operation and discover abnormal situations. That is, Kafka Mirror pulls the data in the first Kafka cluster as a consumer, and provides the data to the first Nginx server as a producer. It can be understood that in the actual implementation process, other services that can achieve the same effect can also be used to replace the Kafka Mirror service, which is not limited here.
[0054] A virtual IP address (VIP) is an IP address that is not connected to a specific computer or a network interface card (NIC) in a computer. Data packets are sent to this VIP address, but all data still passes through the real network interface. VIPs are mostly used for connection redundancy; a VIP address may also be available when a computer or NIC fails, and another optional computer or NIC responds to the connection. The virtual IP is used in conjunction with the active-active mode of the Nginx server to maximize the stability and efficiency of data transmission. In this embodiment, the first data can be any type of data, which is not limited here.
[0055] The first Nginx server is used to receive the first data, and send the first data to the second Nginx server based on the secure socket protocol; the second Nginx server is used to receive the first data, and send the first data to the second Kafka cluster;
[0056] Nginx (engine x) is a high-performance HTTP and reverse proxy web server, and also provides IMAP / POP3 / SMTP services. Its source code is released in the form of a BSD-like license, and it is well-known for its stability, rich feature set, simple configuration files, and low system resource consumption. Nginx is a lightweight web server / reverse proxy server and email (IMAP / POP3) proxy server, released under the BSD-like protocol. Its characteristics are small memory usage and strong concurrency. In fact, Nginx's concurrency performance is better than other web servers of the same type.
[0057] Nginx+keepalived dual-machine master-master mode: that is, two load balancing servers are used at the front end, which are the master and backup of each other and are both in active state. At the same time, each is bound to a public network virtual IP to provide load balancing services; when one of them fails, the other takes over the public network virtual IP of the failed server (at this time, the non-faulty machine bears all requests). This solution is economical and very suitable for the current architecture environment.
[0058] The first Nginx server and the second Nginx server complete data transmission based on the public IP address. At the same time, the use of Secure Sockets Layer (SSL) in the transmission process ensures the data security of the public network transmission process, and the active-active mode of the Nginx server ensures the stability and availability of the server, thereby maximizing the feasibility of the data transmission process.
[0059] The second Kafka cluster is used to receive the first data, thereby completing the entire data transmission process. It is worth noting that this solution can also be adaptively adjusted so that data can be transmitted from the second Kafka cluster to the first Kafka cluster. Specifically, the second Kafka Mirror service is used to transmit data from the second Kafka cluster to the second Nginx server. The details are not repeated here.
[0060] To ensure the smooth implementation of data transmission, the entire system also needs to make some adaptive settings, including: the first Kafka cluster and the second Kafka cluster should perform DNS intranet global resolution of the IP and host name to ensure correct address identification and support the data transmission process. The device running the Kafka Mirror service needs to resolve the mapping relationship between the first Nginx server IP address in the intranet and the host name and address of the second Kafka cluster in the opposite computer room. The listening port of the Nginx server must be consistent with the port of the Kafka broker being proxied by Nginx. The Kafkaserver.properties configuration in the first Kafka cluster needs to add the advertised.listeners parameter to specify the address and port exposed to the Nginx proxy. The firewalls of the computer rooms at both ends need to open ports for the Nginx proxy. The above settings further ensure the stable implementation of the data transmission process.
[0061] It can be seen from the above technical scheme that the embodiment of the present application has the following advantages: The present application provides a data transmission system between Kafka clusters, including: a first Kafka cluster, a first Nginx server, a second Kafka cluster and a second Nginx server; the first Kafka cluster is used to transmit the first data to the first Nginx server based on a virtual IP; the first Nginx server is used to receive the first data, and send the first data to the second Nginx server based on a secure socket protocol; the second Nginx server is used to receive the first data, and send the first data to the second Kafka cluster; the second Kafka cluster is used to receive the first data; the first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs. The Kafka inter-cluster data transmission system provided in this application uses the Nginx server for transmission, taking advantage of the high availability of the Nginx server, thereby reducing the number of intermediary servers required to be set up in the transmission link, thereby reducing the data transmission cost. At the same time, the public network transmission process is encrypted through the secure socket protocol, which ensures the security of data transmission and improves the feasibility of the data transmission process between Kafka clusters.
[0062] The above content describes the data transmission system between Kafka clusters. The following describes this solution from the perspective of different devices.
[0063] 1. For the first Kafka cluster.
[0064] The first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, so that the first Nginx server transmits the first data to the second Nginx server based on the secure socket protocol, and the second Nginx server transmits the first data to the second Kafka cluster;
[0065] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0066] In this embodiment, the first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, which can be completed through the Kafka Mirror service. Kafka Mirror: Kafka Mirror is a Kafka monitoring tool that can monitor Kafka applications in real time, track throughput, events per second, and directly access the log data of your Kafka cluster. KafkaMirror can provide accurate and reliable feedback, which can be used to improve the operation of the system and discover abnormal situations. That is, Kafka Mirror pulls the data in the first Kafka cluster as a consumer, and provides the data to the first Nginx server as a producer. A virtual IP address (VIP) is an IP address that is not connected to a specific computer or a network interface card (NIC) in a computer. Data packets are sent to this VIP address, but all data still passes through the real network interface. VIPs are mostly used for connection redundancy; a VIP address may also be available when a computer or NIC fails, and another optional computer or NIC responds to the connection. The virtual IP is used in conjunction with the active-active mode of the Nginx server to maximize the stability and efficiency of data transmission. In this embodiment, the first data can be any type of data and is not limited here.
[0067] Nginx (engine x) is a high-performance HTTP and reverse proxy web server, and also provides IMAP / POP3 / SMTP services. Its source code is released in the form of a BSD-like license, and it is well-known for its stability, rich feature set, simple configuration files, and low system resource consumption. Nginx is a lightweight web server / reverse proxy server and email (IMAP / POP3) proxy server, released under the BSD-like protocol. Its characteristics are small memory usage and strong concurrency. In fact, Nginx's concurrency performance is better than other web servers of the same type.
[0068] Nginx+keepalived dual-machine master-master mode: that is, two load balancing servers are used at the front end, which are the master and backup of each other and are both in active state. At the same time, each is bound to a public network virtual IP to provide load balancing services; when one of them fails, the other takes over the public network virtual IP of the failed server (at this time, the non-faulty machine bears all requests). This solution is economical and very suitable for the current architecture environment.
[0069] To ensure the smooth implementation of data transmission, the entire system also needs to make some adaptive settings, including: the first Kafka cluster and the second Kafka cluster should perform DNS intranet global resolution of the IP and host name to ensure correct address identification and support the data transmission process. The device running the Kafka Mirror service needs to resolve the mapping relationship between the first Nginx server IP address in the intranet and the host name and address of the second Kafka cluster in the opposite computer room. The listening port of the Nginx server must be consistent with the port of the Kafka broker being proxied by Nginx. The Kafkaserver.properties configuration in the first Kafka cluster needs to add the advertised.listeners parameter to specify the address and port exposed to the Nginx proxy. The firewalls of the computer rooms at both ends need to open ports for the Nginx proxy. The above settings further ensure the stable implementation of the data transmission process.
[0070] It can be seen from the above technical scheme that the embodiment of the present application has the following advantages: the present application provides a method for data transmission between Kafka clusters, the method is applied to the first Kafka cluster, including: the first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, so that the first Nginx server transmits the first data to the second Nginx server based on the secure socket protocol, and the second Nginx server transmits the first data to the second Kafka cluster; the first Kafka cluster and the first Nginx server are set in the first intranet, the second Kafka cluster and the second Nginx server are set in the second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server have external network IPs respectively. Based on this scheme, it can be seen that the method for data transmission between Kafka clusters provided by the present application uses Nginx for transmission, and utilizes the high availability characteristics of the Nginx server, thereby reducing the number of intermediary servers required to be set in the transmission link, thereby reducing the data transmission cost, and at the same time, the public network transmission process is encrypted by the secure socket protocol, which ensures the security of data transmission and improves the feasibility of the data transmission process between Kafka clusters.
[0071] 2. For the first Nginx server.
[0072] The first Nginx server receives first data, where the first data is transmitted to the first Nginx server by the first Kafka cluster based on the virtual IP;
[0073] The first Nginx server sends the first data to the second Nginx server based on the secure socket protocol, so that the second Nginx server transmits the first data to the second Kafka cluster;
[0074] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0075] In this embodiment, the process of the first Kafka cluster transmitting the first data to the first Nginx server based on the virtual IP can be completed through the Kafka Mirror service. The first Nginx server and the first Kafka cluster are set up in the same company intranet, and the first Nginx server has an external network IP address. The first Nginx server transmits the first data to the second Nginx server through the public network so that the second Nginx server can execute the subsequent process. The specific process can be referred to the aforementioned Figure 1 The contents described in the corresponding embodiments are not repeated here.
[0076] It can be seen from the above technical scheme that the embodiment of the present application has the following advantages: The present application provides a method for data transmission between Kafka clusters, which is applied to a first Nginx server, including: the first Nginx server receives first data, and the first data is transmitted to the first Nginx server by the first Kafka cluster based on a virtual IP; the first Nginx server sends the first data to the second Nginx server based on a secure socket protocol, so that the second Nginx server transmits the first data to the second Kafka cluster; the first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0077] Based on this solution, it can be seen that the Kafka inter-cluster data transmission method provided in this application uses Nginx for transmission, taking advantage of the high availability of the Nginx server, thereby reducing the number of intermediary servers required to be set up in the transmission link, thereby reducing the data transmission cost. At the same time, the public network transmission process is encrypted through the secure socket protocol, which ensures the security of data transmission and improves the feasibility of the data transmission process between Kafka clusters.
[0078] 3. For the second Nginx server.
[0079] The second Nginx server receives the first data, where the first data is transmitted to the first Nginx server based on the virtual IP by the first Kafka cluster, and then sent to the second Nginx server based on the secure socket protocol by the first Nginx server;
[0080] The second Nginx server sends the first data to a second Kafka cluster;
[0081] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0082] The specific implementation of each step in this embodiment can refer to the aforementioned Figure 1 The contents described in the corresponding embodiments are not repeated here.
[0083] Based on this solution, it can be seen that the Kafka inter-cluster data transmission method provided in this application uses Nginx for transmission, taking advantage of the high availability of the Nginx server, thereby reducing the number of intermediary servers required to be set up in the transmission link, thereby reducing the data transmission cost. At the same time, the public network transmission process is encrypted through the secure socket protocol, which ensures the security of data transmission and improves the feasibility of the data transmission process between Kafka clusters.
[0084] 4. For the second Kafka cluster.
[0085] The second kafka cluster receives the first data, where the first data is transmitted from the first Kafka cluster to the first Nginx server based on the virtual IP, and then the first Nginx server sends the first data to the second Nginx server based on the secure socket protocol, and then the second Nginx server sends the first data to the second kafka cluster;
[0086] The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have external network IPs.
[0087] The specific implementation of each step in this embodiment can refer to the aforementioned Figure 1 The contents described in the corresponding embodiments are not repeated here.
[0088] Based on this solution, it can be seen that the Kafka inter-cluster data transmission method provided in this application uses Nginx for transmission, taking advantage of the high availability of the Nginx server, thereby reducing the number of intermediary servers required to be set up in the transmission link, thereby reducing the data transmission cost. At the same time, the public network transmission process is encrypted through the secure socket protocol, which ensures the security of data transmission and improves the feasibility of the data transmission process between Kafka clusters.
[0089] The above content describes the data transmission system and method between Kafka clusters provided by this application. To support the implementation of the above embodiments, this application also provides corresponding devices to support the implementation of the above methods and systems. Please refer to Figure 2 , an embodiment of the Kafka cluster device provided in this application includes:
[0090] Figure 2 It is a structural diagram of a Kafka cluster device provided in an embodiment of the present application. The Kafka cluster device may include one or more servers 200. The server 200 may include one or more central processing units (CPU) 201 and a memory 205. The memory 205 stores one or more applications or data.
[0091] The memory 205 may be a volatile storage or a persistent storage. The program stored in the memory 205 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processor 201 may be configured to communicate with the memory 205 and execute a series of instruction operations in the memory 205 on the server 200.
[0092] The server 200 may also include one or more power supplies 202, one or more wired or wireless network interfaces 203, one or more input and output interfaces 204, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0093] The CPU 201 can execute the aforementioned Figure 1 The operations performed by the first Kafka cluster in the illustrated embodiment will not be described in detail here.
[0094] Figure 3It is a structural diagram of an Nginx server device provided in an embodiment of the present application. The server 300 may include one or more central processing units (CPU) 301 and a memory 305. The memory 305 stores one or more application programs or data.
[0095] The memory 305 may be a volatile storage or a persistent storage. The program stored in the memory 305 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processor 301 may be configured to communicate with the memory 305 and execute a series of instruction operations in the memory 305 on the server 300.
[0096] The server 300 may also include one or more power supplies 302, one or more wired or wireless network interfaces 303, one or more input and output interfaces 304, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0097] The CPU 301 can execute the aforementioned Figure 1 The operations performed by the first Nginx server in the illustrated embodiment will not be described in detail here.
[0098] Figure 4 It is a structural diagram of another Nginx server device provided in an embodiment of the present application. The server 400 may include one or more central processing units (CPU) 401 and a memory 405. The memory 405 stores one or more application programs or data.
[0099] The memory 405 may be a volatile storage or a persistent storage. The program stored in the memory 405 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processor 401 may be configured to communicate with the memory 405 and execute a series of instruction operations in the memory 405 on the server 400.
[0100] The server 400 may also include one or more power supplies 402, one or more wired or wireless network interfaces 403, one or more input and output interfaces 404, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0101] The CPU 401 can execute the aforementioned Figure 1 The operations performed by the second Nginx server in the illustrated embodiment will not be described in detail here.
[0102] Figure 5 It is a structural diagram of another Kafka cluster device provided in an embodiment of the present application. The Kafka cluster device may include one or more servers 500. The server 500 may include one or more central processing units (CPU) 501 and a memory 505. The memory 505 stores one or more applications or data.
[0103] The memory 505 may be a volatile storage or a persistent storage. The program stored in the memory 505 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processor 501 may be configured to communicate with the memory 505 and execute a series of instruction operations in the memory 505 on the server 500.
[0104] The server 500 may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input and output interfaces 504, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0105] The CPU 501 can execute the aforementioned Figure 1 The operations performed by the second Kafka cluster in the illustrated embodiment will not be described in detail here.
[0106] An embodiment of the present application also provides a computer storage medium, which is used to store computer software instructions used for the above-mentioned Kafka inter-cluster data transmission method, and includes a program designed for executing the Kafka inter-cluster data transmission method.
[0107] The method for transmitting data between Kafka clusters may be the method for transmitting data between Kafka clusters described in the aforementioned embodiment.
[0108] An embodiment of the present application also provides a computer program product, which includes computer software instructions, and the computer software instructions can be loaded by a processor to implement the process of the Kafka cluster data transmission method of any one of the above embodiments.
[0109] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the equivalent transformation of the circuit, the division of the unit, is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0110] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0111] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0112] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modification, equivalent substitution or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for transmitting data between Kafka clusters, characterized in that: The method is applied to a first Kafka cluster, comprising: The first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, so that the first Nginx server transmits the first data to the second Nginx server based on the secure socket protocol, and the second Nginx server transmits the first data to the second Kafka cluster; The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have an external network IP; The first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, including: The first Kafka cluster transmits the first data to a Kafka Mirror service, so that the KafkaMirror service transmits the first data to a first Nginx server.
2. The method for transmitting data between Kafka clusters according to claim 1, characterized in that: Both the first Nginx server and the second Nginx server are in active-active mode.
3. A method for transmitting data between Kafka clusters, characterized in that: The method is applied to a first Nginx server, comprising: The first Nginx server receives first data, where the first data is transmitted to the first Nginx server by the first Kafka cluster based on the virtual IP; The first Nginx server sends the first data to the second Nginx server based on the secure socket protocol, so that the second Nginx server transmits the first data to the second Kafka cluster; The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have an external network IP; The first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, including: The first Kafka cluster transmits the first data to a Kafka Mirror service, so that the KafkaMirror service transmits the first data to a first Nginx server.
4. A method for transmitting data between Kafka clusters, characterized in that: The method is applied to a second Nginx server, comprising: The second Nginx server receives the first data, where the first data is transmitted from the first Kafka cluster to the first Nginx server based on the virtual IP, and the first Nginx server sends the first data to the second Nginx server based on the secure socket protocol; The second Nginx server sends the first data to a second Kafka cluster; The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have an external network IP; The first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, including: The first Kafka cluster transmits the first data to a Kafka Mirror service, so that the KafkaMirror service transmits the first data to a first Nginx server.
5. A method for transmitting data between Kafka clusters, characterized in that: The method is applied to a second Kafka cluster; The second Kafka cluster receives the first data, where the first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, the first Nginx server sends the first data to the second Nginx server based on the secure socket protocol, and the second Nginx server sends the first data to the second Kafka cluster; The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have an external network IP; The first Kafka cluster transmits the first data to the first Nginx server based on the virtual IP, including: The first Kafka cluster transmits the first data to a Kafka Mirror service, so that the KafkaMirror service transmits the first data to a first Nginx server.
6. A data transmission system between Kafka clusters, characterized in that: include: The first Kafka cluster, the first Nginx server, the second Kafka cluster and the second Nginx server; The first Kafka cluster is used to transmit the first data to the first Nginx server based on the virtual IP; The first Nginx server is used to receive the first data, and send the first data to the second Nginx server based on the secure socket protocol; The second Nginx server is used to receive the first data and send the first data to the second Kafka cluster; The second Kafka cluster is used to receive the first data; The first Kafka cluster and the first Nginx server are set in a first intranet, the second Kafka cluster and the second Nginx server are set in a second intranet, the first intranet and the second intranet are different intranets, and the first Nginx server and the second Nginx server respectively have an external network IP; The first Kafka cluster is specifically used for: the first Kafka cluster transmits the first data to the Kafka Mirror service, so that the Kafka Mirror service transmits the first data to the first Nginx server.
7. A Kafka cluster device, characterized in that: include: CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply; The memory is a short-term storage memory or a persistent storage memory; The central processor is configured to communicate with the memory and execute instruction operations in the memory on the Kafka cluster device to perform the method according to any one of claims 1 to 2.
8. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 5.
