Disclosure of Invention
The invention mainly aims to provide a method and a device for processing permission data of a distributed cluster, so as to solve the problem of low service permission verification efficiency of the distributed cluster in the related technology.
In order to achieve the above object, according to an aspect of the present invention, there is provided a license data processing method of a distributed cluster, the method including: when a preset condition is met, each first server in a distributed cluster acquires permission data from a target server, wherein the distributed cluster comprises at least one first server and at least one target server; analyzing the acquired permission data to obtain authorization information corresponding to the first server; and storing the authorization information into a memory of the first server.
Further, the method further comprises: after the first server receives a service starting instruction, acquiring the authorization information stored in the memory of the first server; judging whether the authorization information has the authority of starting the service or not; and responding to the starting instruction of the service to start the service when the judgment result is yes.
Further, before each first server in the distributed cluster obtains the license data from the target server, the method further comprises: and storing the permission data into the target server when the distributed cluster is started for the first time or when the permission data is newly acquired.
Further, each first server in the distributed cluster obtaining the license data from the target server includes: and each first server in the distributed cluster acquires the permission data from the target server through a preset API (application programming interface).
Further, when a preset condition is met, each first server in the distributed cluster acquiring the permission data from the target server includes: and each first server in the distributed cluster acquires the permission data from the target server at preset time intervals, or acquires the permission data from the target server at preset time points.
In order to achieve the above object, according to another aspect of the present invention, there is also provided a license data processing apparatus for a distributed cluster, the apparatus including: a first obtaining unit, configured to, when a preset condition is met, obtain permission data from a target server by each first server in a distributed cluster, where the distributed cluster includes at least one first server and at least one target server; the analysis unit is used for analyzing the acquired permission data to obtain authorization information corresponding to the first server; the first storage unit is used for storing the authorization information into the memory of the first server.
Further, the apparatus further comprises: a second obtaining unit, configured to obtain the authorization information stored in the memory of the first server after the first server receives a service start instruction; the judging unit is used for judging whether the authorization information has the authority of starting the service; and the starting unit is used for responding to the starting instruction of the service to start the service when the judgment result is yes.
Further, the apparatus further comprises: the second storage unit is configured to, before each first server in the distributed cluster acquires the permission data from the target server, store the permission data in the target server when the distributed cluster is started for the first time or when the permission data is newly acquired.
In order to achieve the above object, according to another aspect of the present invention, there is also provided a storage medium including a stored program, wherein when the program runs, a device on which the storage medium is located is controlled to execute the method for processing permission data of a distributed cluster according to the present invention.
In order to achieve the above object, according to another aspect of the present invention, there is also provided an apparatus, which includes at least one processor, and at least one memory and a bus connected to the processor, wherein the processor and the memory complete communication with each other through the bus, and the processor is configured to call program instructions in the memory to execute the method for processing permission data of a distributed cluster according to the present invention.
According to the method, when a preset condition is met, each first server in a distributed cluster acquires permission data from a target server, wherein the distributed cluster comprises at least one first server and at least one target server; analyzing the acquired permission data to obtain authorization information corresponding to the first server; the authorization information is stored in the memory of the first server, so that the problem of low service permission verification efficiency of the distributed cluster in the related technology is solved, and the effect of improving the service permission verification efficiency of the distributed cluster is achieved.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, several terms referred to in the embodiments of the present application are explained below:
license: licenses, distributed clusters of business type, typically need to be obtained for use. The license typically includes total capacity authorization, available disk authorization, available node number authorization, and the like.
The embodiment of the invention provides a method for processing permission data of a distributed cluster.
Fig. 1 is a flowchart of a license data processing method of a distributed cluster according to an embodiment of the present invention, as shown in fig. 1, the method including the steps of:
step S102: when a preset condition is met, each first server in the distributed cluster acquires permission data from a target server, wherein the distributed cluster comprises at least one first server and at least one target server;
step S104: analyzing the acquired permission data to obtain authorization information corresponding to the first server;
step S106: and storing the authorization information into the memory of the first server.
In the embodiment, when a preset condition is met, each first server in a distributed cluster acquires permission data from a target server, wherein the distributed cluster comprises at least one first server and at least one target server; analyzing the acquired permission data to obtain authorization information corresponding to the first server; the authorization information is stored in the memory of the first server, so that the problem of low service permission verification efficiency of the distributed cluster in the related technology is solved, and the effect of improving the service permission verification efficiency of the distributed cluster is achieved. Further, the method further comprises: after the first server receives a service starting instruction, acquiring authorization information stored in a memory of the first server; judging whether the authorization information has the authority of starting the service or not; and when the judgment result is yes, responding to the starting instruction of the service to start the service.
In this embodiment, the preset condition may be various types of conditions, for example, a time condition, at a certain time interval, or every time a certain time point is reached, it is assumed that there are 5 servers in the distributed cluster, where one server is a management master node, four servers are ordinary servers, the target server is preferably a management master node, or may be an ordinary server, the target server storing the license data may be accessed through an API interface, and the other servers may obtain the license data through the API interface, and after obtaining the license data, analyze out the relevant service permission margin, for example, there is still remaining monitoring services, and then for the current server, the monitoring service is an available service, and stores such authorization information locally to the current first server. Therefore, the permission can be obtained in advance, if the monitoring service is required to be started in the next time, the first server can directly authorize to start the monitoring service through the locally stored permission data, and the permission does not need to be obtained when the monitoring service is required to be started.
Optionally, the license data is stored in the target server before each first server in the distributed cluster acquires the license data from the target server, when the distributed cluster is started for the first time, or when the license data is newly acquired.
When the distributed cluster is built and started for the first time, the permission data can be stored in the target server, or after a new purchase is permitted, the permission data can be stored in the target server.
Optionally, the obtaining, by each first server in the distributed cluster, the license data from the target server includes: each first server in the distributed cluster acquires the permission data from the target server through a preset API (application programming interface).
Optionally, when a preset condition is met, the obtaining, by each first server in the distributed cluster, the permission data from the target server includes: every other preset time interval, each first server in the distributed cluster acquires the permission data from the target server, or every time when the preset time point is reached, each first server in the distributed cluster acquires the permission data from the target server.
Through the technical scheme, the license management and verification do not need to be divided into the primary server and the secondary server, and the same verification is carried out on all the servers, so that all the nodes can independently verify the license, and the license can be inquired in time when all the nodes start service or run functions, and the detection command does not need to be triggered by the primary node.
The present embodiment also provides a preferred embodiment.
Distributed cluster license management and verification steps:
1. after the distributed cluster is installed, the license (applied or purchased from the manufacturer) needs to be input after the distributed cluster is started for the first time.
License is stored on a server in the cluster, which may be a file, a database, or even a distributed storage device in the cluster. The cluster provides a uniform API interface, and all machines can inquire the license through the API interface without concerning the storage mode of the license.
3. All servers in the cluster run a license authentication program, and the license authentication program acquires the license through the interface in the last step at intervals (for example, 5 minutes), analyzes the license and verifies whether the local computer conforms to the authorized function in the license. Storing the authorization information in a memory.
4. At regular intervals (e.g., 5 minutes), license is obtained and verified again, and the authorization information in the memory is updated, so as to ensure that the authorization information in each server is close to the latest.
5. When a machine needs to start a service, it determines whether the new service can be started by checking the authorization information in the memory.
The technical scheme of the embodiment can realize that: all server nodes in the distributed cluster actively verify the license without depending on the primary and secondary nodes, the cluster provides a uniform API interface, all machines in the cluster can inquire the license through the interface without concerning the storage position and the storage mode of the license, and all the nodes re-verify and update the license information in the memory at intervals.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
The embodiment of the invention provides a device for processing permission data of a distributed cluster, which can be used for executing the method for processing the permission data of the distributed cluster.
Fig. 2 is a schematic diagram of a license data processing apparatus of a distributed cluster according to an embodiment of the present invention, as shown in fig. 2, the apparatus including:
a first obtaining unit 10, configured to, when a preset condition is met, obtain permission data from a target server by each first server in a distributed cluster, where the distributed cluster includes at least one first server and at least one target server;
the analysis unit 20 is configured to analyze the acquired permission data to obtain authorization information corresponding to the first server;
the first storage unit 30 is configured to store the authorization information in the memory of the first server.
The embodiment adopts a first obtaining unit 10, configured to, when a preset condition is met, obtain permission data from a target server by each first server in a distributed cluster, where the distributed cluster includes at least one first server and at least one target server; the analysis unit 20 is configured to analyze the acquired permission data to obtain authorization information corresponding to the first server; the first storage unit 30 is configured to store the authorization information in the memory of the first server, so that the problem of low service permission verification efficiency of the distributed cluster in the related art is solved, and an effect of improving the service permission verification efficiency of the distributed cluster is achieved.
Optionally, the apparatus further comprises: the second acquisition unit is used for acquiring the authorization information stored in the memory of the first server after the first server receives the starting instruction of the service; the judging unit is used for judging whether the authorization information has the authority of starting the service; and the starting unit is used for responding to a starting instruction of the service to start the service when the judgment result is yes.
Optionally, the apparatus further comprises: and the second storage unit is used for storing the permission data into the target server when the distributed cluster is started for the first time or when the permission data is newly acquired before each first server in the distributed cluster acquires the permission data from the target server.
The license data processing device of the distributed cluster comprises a processor and a memory, wherein the first acquisition unit, the analysis unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the service permission verification efficiency of the distributed cluster is improved by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a storage medium on which a program is stored, the program implementing the license data processing method of the distributed cluster when being executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the program executes the license data processing method of the distributed cluster when running.
The embodiment of the invention provides equipment, which comprises at least one processor, at least one memory and a bus, wherein the memory and the bus are connected with the processor; the processor and the memory complete mutual communication through a bus; the processor is configured to call program instructions in the memory to perform the above-described license data processing method for the distributed cluster. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: when a preset condition is met, each first server in the distributed cluster acquires permission data from a target server, wherein the distributed cluster comprises at least one first server and at least one target server; analyzing the acquired permission data to obtain authorization information corresponding to the first server; and storing the authorization information into the memory of the first server.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.