Disclosure of Invention
The invention aims to provide a login method, a login device and a login equipment for a multi-node cluster and a computer readable storage medium, so as to solve the problem that hardware cost is wasted because the login of each node of a cluster server needs to be realized through the support of a domain control server in the prior art.
To solve the above technical problem, the present invention provides a multi-node cluster login method, including: respectively utilizing a user agent and a user group agent of a cluster resource management library to create user resources and user group resources of the cluster resource management library; setting a constraint condition that the user resource is dependent on the user group resource; and respectively creating the same user group and the same user in each node of the cluster according to the constraint condition so as to conveniently realize the login of each node in the cluster through the same user.
Preferably, the creating the same user group and user in each node of the cluster according to the constraint condition includes:
respectively monitoring whether the user groups on each node of the cluster change or not by using the monitoring command of the user group agent;
and when the situation that the user group on the first node in the cluster is changed is monitored, updating the user group on the first node by using the updating command of the user group agent.
Preferably, when it is monitored that the user group on the first node in the cluster changes, updating the user group on the first node by using the update command of the user group agent includes:
when the situation that the user group on the first node in the cluster changes is monitored, executing an updating command by using the user group agent when the cluster is started;
comparing the information in the user group resource with the user group stored on the first node in a local file;
adding a user group which exists in the user group resource but does not exist in the local file to the first node;
deleting the user group on the first node that exists in the local file but does not exist in the user group resource.
Preferably, the creating the same user group and user in each node of the cluster according to the constraint condition includes:
respectively monitoring whether the users on each node of the cluster change or not by using the monitoring commands of the user agents;
and when the situation that the user on the second node in the cluster changes is monitored, updating the user on the second node by using the updating command of the user agent.
Preferably, when it is monitored that the user on the second node in the cluster changes, updating the user on the second node by using the update command of the user agent includes:
when the situation that the user on the second node in the cluster changes is monitored, when the cluster is started, the user agent is used for executing an updating command;
comparing the information in the user resource with the user stored on the second node in the local file;
adding users existing in the user resources but not existing in the local file to the first node;
deleting the user on the second node that exists in the local file but not in the user resource.
The invention also provides a login device of the multi-node cluster, which comprises the following components:
the creating module is used for creating the user resources and the user group resources of the cluster resource management library by using the user agent and the user group agent of the cluster resource management library respectively;
the setting module is used for setting a constraint condition that the user resource depends on the user group resource;
and the login module is used for respectively creating the same user group and the same user in each node of the cluster according to the constraint condition so as to conveniently realize the login of each node in the cluster through the same user.
Preferably, the login module is specifically configured to:
respectively monitoring whether the user groups on each node of the cluster change or not by using the monitoring command of the user group agent;
and when the situation that the user group on the first node in the cluster is changed is monitored, updating the user group on the first node by using the updating command of the user group agent.
Preferably, when it is monitored that the user group on the first node in the cluster changes, updating the user group on the first node by using the update command of the user group agent includes:
when the situation that the user group on the first node in the cluster changes is monitored, executing an updating command by using the user group agent when the cluster is started;
comparing the information in the user group resource with the user group stored on the first node in a local file;
adding a user group which exists in the user group resource but does not exist in the local file to the first node;
deleting the user group on the first node that exists in the local file but does not exist in the user group resource.
The invention also provides a login device of the multi-node cluster, which comprises the following components:
a memory for storing a computer program; and the processor is used for realizing the steps of the multi-node cluster login method when executing the computer program.
The present invention also provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the above-mentioned multi-node cluster login method.
The logging-in method of the multi-node cluster provided by the invention utilizes the user agent of the cluster resource management library to create the user resource of the cluster resource management library and utilizes the user agent of the cluster logging-in library to create the user group resource of the multi-node cluster. And setting a constraint condition that the user resource depends on the user group resource. And respectively creating the same user group and user in each node of the multi-node cluster server according to the constraint conditions, so that the login of each node in the cluster can be realized through the same user. The invention utilizes the user agent and the user group agent of the cluster resource management library to establish the user resources and the user group resources of the cluster resource management library, thereby being convenient to establish the same user group and user in each node of the cluster. Therefore, under the condition that each node in the cluster is not added with a domain, the login of each node in the cluster is realized through the same user, and the hardware cost is saved. In addition, the same user group and user do not need to be manually established at each node of the cluster, the cluster node login operation is simplified, and the login efficiency is improved. Accordingly, the login device, the equipment and the computer readable storage medium of the multi-node cluster provided by the invention have the beneficial effects.
Detailed Description
The core of the invention is to provide a multi-node cluster login method, a device, equipment and a computer readable storage medium, wherein the same user group and user are created in each node of a cluster by adding a user agent and a user group agent of a cluster resource management library, so that the login of each node of the cluster is realized under the condition that the cluster node does not need to join a domain.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. 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 invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a login method for a multi-node cluster according to a first embodiment of the present invention; the specific operation steps are as follows:
step S101: respectively utilizing a user agent and a user group agent of a cluster resource management library to create user resources and user group resources of the cluster resource management library;
and creating user resources and user group resources of the Pacemaker by using the user agent and the user group agent of the Pacemaker cluster resource management library.
Step S102: setting a constraint condition that the user resource is dependent on the user group resource;
because a user group needs to be appointed when a user is added into a node of the cluster, the appointed user group needs to be ensured to exist when the user is added, and therefore, a constraint condition that user resources depend on user group resources needs to be set; namely, the user group resource is started first, and then the user resource is started.
Step S103: and respectively creating the same user group and the same user in each node of the cluster according to the constraint condition so as to conveniently realize the login of each node in the cluster through the same user.
Through resource synchronization and according to constraint conditions, the same user group and users are respectively established in each node of the cluster, so that the same user can log in all nodes in the cluster, the logging in of all nodes in the cluster is realized through the same user and one user under the condition that the nodes in the cluster are not added into a domain, and the hardware cost of a cluster system is saved.
Based on the above embodiment, in this embodiment, taking a user group as an example, after synchronizing the user group resources created by using the user group agent of the Pacemaker to each node of the cluster, using the monitoring command of the user group agent to monitor whether the user group resources on each node change or not, respectively. And if the user group resources of a certain node are monitored to change, updating the user group resources on the node by using the updating command of the user group agent. Referring to fig. 2, fig. 2 is a flowchart illustrating a login method for a multi-node cluster according to a second embodiment of the present invention; the specific operation steps are as follows:
step S201: respectively utilizing a user agent and a user group agent of the Pacemaker to create user resources and user group resources of the cluster resource management library;
step S202: setting a constraint condition that the user resource is dependent on the user group resource;
step S203: respectively creating the same user group and user in each node of the cluster according to the constraint condition;
step S204: storing the information of the user group resources created by the user group agent of the Pacemaker into a local file;
step S205: respectively monitoring whether the user groups on each node of the cluster change or not by using the monitoring command of the user group agent;
and respectively monitoring whether the user groups on each node of the cluster change or not by using a Monitor command of the user group agent.
Step S206: when the situation that the user group on the first node in the cluster changes is monitored, executing an updating command by using the user group agent when the cluster is started;
and updating the user group on the first node by using the Update command of the user group agent.
Step S207: comparing the information in the user group resource with the user group stored on the first node in a local file;
step S208: adding a user group which exists in the user group resource but does not exist in the local file to the first node;
step S209: deleting the user group existing in the local file and not existing in the user group resource on the first node so as to create the same user group resource in each node of the cluster, thereby logging in each node of the cluster by using a local authentication mode.
Based on the above embodiment, in other embodiments provided by the present invention, after the same user group and user are respectively created in each node of the cluster, whether the user on each node of the cluster changes or not can be respectively monitored by using the monitoring command of the user agent; and when the situation that the user on the second node in the cluster changes is monitored, updating the user on the second node by using the updating command of the user agent. When a user is added or deleted, the user resource is updated, after the monitoring in the user agent detects that the user resource information on a certain node in the cluster is inconsistent, the updating operation is executed, and the user resource on the node is updated, so that the same user resource is created on all the nodes in the cluster, and the login of all the nodes in the cluster is realized through one user. The embodiment saves the hardware cost of the cluster login system; the cluster node login operation is simplified, and the login efficiency is improved.
Referring to fig. 3, fig. 3 is a block diagram illustrating a login apparatus of a multi-node cluster according to an embodiment of the present invention; the specific device may include:
a creating module 100, configured to create a user resource and a user group resource of a cluster resource management library by using a user agent and a user group agent of the cluster resource management library, respectively;
a setting module 200, configured to set a constraint condition that the user resource depends on the user group resource;
the login module 300 is configured to create the same user group and user in each node of the cluster according to the constraint condition, so as to facilitate login to each node in the cluster by the same user.
The multi-node cluster login device in this embodiment is used for implementing the aforementioned multi-node cluster login method, and therefore specific embodiments in the multi-node cluster login device may be found in the foregoing embodiments of the multi-node cluster login method, for example, the creating module 100, the setting module 200, and the login module 300 are respectively used for implementing steps S101, S102, and S103 in the aforementioned multi-node cluster login method, so that the specific embodiments thereof may refer to descriptions of corresponding embodiments of each part, and are not described herein again.
The specific embodiment of the present invention further provides a login device for a multi-node cluster, including: a memory for storing a computer program; and the processor is used for realizing the steps of the multi-node cluster login method when executing the computer program.
The specific embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the login method for a multi-node cluster are implemented.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The multi-node cluster login method, apparatus, device and computer readable storage medium provided by the present invention are described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.