A view library cluster
By dividing the view library cluster into multiple virtual clusters and using virtual IP addresses, the performance bottleneck problem caused by single-point IP data reception in high-level view library clusters is solved, the receiving capability of multiple data portals is achieved, and hardware requirements are reduced.
Patent Information
- Application Number
- CN202011149177.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-23
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-10-23
AI Technical Summary
At a high level, the existing view library cluster causes a performance bottleneck due to a single IP address receiving data, and adding a DNS server increases application costs.
By dividing the view library cluster into multiple virtual clusters, each virtual cluster provides a virtual IP address, and the next-level view library cluster sends data to the virtual cluster through the virtual IP address, so that a cluster with a unique view library ID can pass Multiple virtual IP addresses receive data, reducing performance pressure and eliminating the need to add hardware.
It effectively reduces the performance pressure of the view library cluster, improves data reception capabilities, avoids single-point performance bottlenecks, and reduces hardware requirements.
Smart Images

Figure CN114513490B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of view libraries, and in particular to a view library cluster. Background Art
[0002] The full name of the view library is video image information database, which is a set of data information database for maintaining security based on the GA / T1400 protocol. The deployment mode is from the district and county level to the national level, and the data is gathered upward step by step.
[0003] If there are about a thousand acquisition devices at the district or county level, the view library needs a small cluster of three to five servers. If it is at the city, provincial or higher level, the view library may need a large-scale cluster consisting of dozens, hundreds or even more servers. Since each level of the view library has its own unique number, it can only guarantee the uniqueness of the cluster and cannot be split. At this time, the entire cluster provides an IP address for data entry, which obviously cannot meet the performance requirements. If a private domain name is required, then a DNS server will undoubtedly need to be added, which will increase the application cost. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a view library cluster that overcomes the above problems or at least partially solves the above problems.
[0005] According to a first aspect of an embodiment of the present invention, a view library cluster is provided, wherein the view library cluster includes a plurality of virtual clusters, each virtual cluster includes at least a preset number of physical nodes; the view library cluster has a unique view library ID;
[0006] Each virtual cluster provides a virtual IP address, each of the virtual IP addresses corresponds to at least one next-level view library cluster of the view library cluster, and the next-level view library cluster sends data to the virtual cluster corresponding to the virtual IP address through the corresponding virtual IP address.
[0007] The view library cluster provided by the embodiment of the present invention includes multiple virtual clusters through the view library cluster, each virtual cluster includes at least a preset number of physical nodes, each virtual cluster provides a virtual IP address, and each virtual IP address corresponds to at least one next-level view library cluster of the view library cluster, so that the next-level view library cluster sends data to the virtual cluster corresponding to the virtual IP address through the corresponding virtual IP address, that is, the next-level view library cluster sends data to the view library cluster through the virtual IP address, so that a view library cluster with a unique view library ID can receive data from the next-level view library cluster through multiple virtual IP addresses, which solves the problem of using one IP address to receive data, reduces the performance pressure of the view library cluster, and does not require additional hardware.
[0008] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the following detailed description of the preferred embodiment.The drawings are only for the purpose of illustrating the preferred embodiments and are not to be construed as limiting the invention.
[0010] Figure 1 It is a view library deployment topology diagram in the prior art;
[0011] Figure 2 is a structural schematic diagram of a view library cluster provided by an embodiment of the present invention;
[0012] Figure 3 is a schematic diagram of the topological structure of view library deployment in an embodiment of the present invention;
[0013] Figure 4 is a schematic diagram of a view library cluster providing multiple data entries in an embodiment of the present invention;
[0014] Figure 5 This is an example diagram of a view library cluster in an embodiment of the present invention. DETAILED DESCRIPTION
[0015] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0016] Figure 1 This is a view library deployment topology diagram in the prior art, such as Figure 1 As shown, each view library cluster at each level from the provincial level to the district and county level has an independent and unique view library identifier. In the prior art, each view library cluster only provides an IP address for data storage. The next-level view library cluster sends data to the current view library cluster through the IP address provided by the current view library cluster, that is, the current view library cluster receives data from all view library clusters at the next level through one IP address. When the number of next-level view library clusters corresponding to the current view library cluster is large, it will approach the performance limit of the current view library cluster, that is, a performance bottleneck will occur. The embodiment of the present invention provides the following solution to reduce the performance pressure of the view library cluster.
[0017] Figure 2 is a schematic diagram of the structure of a view library cluster provided by an embodiment of the present invention, such as Figure 1 As shown, the view library cluster 200 includes multiple virtual clusters 210, each virtual cluster 210 includes at least a preset number of physical nodes 211; the view library cluster has a unique view library ID;
[0018] Each virtual cluster 210 provides a virtual IP address, each of the virtual IP addresses corresponds to at least one lower-level view library cluster of the view library cluster 210, and the lower-level view library cluster sends data to the virtual cluster 210 corresponding to the virtual IP address through the corresponding virtual IP address.
[0019] Multiple virtual clusters 210 can be deployed in a view library cluster 200, and the view library cluster 200 has a unique view library ID. Each virtual cluster 210 can include at least a preset number of physical nodes and provide a virtual IP address. The next-level view library cluster of the current view library cluster sends data to the virtual cluster of the current view library cluster through the corresponding virtual IP address, that is, each virtual cluster can receive data from different view library clusters in the next level, so that a view library cluster with a unique view library ID can provide multiple data entries. The preset number is greater than or equal to 3 to ensure that other physical nodes can continue to provide services when a physical node fails, so as to achieve high availability of the view library cluster.
[0020] Figure 3 is a schematic diagram of the topological structure of the view library deployment in an embodiment of the present invention, such as Figure 3As shown, the view library topology includes a first-level view library cluster (for example, a provincial view library cluster), a second-level view library cluster (for example, a municipal view library cluster) and a third-level view library cluster (for example, a district or county view library cluster). The first-level view library cluster provides three virtual IP (VIP) addresses, VIP1, VIP2 and VIP3. Each second-level view library cluster uses a virtual IP address of the first-level view library cluster to send data to the first-level view library cluster. Each second-level view library cluster provides two virtual IP addresses. Each second-level view library cluster corresponds to two third-level view library clusters. Each third-level view library cluster uses the virtual IP address provided by the corresponding second-level view library cluster to send data to the corresponding second-level view library cluster. Figure 3 As shown, the second-level view library cluster 1 uses the virtual IP address VIP1 to send data to the first-level view library cluster, the second-level view library cluster 2 uses the virtual IP address VIP2 to send data to the first-level view library cluster, and the second-level view library cluster 3 uses the virtual IP address VIP3 to send data to the first-level view library cluster; the third-level view library cluster 1 in the next level of the second-level view library cluster 1 uses the virtual IP address VIP1(1) to send data to the second-level view library cluster 1, and the third-level view library cluster 2 in the next level of the second-level view library cluster 1 uses the virtual IP address VIP1(2) to send data to the second-level view library cluster 1 , the third-level view library cluster 1 in the next level of the second-level view library cluster 2 uses the virtual IP address VIP2(1) to send data to the second-level view library cluster 2, the third-level view library cluster 2 in the next level of the second-level view library cluster 2 uses the virtual IP address VIP2(2) to send data to the second-level view library cluster 2, the third-level view library cluster 1 in the next level of the second-level view library cluster 3 uses the virtual IP address VIP3(1) to send data to the second-level view library cluster 3, and the third-level view library cluster 2 in the next level of the second-level view library cluster 2 uses the virtual IP address VIP3(2) to send data to the second-level view library cluster 3. When each level of view library cluster pushes data to the next level of view library cluster, it can obtain a separate virtual IP address to use, so that the problem of all data being gathered at one point can be dispersed by diversion, which can reduce the performance pressure of a single point. Each level of view library cluster will have an independent and unique view library ID to ensure the uniqueness of the view library cluster. The view library ID of the entire view library cluster is unique and is not split according to the split of the virtual cluster. Therefore, multiple virtual data entrances are added to the view library cluster through multiple virtual IP addresses, so that a view library cluster can have multiple data entrances without the upper and lower view library clusters being aware of it.
[0021] It should be noted that Figure 3This is just an example. In actual applications, more levels of view library clusters can be deployed. The number of next-level view library clusters corresponding to each view library cluster is unlimited, and the number of virtual IP addresses provided by each view library cluster is also unlimited.
[0022] In one embodiment of the present invention, a keepalived service and an nginx service are respectively deployed on each physical node of all physical nodes in the view library cluster.
[0023] Figure 4 FIG. 1 is a schematic diagram of a view library cluster providing multiple data entries in an embodiment of the present invention. Figure 4 As shown in the figure, keepalived service and nginx service are deployed on all physical nodes in the view library cluster, and a virtual cluster is formed by keepalived+nginx, so that the relatively large view library cluster is split into multiple virtual clusters. The virtual IP address technology provided by keepalived ensures the high availability of the virtual cluster, and nginx is used to proxy all physical nodes in the view library cluster to ensure load balancing. Each virtual cluster has an independent virtual IP address. When the next-level view library cluster pushes data upward, it uses the virtual IP address of the current view library cluster to push it, and the view library ID of the current view library cluster is still the original view library ID, which ensures the uniqueness of the view library cluster and the corresponding view library ID.
[0024] Since nginx service and keepalived service are deployed on each physical node in the view library cluster, each nginx node can proxy all API gateway (api_gateway) ports in the entire view library cluster, which can ensure data load balancing. That is, if one or more virtual IP addresses (VIP) have no data access, it can also ensure that data is loaded to all physical nodes in the entire view library cluster.
[0025] In one embodiment of the present invention, one physical node in each virtual cluster is the master node in the virtual cluster, and the other physical nodes are standby nodes in the virtual cluster; the master node sends heartbeat information to the standby node, and if the standby node does not receive the heartbeat information sent by the master node, the standby node switches to the master node in the virtual cluster. The master node and the standby node in the virtual cluster start the same service, and the master node sends heartbeat information to the standby node to maintain its own available state. When the standby node does not receive the heartbeat information sent by the master node, it switches itself to the master node, thereby achieving high availability of the view library cluster.
[0026] In one embodiment of the present invention, the nginx service deployed on any physical node in the view library cluster proxies the API gateway ports of all physical nodes in the view library cluster; when a physical node in the virtual cluster receives data sent by the next-level view library cluster, the received data is load balanced among all physical nodes in the view library cluster. By deploying the nginx service on the physical node, when a physical node in the virtual cluster receives data sent by the next-level view library cluster, the received data is load balanced among all physical nodes in the view library cluster. For example, load balancing can be performed by polling or hashing to determine the physical node currently storing the data, and the data is stored in the determined physical node. Figure 5 is an example diagram of a view library cluster in an embodiment of the present invention. Figure 5 Taking the view library cluster shown as an example, the current view library cluster includes two virtual clusters. The view library identifier (ID) of the current view library cluster is 1111111111110000000001, the virtual IP address (VIP) of the first virtual cluster is 1.1.1.1, corresponding to the view library cluster 1 of the next level, the virtual IP address of the second virtual cluster is 1.1.1.2, corresponding to the view library cluster 2 of the next level, the first virtual cluster includes physical nodes 1, 2 and 3, and the second virtual cluster includes physical nodes 4, 5 and 6. If at a certain moment, view library cluster 1 has no data to send to the current view library cluster, and view library cluster 2 has a lot of data to send to the current view library cluster, then the physical nodes that receive the data of view library cluster 2 (i.e., the physical nodes in the second virtual cluster) perform load balancing on physical nodes 1, 2, 3, 4, 5 and 6, and store the data in the determined physical nodes, thereby achieving load balancing and avoiding the problem that physical nodes 1-3 have less load and physical nodes 4-6 have more load.
[0027] The view library cluster provided by the embodiment of the present invention includes multiple virtual clusters through the view library cluster, each virtual cluster includes at least a preset number of physical nodes, each virtual cluster provides a virtual IP address, and each virtual IP address corresponds to at least one next-level view library cluster of the view library cluster, so that the next-level view library cluster sends data to the virtual cluster corresponding to the virtual IP address through the corresponding virtual IP address, that is, the next-level view library cluster sends data to the view library cluster through the virtual IP address, so that a view library cluster with a unique view library ID can receive data from the next-level view library cluster through multiple virtual IP addresses, which solves the problem of using one IP address to receive data, reduces the performance pressure of the view library cluster, and does not require additional hardware.
[0028] In one embodiment of the present invention, the physical nodes in the view library cluster are divided into multiple virtual clusters in the following manner: the electronic device determines the actual number of virtual clusters to be deployed in the view library cluster and the actual number of physical nodes corresponding to each actual virtual cluster according to the expected number of virtual clusters and the number of physical nodes in the view library cluster.
[0029] The electronic device may be a device such as an orchestration system of a view library cluster. The orchestration system is a device that orchestrates the view library cluster to be deployed and outputs an orchestration file before the view library cluster is deployed.
[0030] Before dividing the view library cluster into multiple virtual clusters, it is necessary to determine the actual number of virtual clusters to be divided in the view library cluster and the actual number of physical nodes corresponding to each actual virtual cluster, and then the actual virtual clusters can be divided in the view library cluster according to the determined actual number of virtual clusters and the actual number of physical nodes corresponding to each actual virtual cluster. The actual number of virtual clusters and the actual number of physical nodes corresponding to each actual virtual cluster are determined by electronic devices, so that the actual number of virtual clusters and the corresponding number of physical nodes are determined according to demand.
[0031] In one embodiment of the present invention, determining the number of actual virtual clusters to be deployed in the view library cluster and the number of actual physical nodes corresponding to each actual virtual cluster by the electronic device includes:
[0032] Acquiring, by means of the electronic device, the number of physical nodes in the view library cluster and the number of virtual clusters expected to be allocated, and using the number of virtual clusters expected to be allocated as the expected number of virtual clusters;
[0033] Determining, by the electronic device, the number of virtual clusters that can actually be allocated according to the number of physical nodes in the view library cluster, the expected number of virtual clusters and the preset number as the actual number of virtual clusters;
[0034] The electronic device determines the number of physical nodes in each actual virtual cluster according to the number of physical nodes in the view library cluster and the number of actual virtual clusters.
[0035] The preset number is the number of physical nodes at least included in a pre-set virtual cluster. The expected number of virtual clusters can be given according to the number of view library clusters at the next level. For example, if there are 5 view library clusters at the next level, the expected number of virtual clusters can be 5, or other values.
[0036] Before dividing the view library cluster into multiple virtual clusters, the number of physical nodes in the view library cluster and the number of virtual clusters expected to be allocated can be input into the electronic device, and the electronic device calculates the actual number of virtual clusters and the number of physical nodes in each actual virtual cluster. After obtaining the number of physical nodes in the view library cluster and the expected number of virtual clusters, the electronic device first determines the number of virtual clusters that can be actually allocated. It can first verify whether the number of physical nodes in each expected virtual cluster is greater than or equal to the preset number under the expected number of virtual clusters. When the number of physical nodes in each expected virtual cluster is greater than or equal to the preset number, the expected number of virtual clusters is used as the actual number of virtual clusters. When the number of physical nodes in each expected virtual cluster is less than the preset number, the preset number can be used as the minimum number of physical nodes in each actual virtual cluster, so that the quotient of the number of physical nodes in the view library cluster and the preset number (the quotient is an integer obtained by rounding down) can be used as the actual number of virtual clusters. After determining the actual number of virtual clusters, the electronic device can determine the number of physical nodes of each actual virtual cluster according to the number of physical nodes in the view library cluster and the actual number of virtual clusters, and can use the quotient of the number of physical nodes in the view library cluster and the number of actual virtual clusters (the quotient is an integer obtained by rounding down) as the minimum number of physical nodes in the actual virtual cluster, and calculate the remainder of the number of physical nodes in the view library cluster and the number of actual virtual clusters, select the remainder actual virtual clusters from all actual virtual clusters, determine that the number of physical nodes of the remainder virtual clusters is the sum of the minimum number of physical nodes and 1, and determine that the number of physical nodes of other virtual clusters is the minimum number of physical nodes.
[0037] In one embodiment of the present invention, determining, by the electronic device according to the number of physical nodes in the view library cluster, the expected number of virtual clusters and the preset number, the number of virtual clusters that can actually be allocated as the actual number of virtual clusters includes:
[0038] Determining, by the electronic device, the average number of physical nodes of each expected virtual cluster under the expected number of virtual clusters according to the number of physical nodes in the view library cluster and the expected number of virtual clusters, as the expected average number of nodes;
[0039] If the expected average number of nodes of each expected virtual cluster is greater than or equal to the preset number, taking the expected number of virtual clusters as the actual number of virtual clusters;
[0040] If the expected average number of nodes of each expected virtual cluster is less than the preset number, the quotient of the number of physical nodes and the preset number is used as the actual number of virtual clusters.
[0041] First, the quotient of the number of physical nodes in the view library cluster and the expected number of virtual clusters is calculated, and the integer is rounded down. The result is used as the average number of physical nodes of each expected virtual cluster under the expected number of virtual clusters, and the average number of physical nodes is used as the expected average number of nodes. If the expected average number of nodes of each expected virtual cluster is greater than or equal to the preset number, it means that the physical nodes in the view library cluster can actually form virtual clusters of the expected number of virtual clusters, so the expected number of virtual clusters is used as the actual number of virtual clusters, and the expected virtual cluster is used as the actual virtual cluster; if the expected average number of nodes of each expected virtual cluster is less than the preset number, it means that the physical nodes in the view library cluster cannot form virtual clusters of the expected number of virtual clusters when the number of physical nodes in each virtual cluster is at least the preset number. At this time, it is necessary to recalculate the actual number of virtual clusters while ensuring that the number of physical nodes in each actual virtual cluster is at least the preset number, that is, calculate the quotient of the number of physical nodes in the view library cluster and the preset number, and round down to an integer, and the result is used as the actual number of virtual clusters. When determining the actual number of virtual clusters, by ensuring that the number of physical nodes in each virtual cluster is at least the preset number, the high availability of the deployed view library cluster can be guaranteed.
[0042] In one embodiment of the present invention, determining the number of physical nodes of each actual virtual cluster by the electronic device according to the number of physical nodes in the view library cluster and the number of actual virtual clusters further includes:
[0043] Determine, by the electronic device, the average number of physical nodes in each actual virtual cluster according to the number of physical nodes in the view library cluster and the number of actual virtual clusters, and round down the average number of physical nodes as the actual average number of nodes;
[0044] The electronic device calculates the remainder of the number of physical nodes in the view library cluster with respect to the actual number of virtual clusters to obtain a remainder, and determines that the number of physical nodes of the remainder actual virtual clusters in the actual number of virtual clusters is the sum of the actual average number of nodes and 1, and the number of physical nodes of other actual virtual clusters is the actual average number of nodes.
[0045] When determining the number of physical nodes of each actual virtual cluster, the electronic device can calculate the quotient of the number of physical nodes in the view library cluster and the number of actual virtual clusters, and round down to an integer, and use the result as the actual average number of nodes. Then, the number of physical nodes in the view library cluster is modulo the number of actual virtual clusters to obtain the remainder, thereby selecting the actual virtual clusters of the remainder from the actual number of virtual clusters, determining the number of physical nodes of these actual virtual clusters as the sum of the actual average number of nodes and 1, and the number of physical nodes of other actual virtual clusters as the actual average number of nodes, and when the remainder is 1, the number of physical nodes of each actual virtual cluster is the actual average number of nodes. Through such allocation, a relatively balanced number of physical nodes can be allocated to each virtual cluster.
[0046] When determining the number of physical nodes of each actual virtual cluster, there may be other determination methods. One method may be: if the expected average number of nodes of each expected virtual cluster is greater than or equal to the preset number, the electronic device performs a remainder calculation on the number of physical nodes and the number of actual virtual clusters to obtain a first remainder, and determines that the number of physical nodes of the first remainder actual virtual clusters in the actual number of virtual clusters is the sum of the expected average number of nodes and 1, and the number of physical nodes of other actual virtual clusters is the expected average number of nodes; if the expected average number of nodes of each expected virtual cluster is less than the preset number, when the actual number of virtual clusters is greater than 1 and less than the preset number, the average number of physical nodes in each actual virtual cluster is determined according to the number of physical nodes in the view library cluster and the number of actual virtual clusters as the actual average number of nodes, the number of physical nodes is performed a remainder calculation on the number of actual virtual clusters to obtain a second remainder, and determines that the number of physical nodes of the second remainder actual virtual clusters in the actual number of virtual clusters is the sum of the actual average number of nodes and 1, and the number of physical nodes of other actual virtual clusters is the actual average number of nodes. For the case where the preset number is 3, another determination method may be: if the expected average number of nodes of each expected virtual cluster is greater than or equal to the preset number, the electronic device performs a remainder calculation on the number of physical nodes with the actual number of virtual clusters to obtain a first remainder, and determines that the number of physical nodes of the first remainder actual virtual clusters in the actual number of virtual clusters is the sum of the expected average number of nodes and 1, and the number of physical nodes of other actual virtual clusters is the expected average number of nodes; if the expected average number of nodes of each expected virtual cluster is less than the preset number, when the actual number of virtual clusters is greater than 1 and less than the preset number, the electronic device performs a remainder calculation on the number of physical nodes with the preset number to obtain a second remainder, and determines that the number of physical nodes of the second remainder virtual clusters in the actual number of virtual clusters is the sum of the preset number and 1, and the number of physical nodes of other virtual clusters is the preset number; if the expected average number of nodes of each expected virtual cluster is less than the preset number, when the actual number of virtual clusters is 1, the number of physical nodes of the actual virtual cluster is the number of physical nodes in the view library cluster.
[0047] Wherein, for the case where the preset number is 3, when the expected average number of nodes in each expected virtual cluster is greater than or equal to the preset number, the number of physical nodes in each actual virtual cluster may be determined according to the following formula:
[0048]
[0049] Where N is the number of physical nodes in the view library cluster, X is the number of actual virtual clusters, is the expected average number of nodes, A1, A2...A X They are the number of physical nodes that can be allocated to each actual virtual cluster.
[0050] For the case where the preset number is 3, when the expected average number of nodes in each expected virtual cluster is less than the preset number, when the actual number of virtual clusters X=1, such as 3 physical nodes, 4 physical nodes or 5 physical nodes, then the allocation at this time is only one actual virtual cluster, and all physical nodes are in this cluster. The calculation formula is:
[0051] A1=(N%3)+3
[0052] Or: A1=N, where N is the number of physical nodes in the view library cluster, and A1 is the number of physical nodes in the actual virtual cluster.
[0053] For the case where the preset number is 3, when the expected average number of nodes in each expected virtual cluster is less than the preset number, when the actual number of virtual clusters X>1, the number of physical nodes in each actual virtual cluster can be determined according to the following formula:
[0054]
[0055] Where N is the number of physical nodes in the view library cluster, X is the number of actual virtual clusters, A1, A2...A X They are the number of physical nodes in each actual virtual cluster.
[0056] For example, there are 37 devices in the view library cluster, that is, there are 37 physical nodes, and it is expected to deploy 12 virtual clusters, that is, the expected number of virtual clusters is 12, and the preset number is 3. Then, the expected average number of nodes can be calculated first in the above way. The number of physical nodes in each virtual cluster is at least 3, so the actual number of virtual clusters is determined to be 12. Then the number of physical nodes in each actual virtual cluster is calculated. The remainder of 37 over 12 is 1, so A1=4, A2A3........A 11 A 12 =3.
[0057] For example, there are 28 devices in the view library cluster, that is, there are 28 physical nodes, and it is expected to deploy 10 virtual clusters, that is, the expected number of virtual clusters is 10, and the preset number is 3. Then, the expected average number of nodes can be calculated first in the above way. The number of physical nodes in each virtual cluster is not at least 3. The number of virtual clusters needs to be adjusted, that is, the actual number of virtual clusters is determined to be X = 28 / 3 = 9. Then the number of physical nodes in each actual virtual cluster is calculated. The remainder of 28 over 3 is 1, so A1 = 4, A2A3........A 11 A 12 = 3. If the number of virtual clusters is expected to be the same as the number of next-level view library clusters, that is, the number of next-level view library clusters is 10 and the number of virtual clusters is 9, then two of the next-level view library clusters can share one virtual IP address.
[0058] For example, there are 5 devices in the view library cluster, that is, there are 5 physical nodes, and it is expected to deploy 7 virtual clusters, that is, the expected number of virtual clusters is 7 and the preset number is 3. Then, the expected average number of nodes can be calculated first in the above way. The requirement that the number of physical nodes in each virtual cluster is at least 3 is not met, and the number of virtual clusters needs to be adjusted, that is, the actual number of virtual clusters is determined to be X=5 / 3=1, and then the number of physical nodes in each actual virtual cluster is calculated. Since X=1, A1=N=5.
[0059] By determining the actual number of virtual clusters and the actual number of physical nodes in the virtual clusters in the above manner, relatively balanced allocation of physical nodes can be performed while ensuring that each virtual cluster includes at least a preset number of physical nodes.
[0060] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0061] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0062] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0063] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0064] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0065] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0066] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal 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, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including a..." do not exclude the presence of other identical elements in the process, method, article or terminal device including the elements.
[0067] The view library cluster provided by the present invention is introduced in detail above. The principle and implementation mode of the present invention are explained in this article by using specific examples. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A view library cluster, characterized in that: The view library cluster includes a plurality of virtual clusters, each virtual cluster includes at least a preset number of physical nodes; The view library cluster has a unique view library ID; Each virtual cluster provides a virtual IP address, each of the virtual IP addresses corresponds to at least one next-level view library cluster of the view library cluster, and the next-level view library cluster sends data to the virtual cluster corresponding to the virtual IP address through the corresponding virtual IP address.
2. The view library cluster according to claim 1, characterized in that: The keepalived service and the nginx service are respectively deployed on each physical node of all physical nodes in the view library cluster.
3. The view library cluster according to claim 1 or 2, characterized in that: One physical node in each virtual cluster is a master node in the virtual cluster, and the other physical nodes are standby nodes in the virtual cluster; The master node sends heartbeat information to the standby node. If the standby node does not receive the heartbeat information sent by the master node, the standby node switches to the master node in the virtual cluster.
4. The view library cluster according to any one of claims 1 to 3, characterized in that: The nginx service deployed on any physical node in the view library cluster proxies the API gateway ports of all physical nodes in the view library cluster; When a physical node in the virtual cluster receives data sent by the next-level view library cluster, the received data is load balanced among all the physical nodes in the view library cluster.
5. The view library cluster according to claims 1-4, characterized in that: The physical nodes in the view library cluster are divided into multiple virtual clusters in the following manner: The electronic device determines the actual number of virtual clusters to be deployed in the view library cluster and the actual number of physical nodes corresponding to each actual virtual cluster according to the expected number of virtual clusters and the number of physical nodes in the view library cluster.
6. The view library cluster according to claim 5, characterized in that: The determining, by the electronic device, the number of actual virtual clusters to be deployed in the view library cluster and the number of actual physical nodes corresponding to each actual virtual cluster includes: Acquiring, by means of the electronic device, the number of physical nodes in the view library cluster and the number of virtual clusters expected to be allocated, and using the number of virtual clusters expected to be allocated as the expected number of virtual clusters; Determining, by the electronic device, the number of virtual clusters that can actually be allocated according to the number of physical nodes in the view library cluster, the expected number of virtual clusters and the preset number as the actual number of virtual clusters; The electronic device determines the number of physical nodes in each actual virtual cluster according to the number of physical nodes in the view library cluster and the number of actual virtual clusters.
7. The view library cluster according to claim 6, characterized in that: Determining, by the electronic device, the number of virtual clusters that can actually be allocated according to the number of physical nodes in the view library cluster, the expected number of virtual clusters, and the preset number as the actual number of virtual clusters includes: Determining, by the electronic device, the average number of physical nodes of each expected virtual cluster under the expected number of virtual clusters according to the number of physical nodes in the view library cluster and the expected number of virtual clusters, as the expected average number of nodes; If the expected average number of nodes of each expected virtual cluster is greater than or equal to the preset number, taking the expected number of virtual clusters as the actual number of virtual clusters; If the expected average number of nodes of each expected virtual cluster is less than the preset number, the quotient of the number of physical nodes and the preset number is used as the actual number of virtual clusters.
8. The view library cluster according to claim 7, characterized in that: The determining, by the electronic device, the number of physical nodes of each actual virtual cluster according to the number of physical nodes in the view library cluster and the number of actual virtual clusters, further includes: Determine, by the electronic device, the average number of physical nodes in each actual virtual cluster according to the number of physical nodes in the view library cluster and the number of actual virtual clusters, and round down the average number of physical nodes as the actual average number of nodes; The electronic device calculates the remainder of the number of physical nodes in the view library cluster with respect to the actual number of virtual clusters to obtain a remainder, and determines that the number of physical nodes of the remainder actual virtual clusters in the actual number of virtual clusters is the sum of the actual average number of nodes and 1, and the number of physical nodes of other actual virtual clusters is the actual average number of nodes.
9. The view library cluster according to any one of claims 1 to 8, characterized in that: The preset number is greater than or equal to 3.
