Equipment management method and device, electronic equipment and storage medium
By selecting the target node with the smallest number of management devices as the management node of the target network device in the device management cluster, the problem of uneven load of the device management service node is solved, and the stability and efficiency of the system are improved.
Patent Information
- Application Number
- CN202311128831.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2025-02-28
AI Technical Summary
When new network equipment is added to existing equipment management clusters, it is easy to cause uneven loads of equipment management service nodes, affecting the stability and efficiency of the system.
By responding to the new device request of the target network device, determine the current status of each management node in the management node collection, select the target node with the smallest number of management devices as the management node of the target network device, and establish a connection between the target node and the target network device, and update the database to ensure load balancing.
Effectively balance the load of each device management node, improve the stability and efficiency of the system, and ensure that the added network equipment can be managed normally.
Smart Images

Figure CN119544715A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of the Internet. Specifically, the present application relates to a device management method, apparatus, electronic device and storage medium. Background Art
[0002] The device management cluster is a service module in the cloud network architecture that establishes connections with network devices, including multiple device management service nodes. The device management service nodes are used to manage network devices and provide services to the cloud network controller through the northbound API (Application Programming Interface).
[0003] During the operation of the device management cluster and network devices, the newly added network devices are randomly assigned through the load balancer. For example, the device management cluster already has 3 device management service nodes working normally, and each device management service node manages 100 network devices. At this time, the device management cluster is expanded to add a device management service node, so the newly added network devices will be randomly assigned to 4 device management service nodes. The current device management method is prone to uneven load on device management service nodes. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a device management method, apparatus and electronic device. The technical solutions provided by the embodiments of the present application are as follows:
[0005] On the one hand, an embodiment of the present application provides a method for device management, the method comprising:
[0006] In response to a device addition request for a target network device, determine a current state of each management node in the management node set; the management node is used to manage the network device, and the current state of the management node includes a first state and a second state, the first state represents a normal operation of the management node, and the second state represents an abnormal operation of the management node;
[0007] Based on the current status of each management node, determine each first node that is operating normally from each management node;
[0008] Querying the number of network devices managed by each first node from a database; the database includes device identifiers of each network device managed by each first node;
[0009] Based on the number of network devices managed by each first node, determining a target node with the least number of devices managed by each first node;
[0010] The target node is determined as the management node of the target network device, a connection between the target node and the target network device is established, and a database is updated.
[0011] In some possible implementations, the device adding request carries a target device address of the target network device;
[0012] Establish a connection between the target node and the target network device, including:
[0013] The target device address of the target network device is sent to the target node, so that the target node establishes a connection with the target network device through the target device address.
[0014] In some possible implementations, establishing a connection between a target node and a target network device includes:
[0015] The association information between the target device identifier of the target network device and the target node identifier of the target node to be assigned is sent to the registration center, so that the registration center responds to the registration request of the target network device, queries the node address of the target node identifier corresponding to the target device identifier carried in the registration request, and sends the node address to the target network device, so that the target network device is connected to the target node through the node address.
[0016] In some possible implementations, the following further includes:
[0017] Obtain a node addition request for the management node; the node addition request carries a first node identifier of a node to be added;
[0018] Based on the first node identifier, adding the node to be added to the management node set;
[0019] The node addition request is generated based on any of the following methods:
[0020] In response to a new adding instruction for a node to be added, generating a node adding request;
[0021] When receiving the heartbeat information sent by the node to be added and detecting that the node to be added is not in the management node set, generating a node addition request;
[0022] It is detected that the number of devices managed by each management node in the management node set meets a first preset condition, a node to be added is determined from the standby node set, and a node addition request is generated.
[0023] In some possible implementations, before adding the node to be added to the management node set based on the first node identifier, the method further includes:
[0024] Determine the current state of the node to be added as the second state;
[0025] After adding the node to be added to the management node set based on the first node identifier, the method further includes:
[0026] Update the current state of the node to be added to the first state.
[0027] In some possible implementations, the following further includes:
[0028] Obtaining a node deletion request for a management node; the node deletion request carries a second node identifier of a node to be deleted;
[0029] Based on the second node identifier, deleting the node to be deleted from the management node set;
[0030] The node deletion request is generated based on any of the following methods:
[0031] In response to a deletion instruction for a node to be deleted, generating a node deletion request;
[0032] It is detected that the number of devices managed by each management node in the management node set meets the second preset condition, and the number of devices managed by the node to be deleted meets the third preset condition, and a node deletion request is generated.
[0033] In some possible implementations, before deleting the node to be deleted from the management node set based on the second node identifier, the method further includes:
[0034] The current state of the node to be deleted is determined as the second state.
[0035] In some possible implementations, before deleting the node to be deleted from the management node set based on the second node identifier, the method further includes:
[0036] Determining at least one first network device managed by the node to be deleted;
[0037] For each first network device, based on the current state of each second node and the number of managed network devices, a third node is determined from each second node; the second node is a management node in the management node set except the node to be deleted;
[0038] The third node is determined as the management node of the first network device, and a connection is established between the first network device and the third node.
[0039] In some possible implementations, before establishing a connection between the first network device and the third node, the method further includes:
[0040] Sending a first disconnection instruction to the node to be deleted, so that the node to be deleted is disconnected from the first network device;
[0041] Establishing a connection between the first network device and the third node includes:
[0042] The first device address of the first network device is sent to the third node, so that the third node establishes a connection with the first network device through the first device address.
[0043] In some possible implementations, before establishing a connection between the first network device and the third node, the method further includes:
[0044] Sending a second disconnection to the node to be deleted; the second disconnection is used to instruct the node to be deleted to disconnect from the first network device and no longer receive connections from the first network device;
[0045] Establishing a connection between the first network device and the third node includes:
[0046] The association information between the first device identifier of the first network device and the node identifier of the third node is sent to the registration center, so that the registration center responds to the registration request of the first network device, queries the node address of the third node, and sends the node address of the third node to the first network device, so that the first network device is connected to the third node through the node address of the third node; the registration request of the first network device is generated by the first network device when it detects that it cannot connect to the node to be deleted.
[0047] In some possible implementations, the following further includes:
[0048] Sending a status query request to each management node in the management node set according to a preset period;
[0049] If no response information to the status query request is received from any management node within the preset time, the operation status of the management node is determined to be the second status;
[0050] For each network device managed by the management node, a new management node is determined respectively.
[0051] On the other hand, an embodiment of the present application provides a device management apparatus, the apparatus comprising:
[0052] A first determination module is used to determine the current state of each management node in the management node set in response to a device addition request for a target network device; the management node is used to manage the network device, and the current state of the management node includes a first state and a second state, the first state represents the normal operation of the management node, and the second state represents the abnormal operation of the management node;
[0053] A second determination module is used to determine each first node that is operating normally from each management node based on the current state of each management node;
[0054] A query module, used to query the number of network devices managed by each first node from a database; the database includes device identifiers of each network device managed by each first node;
[0055] A third determination module is used to determine, from each first node, a target node with the least number of managed devices based on the number of network devices managed by each first node;
[0056] The connection module is used to determine the target node as the management node of the target network device, establish a connection between the target node and the target network device, and update the database.
[0057] In some possible implementations, the device adding request carries a target device address of the target network device;
[0058] When establishing a connection between a target node and a target network device, the connection module is specifically used to:
[0059] The target device address of the target network device is sent to the target node, so that the target node establishes a connection with the target network device through the target device address.
[0060] In some possible implementations, when establishing a connection between a target node and a target network device, the connection module is specifically used to:
[0061] The association information between the target device identifier of the target network device and the target node identifier of the target node to be assigned is sent to the registration center, so that the registration center responds to the registration request of the target network device, queries the node address of the target node identifier corresponding to the target device identifier carried in the registration request, and sends the node address to the target network device, so that the target network device is connected to the target node through the node address.
[0062] In some possible implementations, an additional module is further included for:
[0063] Obtain a node addition request for the management node; the node addition request carries a first node identifier of a node to be added;
[0064] Based on the first node identifier, adding the node to be added to the management node set;
[0065] The node addition request is generated based on any of the following methods:
[0066] In response to a new adding instruction for a node to be added, generating a node adding request;
[0067] When receiving the heartbeat information sent by the node to be added and detecting that the node to be added is not in the management node set, generating a node addition request;
[0068] It is detected that the number of devices managed by each management node in the management node set meets a first preset condition, a node to be added is determined from the standby node set, and a node addition request is generated.
[0069] In some possible implementations, a fourth determining module is further included, which is used to:
[0070] Determine the current state of the node to be added as the second state;
[0071] Also includes update modules for:
[0072] Update the current state of the node to be added to the first state.
[0073] In some possible implementations, a deletion module is further included, which is used to:
[0074] Obtaining a node deletion request for a management node; the node deletion request carries a second node identifier of a node to be deleted;
[0075] Based on the second node identifier, deleting the node to be deleted from the management node set;
[0076] The node deletion request is generated based on any of the following methods:
[0077] In response to a deletion instruction for a node to be deleted, generating a node deletion request;
[0078] It is detected that the number of devices managed by each management node in the management node set meets the second preset condition, and the number of devices managed by the node to be deleted meets the third preset condition, and a node deletion request is generated.
[0079] In some possible implementations, a fifth determining module is further included, configured to:
[0080] The current state of the node to be deleted is determined as the second state.
[0081] In some possible implementations, a sixth determining module is further included, configured to:
[0082] Determining at least one first network device managed by the node to be deleted;
[0083] For each first network device, based on the current state of each second node and the number of managed network devices, a third node is determined from each second node; the second node is a management node in the management node set except the node to be deleted;
[0084] The third node is determined as the management node of the first network device, and a connection is established between the first network device and the third node.
[0085] In some possible implementations, the system further includes a first sending module, which is used to:
[0086] Sending a first disconnection instruction to the node to be deleted, so that the node to be deleted is disconnected from the first network device;
[0087] When establishing a connection between the first network device and the third node, the connection module is specifically used to:
[0088] The first device address of the first network device is sent to the third node, so that the third node establishes a connection with the first network device through the first device address.
[0089] In some possible implementations, the device further includes a second sending module, which is used to:
[0090] Sending a second disconnection to the node to be deleted; the second disconnection is used to instruct the node to be deleted to disconnect from the first network device and no longer receive connections from the first network device;
[0091] When establishing a connection between the first network device and the third node, the connection module is specifically used to:
[0092] The association information between the first device identifier of the first network device and the node identifier of the third node is sent to the registration center, so that the registration center responds to the registration request of the first network device, queries the node address of the third node, and sends the node address of the third node to the first network device, so that the first network device is connected to the third node through the node address of the third node; the registration request of the first network device is generated by the first network device when it detects that it cannot connect to the node to be deleted.
[0093] In some possible implementations, a third sending module is further included, which is used to:
[0094] Sending a status query request to each management node in the management node set according to a preset period;
[0095] If no response information to the status query request is received from any management node within the preset time, the operation status of the management node is determined to be the second status;
[0096] For each network device managed by the management node, a new management node is determined respectively.
[0097] On the other hand, an embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the computer program to implement the method provided in any optional embodiment of the present application.
[0098] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method provided in any optional embodiment of the present application is implemented.
[0099] On the other hand, an embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the method provided in any optional embodiment of the present application.
[0100] The beneficial effects of the technical solution provided by the embodiment of the present application are as follows:
[0101] When a new network device is added, the cloud server is used to determine the first nodes that are operating normally from the management nodes in the management node set, and then based on the number of network devices managed by each first node, the target node with the least number of managed devices is determined from the first nodes, and the target node is determined as the management node of the target network device. In other words, the newly added target network device is assigned to the target node with the smallest load, which can effectively balance the load of each device management node. BRIEF DESCRIPTION OF THE DRAWINGS
[0102] Figure 1 A schematic diagram of an application environment of a device management method provided in an example;
[0103] Figure 2 A schematic diagram of a device management method provided in an embodiment of the present application;
[0104] Figure 3 A schematic diagram of a solution for adding a target network device provided for an example of the present application;
[0105] Figure 4 A schematic diagram of a scheme for connecting a target node and a target network device provided for an example of the present application;
[0106] Figure 5 A schematic diagram of a scheme for connecting a target node and a target network device provided for an example of the present application;
[0107] Figure 6 A schematic diagram of a solution for disconnecting a node to be deleted from a first network device provided as an example of the present application;
[0108] Figure 7 A schematic diagram of a solution for disconnecting a node to be deleted from a first network device provided as an example of the present application;
[0109] Figure 8 A schematic diagram of the change of the current state during the process of adding and deleting a management node provided as an example of this application;
[0110] Fig. 9 A schematic diagram of the structure of a device management device provided in an embodiment of the present application;
[0111] Fig.10 A schematic diagram of the structure of an electronic device applicable to an embodiment of the present application. DETAILED DESCRIPTION
[0112] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0113] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" may be implemented as "A", or as "B", or as "A and B". When describing multiple (two or more) items, if the relationship between the multiple items is not clearly defined, the multiple items may refer to one, multiple or all of the multiple items. For example, the description of "parameter A includes A1, A2, A3" can be implemented as parameter A including A1 or A2 or A3, and can also be implemented as parameter A including at least two of the three items A1, A2, A3.
[0114] The device management method of the present application can be implemented based on cloud technology.
[0115] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or local area network to achieve data computing, storage, processing, and sharing.
[0116] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of the technical network system require a large amount of computing and storage resources, such as video websites, image websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, which needs to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All kinds of industry data need strong system backing support, which can only be achieved through cloud computing.
[0117] A private cloud is a cloud infrastructure with software and hardware resources created within a firewall so that departments within an organization or enterprise can share resources within the data center. In addition to hardware resources, cloud equipment (IaaS, Infrastructure as a Service) software is generally required to create a private cloud.
[0118] Private cloud computing also includes three levels: cloud hardware, cloud platform, and cloud service. The difference is that cloud hardware is the user's own personal computer or server, not the cloud computing vendor's data center. The purpose of cloud computing vendors to build data centers is to provide public cloud services to millions of users, so they need to have tens of millions of servers. Private cloud computing only serves friends and relatives for individuals, and only serves employees, customers, and suppliers for enterprises. Therefore, an individual or enterprise's own personal computer or server is sufficient to provide cloud services.
[0119] Public Cloud usually refers to a cloud provided by a third-party provider for users to use. Public Cloud is generally available through the Internet and may be free or low-cost. The core attribute of Public Cloud is shared resource services. There are many instances of this cloud, which can provide services throughout the open public network today.
[0120] Hybrid Cloud combines public cloud and private cloud, and is the main model and development direction of cloud computing in recent years. Private cloud is mainly for enterprise users. For security reasons, enterprises are more willing to store data in private cloud, but at the same time hope to obtain computing resources of public cloud. In this case, hybrid cloud is increasingly adopted, which mixes and matches public cloud and private cloud to obtain the best effect. This personalized solution achieves the purpose of saving money and security.
[0121] The solution provided in the embodiments of the present application involves technologies such as device management of cloud technology, which is specifically explained through the following embodiments.
[0122] The following describes several optional embodiments to illustrate the technical solution provided by the present application and the technical effects produced by the technical solution of the present application. It should be noted that the following implementations can refer to, draw on or combine with each other, and the same terms, similar features and similar implementation steps in different implementations will not be described repeatedly.
[0123] The device management method provided in the embodiment of the present application can be executed by any computer device, and optionally, can be executed by a cloud network controller, wherein the cloud network controller can be a cloud server that provides cloud computing services.
[0124] Figure 1 Schematic diagram of the application environment of the device management method provided in the embodiment of the present application. The application environment may include a cloud network controller 101, multiple management nodes 102, and multiple network devices 103. Specifically, the cloud network controller 101 responds to the device addition request for the target network device 104, and determines the current state of each management node 102 in the management node set; the management node 102 is used to manage the network device 103, and the current state of the management node 102 includes a first state and a second state, the first state represents the normal operation of the management node 102, and the second state represents the abnormal operation of the management node 102; based on the current state of each management node 102, determine the first nodes that are in normal operation from each management node 102; query the number of network devices managed by each first node from the database; the database includes the device identification of each network device managed by each first node; based on the number of network devices managed by each first node, determine the target node with the least number of managed devices from each first node; determine the target node as the management node of the target network device, establish a connection between the target node and the target network device, and update the database.
[0125] Those skilled in the art can understand that cloud service controllers, management nodes, and network devices can all be cloud servers. Cloud servers are cloud servers or server clusters that provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms. The embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc. The specific requirements can also be determined based on the actual application scenario requirements, which is not limited here.
[0126] In some possible implementations, a device management method is provided, which may be executed by a cloud server, and the cloud server may also include a cloud network controller.
[0127] Figure 2 A flow chart of a device management method provided in an embodiment of the present application is shown. Taking the execution subject as a cloud server as an example, the device management method provided in the present application may include:
[0128] S201 , in response to a device addition request for a target network device, determining a current state of each management node in a management node set.
[0129] The management node is used to manage network devices, that is, it can perform life cycle management on network devices, issue various network configurations to network devices, and so on.
[0130] Specifically, a management node can manage one or more network devices.
[0131] The current state of a management node includes a first state and a second state, that is, the management node is in the first state or the second state, the first state represents the normal operation of the management node, and the second state represents the abnormal operation of the management node.
[0132] Specifically, the second state may include a variety of different states, such as a management node being deleted, a management node being added, etc. At this time, the management node cannot operate normally.
[0133] S202: Based on the current status of each management node, determine each first node that is operating normally from each management node.
[0134] Specifically, based on the current status of each management node, a management node whose current status is a first status may be determined, thereby obtaining the first node.
[0135] S203: Query the number of network devices managed by each first node from the database.
[0136] The database includes the device identification of each network device managed by each first node.
[0137] Specifically, the database can be set in an independent node or device, or in a cloud server, without specific limitation.
[0138] Specifically, the number of network devices managed by each first node may be counted by querying the device identification of each network device managed by each first node.
[0139] S204: Based on the number of network devices managed by each first node, determine a target node with the least number of managed devices from each first node.
[0140] The target node is determined by comparing the device quantities of the network devices managed by the first nodes.
[0141] Specifically, for each node, the load level of the node can be determined by the number of devices managed, so as to select the target node with the least load.
[0142] S205, determining the target node as the management node of the target network device, establishing a connection between the target node and the target network device, and updating the database.
[0143] Specifically, the target node is determined as the management node of the target network device, that is, the target network device is allocated to the target node, and the target network device is managed through the target node.
[0144] In the specific implementation process, the target node can actively connect to the target network device, or the target network node can actively connect to the target node through the registration center. The specific process of establishing the connection between the target node and the target network device will be further elaborated below.
[0145] Specifically, after the connection between the target node and the target network device is established, the target network node is added to the network devices managed by the target node, and the device identification of each network device managed by the target node in the database needs to be updated.
[0146] like Figure 3 As shown, taking the cloud server including the cloud network controller as an example, a device addition request for the target network device is obtained, the load information of the management node is queried from the database, that is, the number of devices of the managed network devices, and the management node with the lowest current load is selected, that is, the target node with the least number of managed devices (node B shown in the figure) is determined. It can be understood that the management nodes here are all operating normally, that is, the management nodes in the first state, and node B is used as the management node of the target network device to be added, that is, adding devices to the management node as shown in the figure, and updating the database. It should be noted that node A in the figure is another management node. Since node A is not the management node with the smallest load, node A is not selected as the management node of the target network device.
[0147] In the above embodiment, when a new network device is added, the cloud server determines the first nodes that are operating normally from the management nodes in the management node set, and then based on the number of network devices managed by each first node, determines the target node with the least number of managed devices from each first node, and determines the target node as the management node of the target network device, that is, assigns the newly added target network device to the target node with the smallest load, which can effectively balance the load of each device management node.
[0148] The specific process of connecting the target network device and the target node will be further described below in conjunction with the embodiments.
[0149] In some possible implementations, the device adding request carries a target device address of a target network device.
[0150] S205 establishes a connection between the target node and the target network device, which may include:
[0151] The target device address of the target network device is sent to the target node, so that the target node establishes a connection with the target network device through the target device address.
[0152] Specifically, the cloud server can receive a device addition request sent by the operation and maintenance terminal, that is, the target network device that needs to be added is specified through the operation and maintenance terminal, and the cloud server sends the target device address carried in the device addition request to the target node, so that the target node actively establishes a connection with the target network device through the target device address of the target network device.
[0153] like Figure 4 As shown, the cloud server allocates a target node to the target network device and sends the target device address of the target network device to the target node; the target node connects to the target network device via the target device address.
[0154] The above embodiment describes the process of the target node actively establishing a connection with the target network device. The following will describe the process of the target network device actively connecting to the target node in conjunction with the embodiment.
[0155] In some possible implementations, S205 establishing a connection between the target node and the target network device may include:
[0156] The association information between the target device identifier of the target network device and the target node identifier of the target node to be assigned is sent to the registration center, so that the registration center responds to the registration request of the target network device, queries the node address of the target node identifier corresponding to the target device identifier carried in the registration request, and sends the node address to the target network device, so that the target network device is connected to the target node through the node address.
[0157] like Figure 5As shown, the cloud server determines the target node of the target network device, and sends the association information between the target device identifier of the target network device and the target node identifier of the target node to be assigned to the registration center; the address of the registration center is carried in the initial configuration of the target network device deployment, and the target network device applies for registration to the registration center through the address of the registration center, that is, sends a registration request to the registration center; the registration center registers the target network device, and the registration process includes authentication and authorization, which will not be repeated here; after successful registration, that is, after authentication and authorization are passed, the registration center queries the node address of the target node identifier corresponding to the target device identifier carried in the registration request, and sends the node address to the target network device.
[0158] The above embodiment describes the specific process of connecting the target network device and the target node. The following will describe the process of adding a new management node in conjunction with the embodiment.
[0159] In some possible implementations, the method further includes:
[0160] Obtain a node addition request for the management node; the node addition request carries a first node identifier of a node to be added;
[0161] Based on the first node identifier, adding the node to be added to the management node set;
[0162] The node addition request is generated based on any of the following methods:
[0163] (1) In response to a new node addition instruction for a node to be added, a node addition request is generated.
[0164] Specifically, the operation and maintenance terminal may send a new addition instruction to the cloud server, and the cloud server generates a node addition request for the node to be added in response to the new addition instruction.
[0165] That is to say, the operation and maintenance terminal can specify the node to be added from the spare node set.
[0166] (2) When the heartbeat information sent by the node to be added is received and it is detected that the node to be added is not in the management node set, a node addition request is generated.
[0167] In the specific implementation process, the management node set can be automatically expanded. The management node set can include a master device. When the master device detects the load of each management node, that is, the number of managed devices meets the first preset condition, it can specify the node to be added from the backup node set.
[0168] Specifically, during operation, each management node will periodically send heartbeat information to the cloud server to indicate the current status. If the cloud server detects the heartbeat information sent by the node to be added, and detects that the node to be added is not in the management node set, it means that the node to be added is new, and the node to be added needs to be added to the management node set.
[0169] (3) It is detected that the number of devices managed by each management node in the management node set meets the first preset condition, a node to be added is determined from the standby node set, and a node addition request is generated.
[0170] The first preset condition may be that the number of devices is greater than a first preset threshold.
[0171] Specifically, if the cloud server detects the load of each management node, that is, the number of managed devices meets the first preset condition, the cloud server can specify a node to be added from the spare node set.
[0172] During the above implementation, the node to be added is added to the management node set. When the network device is expanded, the corresponding management node can be determined from the updated management node set. While adding the new management node, the load balance between the management nodes can be guaranteed.
[0173] In some possible implementations, before adding the node to be added to the management node set based on the first node identifier, the method further includes:
[0174] The current state of the node to be added is determined as the second state.
[0175] Specifically, when it is determined that a node to be added needs to be added and the node to be added has not been added to the management node set, the node to be added is in an adding state (ADDING), that is, it cannot operate normally at this time, and is therefore in the second state.
[0176] In the specific implementation process, when initially adding the node to be added, the cloud server will do some initialization work, such as checking node parameters, verifying software versions, etc. At this time, the node to be added is in the adding state.
[0177] After adding the node to be added to the management node set based on the first node identifier, the method further includes:
[0178] Update the current state of the node to be added to the first state.
[0179] In some implementations, after the node to be added is added to the management node set, if the node to be added can operate normally, the current state of the node to be added is updated to the first state.
[0180] In other embodiments, after the node to be added is added to the management node set, the state of the node to be added can be a normal (NORMAL) state or an unhealthy (UNHEALTHY) state; wherein the first state includes a normal state; and the second state includes an unhealthy state and an added state.
[0181] The cloud server will also perform a health check on the node to be added, that is, send a status query request to the node to be added, and determine the current status of the node to be added based on the response information of the node to be added.
[0182] The above embodiment describes a process of adding a new management node. The following will describe a process of deleting a management node in conjunction with the embodiment.
[0183] In some possible implementations, the following further includes:
[0184] Obtaining a node deletion request for a management node; the node deletion request carries a second node identifier of a node to be deleted;
[0185] Based on the second node identifier, the node to be deleted is deleted from the management node set.
[0186] The node deletion request is generated based on any of the following methods:
[0187] (1) In response to a deletion instruction for a node to be deleted, a node deletion request is generated.
[0188] Specifically, the operation and maintenance terminal may send a deletion instruction to the cloud server, and the cloud server generates a node deletion request for the node to be deleted in response to the deletion instruction.
[0189] That is to say, the operation and maintenance terminal can specify the node to be deleted from the spare node set.
[0190] (2) It is detected that the number of devices managed by each management node in the management node set meets the second preset condition, and the number of devices managed by the node to be deleted meets the third preset condition, and a node deletion request is generated.
[0191] Among them, the second preset condition can be that the number of devices is less than or equal to the second preset threshold, the third preset condition can be that the number of devices managed by the node to be deleted is less than or equal to the third preset threshold, and the third preset threshold is less than the second preset threshold; the third preset condition can also be that the number of devices managed by the node to be deleted is the least among the numbers of devices managed by each management node.
[0192] That is, it may be detected that the number of devices managed by each management node is relatively small, and the node to be deleted may be selected and deleted from the management node set.
[0193] Specifically, if the cloud server detects the load of each management node, that is, the number of devices managed by each management node meets the second preset condition, and the number of devices managed by the node to be deleted meets the third preset condition, the cloud server can determine the node to be deleted from the management node set.
[0194] It should be noted that compared with the process of adding management nodes, the management node set cannot be automatically reduced during the process of deleting management nodes.
[0195] In some possible implementations, before deleting the node to be deleted from the management node set based on the second node identifier, the method further includes:
[0196] The current state of the node to be deleted is determined as the second state.
[0197] Specifically, when it is determined that the node to be deleted needs to be deleted and the node to be deleted has not been deleted from the management node set, the node to be deleted is in a deleting state (DELETING), that is, it cannot operate normally at this time, so it is in the second state.
[0198] In some possible implementations, before deleting the node to be deleted from the management node set based on the second node identifier, the method further includes:
[0199] (1) Determine at least one first network device managed by the node to be deleted.
[0200] Specifically, the node to be deleted needs to be deleted from the management node set, that is, no longer manages network devices, so it is necessary to first determine the first network device currently managed by the node to be deleted, and then migrate the first network device to other management nodes.
[0201] (2) For each first network device, based on the current status of each second node and the number of managed network devices, determine the third node from each second node.
[0202] The second node is a management node in the management node set except the node to be deleted.
[0203] Specifically, the process of determining the third node is the same as the process of determining the first node and determining the target node from the first node when adding a target network device.
[0204] In the specific implementation process, the current state of each second node is determined, the second node whose current state is the first state is determined, and then the number of network devices managed by the second node in the first state is determined, and then the third node with the least number of managed devices is determined from the second nodes in the first state.
[0205] (3) The third node is determined as the management node of the first network device, and a connection is established between the first network device and the third node.
[0206] Specifically, the process of establishing a connection between the first network device and the third node is the same as the process of establishing a connection between the target node and the target network device. The third node can actively establish a connection with the first network device, or the first network device can actively connect to the third node through the registration center. The specific process will not be repeated here.
[0207] In the above embodiment, before the node to be deleted is deleted, for each first network device managed by the node to be deleted, based on the current status of each second node and the number of network devices managed, a third node is determined from each second node, and the third node is determined as the management node of the first network device. This can ensure the normal operation of each first network device after the node to be deleted is deleted, and also ensure the load balancing of each management node during the migration of each first network device.
[0208] The above embodiment describes the process of migrating the first network device managed by the node to be deleted before deleting the node to be deleted. The following embodiment describes the process of disconnecting the node to be deleted from the first network device managed by the node to be deleted before deleting the node to be deleted.
[0209] In some possible implementations, before establishing a connection between the first network device and the third node, the method further includes:
[0210] A first disconnection instruction is sent to the node to be deleted, so that the node to be deleted is disconnected from the first network device.
[0211] Specifically, in the case where the third node actively establishes a connection with the first network device, the cloud server may instruct the node to be deleted to actively disconnect from the managed first network device.
[0212] Establishing a connection between the first network device and the third node includes:
[0213] The first device address of the first network device is sent to the third node, so that the third node establishes a connection with the first network device through the first device address.
[0214] Specifically, the cloud server instructs the node to be deleted to actively disconnect from the first network device to which it is connected, and then instructs the third node to actively connect to the first network device, thereby implementing the migration process of the first network device from the node to be deleted to the third node.
[0215] like Figure 6As shown, the cloud server sends a first disconnection instruction to the node to be deleted, and the node to be deleted actively disconnects from the first network device it manages; the cloud server sends the first device address of the first network device to the third node, and the third node establishes a connection with the first network device through the first device address.
[0216] In some possible implementations, before establishing a connection between the first network device and the third node, the method further includes:
[0217] Send a second disconnect to the node to be deleted.
[0218] The second disconnection is used to instruct the node to be deleted to disconnect from the first network device and no longer receive the connection from the first network device.
[0219] Establishing a connection between the first network device and the third node includes:
[0220] The association information between the first device identifier of the first network device and the node identifier of the third node is sent to the registration center, so that the registration center responds to the registration request of the first network device, queries the node address of the third node, and sends the node address of the third node to the first network device, so that the first network device is connected to the third node through the node address of the third node; the registration request of the first network device is generated by the first network device when it detects that it cannot connect to the node to be deleted.
[0221] Specifically, the cloud server sends a second disconnection to the node to be deleted, and the node to be deleted disconnects from the first network device and no longer receives the connection from the first network device; the cloud server sends the association information between the first device identifier of the first network device and the node identifier of the third node to the registration center; when the first network device finds that it cannot connect to the node to be deleted, it sends a registration request to the registration center, and the registration center responds to the registration request of the first network device, queries the node address of the third node, and sends the node address of the third node to the first network device, and the first network device actively connects to the third node.
[0222] like Figure 7 As shown, the cloud server sends a second disconnection instruction to the node to be deleted, and the node to be deleted actively disconnects from the first network device it manages; the cloud server sends the association information between the first device identifier of the first network device and the node identifier of the third node to the registration center; when the first network device finds that it cannot connect to the node to be deleted, it sends a registration request to the registration center, the registration center sends the node address of the third node to the first network device, and the first network device actively connects to the third node.
[0223] In the above embodiment, by introducing a registration center, the network device that actively initiates the connection can perceive the changes of the management node during operation, and thus actively connect to the new node; by managing the different current states of the nodes in the cloud server, abnormal situations of the management nodes can be automatically handled, reducing the resource investment of manual intervention and enhancing the reliability of the system.
[0224] In some possible implementations, the following further includes:
[0225] Sending a status query request to each management node in the management node set according to a preset period;
[0226] If no response information to the status query request is received from any management node within the preset time, the operation status of the management node is determined to be the second status;
[0227] For each network device managed by the management node, a new management node is determined respectively.
[0228] Specifically, the cloud server will be responsible for detecting the health status of all management nodes in the management node set. Each management node is equipped with an interface for querying the health status. As long as the management node operates normally, the interface will return success when receiving the request. The cloud server can query this interface regularly to know the health status of all nodes.
[0229] As shown in Table 1 below, Table 1 is the information of each management node stored in the database.
[0230]
[0231] Among them, a management node that is in a normal health state and is not in an added state or a deleted state is in a normal operating state, that is, the first state; otherwise, it is in the second state.
[0232] If a management node interface is found to be unresponsive during query, it means that there is a problem with the management node and the network devices managed by it need to be migrated to other network nodes. The migration process is similar to the process of deleting the node to be deleted, and all network devices managed by no corresponding management node will be reallocated.
[0233] It should be noted that the migration process of the network devices managed by the unhealthy management node is the same as the migration process of the network devices managed by the network device to be deleted, but the unhealthy management node does not necessarily need to be deleted.
[0234] In the specific implementation process, when handling the health check failure of the management node, the network devices managed by the management node will be reallocated to other management nodes in the cluster. In some extreme scenarios, such as network jitter of the management node set, a batch of management nodes will fail health checks at the same time. The cloud server handles these health check failure events at the same time, and the network devices on these unhealthy management nodes will be allocated to other healthy management nodes in the cluster, which may cause the load of these management nodes to increase sharply in a short period of time and cause abnormal operation. Continuing this will lead to an avalanche phenomenon of the management node set, batches of management nodes will run abnormally, and eventually drag down the entire management node set.
[0235] Specifically, the cloud server can only handle unhealthy status events of one management node at a time, that is, migrate the network devices managed by the management node to other management nodes. If a batch of unhealthy status events arrive, they must also be queued for processing. After the unhealthy status event of the previous management node is processed, when processing the unhealthy status event of the next management node, the previous management node is likely to have returned to normal, so the equipment on the next management node can be allocated to the previous management node. By analogy, the load of the management nodes in the management node set can eventually be balanced, and will not be severely tilted like a small number of management nodes, causing an avalanche.
[0236] The following will illustrate the process of adding and deleting management nodes in this application with examples.
[0237] like Figure 8 As shown, in one example, the process of adding and deleting a management node may include the following steps:
[0238] When adding a management node for the first time, the initial state of the management node is ADDING / UNHEALTHY (i.e. the second state), and the cloud server will do some initialization work, such as checking node parameters, verifying software versions, etc. After adding the management node, the state changes to NORMAL / UNHEALTHY, which is still the second state, and starts the health check.
[0239] The health status of the management node switches between HEALTHY and UNHEALTHY according to the result of the health check, that is, switches between the first state and the second state; if healthy, it is in the first state, and if unhealthy, it is in the second state;
[0240] When deleting a node, the state changes to DELETING / UNHEALTHY, which is the second state. After successful deletion, it enters the end state and deletes the node information. After a failed deletion, it enters DELETE_FAILED (deletion failure state) / UNHEALTHY. The failure of node deletion may be that there is no healthy node in the cluster to allocate when allocating a new node to the device, or the new node cannot establish a connection with the device after allocation.
[0241] The DELETE_FAILED / UNHEALTHY node can be deleted again by going through the deletion process again, or it can be added again to enter the ADDING state.
[0242] The above-mentioned device management method, when adding a new network device, determines the first nodes that are normally operating from the various management nodes in the management node set through the cloud server, and then determines the target node with the least number of managed devices from the first nodes based on the number of network devices managed by each first node, and determines the target node as the management node of the target network device, that is, assigning the newly added target network device to the target node with the smallest load, which can effectively balance the load of each device management node.
[0243] Furthermore, the node to be added is added to the management node set. When the network device is expanded, the corresponding management node can be determined from the updated management node set. While adding the new management node, the load balance between the management nodes can be guaranteed.
[0244] Furthermore, before the node to be deleted is deleted, for each first network device managed by the node to be deleted, based on the current status of each second node and the number of network devices managed, a third node is determined from each second node, and the third node is determined as the management node of the first network device. This can ensure the normal operation of each first network device after the node to be deleted is deleted, and also ensure the load balancing of each management node during the migration of each first network device.
[0245] Furthermore, by introducing a registration center, network devices that actively initiate connections can sense changes in management nodes during operation and actively connect to new nodes. By managing the different current states of management nodes in the cloud server, abnormal situations of management nodes can be automatically handled, reducing resource investment in manual intervention and enhancing system reliability.
[0246] like Fig. 9 As shown, in some possible implementations, a device management apparatus is provided, including:
[0247] A first determination module 901 is used to determine the current state of each management node in the management node set in response to a device addition request for a target network device; the management node is used to manage the network device, and the current state of the management node includes a first state and a second state, the first state represents the normal operation of the management node, and the second state represents the abnormal operation of the management node;
[0248] A second determining module 902 is used to determine first nodes that are operating normally from the management nodes based on the current status of the management nodes;
[0249] A query module 903 is used to query the number of network devices managed by each first node from a database; the database includes device identifiers of each network device managed by each first node;
[0250] A third determining module 904 is configured to determine, from among the first nodes, a target node with the least number of managed devices based on the number of network devices managed by the first nodes;
[0251] The connection module 905 is used to determine the target node as the management node of the target network device, establish a connection between the target node and the target network device, and update the database.
[0252] In some possible implementations, the device adding request carries a target device address of the target network device;
[0253] When establishing a connection between a target node and a target network device, the connection module 905 is specifically used to:
[0254] The target device address of the target network device is sent to the target node, so that the target node establishes a connection with the target network device through the target device address.
[0255] In some possible implementations, when establishing a connection between a target node and a target network device, the connection module 905 is specifically configured to:
[0256] The association information between the target device identifier of the target network device and the target node identifier of the target node to be assigned is sent to the registration center, so that the registration center responds to the registration request of the target network device, queries the node address of the target node identifier corresponding to the target device identifier carried in the registration request, and sends the node address to the target network device, so that the target network device is connected to the target node through the node address.
[0257] In some possible implementations, an additional module is further included for:
[0258] Obtain a node addition request for the management node; the node addition request carries a first node identifier of a node to be added;
[0259] Based on the first node identifier, adding the node to be added to the management node set;
[0260] The node addition request is generated based on any of the following methods:
[0261] In response to a new adding instruction for a node to be added, generating a node adding request;
[0262] When receiving the heartbeat information sent by the node to be added and detecting that the node to be added is not in the management node set, generating a node addition request;
[0263] It is detected that the number of devices managed by each management node in the management node set meets a first preset condition, a node to be added is determined from the standby node set, and a node addition request is generated.
[0264] In some possible implementations, a fourth determining module is further included, which is used to:
[0265] Determine the current state of the node to be added as the second state;
[0266] Also includes update modules for:
[0267] Update the current state of the node to be added to the first state.
[0268] In some possible implementations, a deletion module is further included, which is used to:
[0269] Obtaining a node deletion request for a management node; the node deletion request carries a second node identifier of a node to be deleted;
[0270] Based on the second node identifier, deleting the node to be deleted from the management node set;
[0271] The node deletion request is generated based on any of the following methods:
[0272] In response to a deletion instruction for a node to be deleted, generating a node deletion request;
[0273] It is detected that the number of devices managed by each management node in the management node set meets the second preset condition, and the number of devices managed by the node to be deleted meets the third preset condition, and a node deletion request is generated.
[0274] In some possible implementations, a fifth determining module is further included, configured to:
[0275] The current state of the node to be deleted is determined as the second state.
[0276] In some possible implementations, a sixth determining module is further included, configured to:
[0277] Determining at least one first network device managed by the node to be deleted;
[0278] For each first network device, based on the current state of each second node and the number of managed network devices, a third node is determined from each second node; the second node is a management node in the management node set except the node to be deleted;
[0279] The third node is determined as the management node of the first network device, and a connection is established between the first network device and the third node.
[0280] In some possible implementations, the system further includes a first sending module, which is used to:
[0281] Sending a first disconnection instruction to the node to be deleted, so that the node to be deleted is disconnected from the first network device;
[0282] When establishing a connection between the first network device and the third node, the connection module is specifically used to:
[0283] The first device address of the first network device is sent to the third node, so that the third node establishes a connection with the first network device through the first device address.
[0284] In some possible implementations, the device further includes a second sending module, which is used to:
[0285] Sending a second disconnection to the node to be deleted; the second disconnection is used to instruct the node to be deleted to disconnect from the first network device and no longer receive connections from the first network device;
[0286] When establishing a connection between the first network device and the third node, the connection module is specifically used to:
[0287] The association information between the first device identifier of the first network device and the node identifier of the third node is sent to the registration center, so that the registration center responds to the registration request of the first network device, queries the node address of the third node, and sends the node address of the third node to the first network device, so that the first network device is connected to the third node through the node address of the third node; the registration request of the first network device is generated by the first network device when it detects that it cannot connect to the node to be deleted.
[0288] In some possible implementations, a third sending module is further included, which is used to:
[0289] Sending a status query request to each management node in the management node set according to a preset period;
[0290] If no response information to the status query request is received from any management node within the preset time, the operation status of the management node is determined to be the second status;
[0291] For each network device managed by the management node, a new management node is determined respectively.
[0292] The above-mentioned device management apparatus, when adding a new network device, determines the first nodes that are operating normally from the management nodes in the management node set through the cloud server, and then determines the target node with the least number of managed devices from the first nodes based on the number of network devices managed by the first nodes, and determines the target node as the management node of the target network device, that is, assigning the newly added target network device to the target node with the smallest load, which can effectively balance the load of each device management node.
[0293] Furthermore, the node to be added is added to the management node set. When the network device is expanded, the corresponding management node can be determined from the updated management node set. While adding the new management node, the load balance between the management nodes can be guaranteed.
[0294] Furthermore, before the node to be deleted is deleted, for each first network device managed by the node to be deleted, based on the current status of each second node and the number of network devices managed, a third node is determined from each second node, and the third node is determined as the management node of the first network device. This can ensure the normal operation of each first network device after the node to be deleted is deleted, and also ensure the load balancing of each management node during the migration of each first network device.
[0295] Furthermore, by introducing a registration center, network devices that actively initiate connections can sense changes in management nodes during operation and actively connect to new nodes. By managing the different current states of management nodes in the cloud server, abnormal situations of management nodes can be automatically handled, reducing resource investment in manual intervention and enhancing system reliability.
[0296] The device of the embodiments of the present application can execute the method provided by the embodiments of the present application, and the implementation principles are similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.
[0297] An embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program stored in the memory, the method in any optional embodiment of the present application can be implemented.
[0298] Fig.10 FIG. 1 is a schematic diagram showing a structure of an electronic device to which an embodiment of the present invention is applicable. Fig.10As shown, the electronic device may be a server or a user terminal, and the electronic device may be used to implement the method provided in any embodiment of the present invention.
[0299] like Fig.10 As shown in FIG. 1 , the electronic device 1000 may mainly include at least one processor 1001 ( Fig.10 1002, a communication module 1003 and an input / output interface 1004, etc. Optionally, the components can be connected and communicated through a bus 1005. It should be noted that Fig.10 The structure of the electronic device 1000 shown in the figure is merely illustrative and does not constitute a limitation on the electronic device to which the method provided in the embodiment of the present application is applicable.
[0300] The memory 1002 may be used to store an operating system and an application program, etc. The application program may include a computer program that implements the method shown in the embodiment of the present invention when called by the processor 1001, and may also include a program for implementing other functions or services. The memory 1002 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and computer programs, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0301] The processor 1001 is connected to the memory 1002 via the bus 1005, and implements the corresponding functions by calling the application program stored in the memory 1002. Among them, the processor 1001 can be a CPU (Central Processing Unit), a general processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof, which can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. The processor 1001 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0302] The electronic device 1000 can be connected to the network through the communication module 1003 (which may include but is not limited to components such as a network interface) to communicate with other devices (such as a user terminal or a server, etc.) through the network to achieve data interaction, such as sending data to other devices or receiving data from other devices. Among them, the communication module 1003 may include a wired network interface and / or a wireless network interface, etc., that is, the communication module may include at least one of a wired communication module or a wireless communication module.
[0303] The electronic device 1000 can be connected to the required input / output devices, such as a keyboard, a display device, etc., through the input / output interface 1004. The electronic device 1000 itself can have a display device, and can also be connected to other display devices through the interface 1004. Optionally, a storage device, such as a hard disk, can also be connected through the interface 1004, so that data in the electronic device 1000 can be stored in the storage device, or data in the storage device can be read, and data in the storage device can also be stored in the memory 1002. It can be understood that the input / output interface 1004 can be a wired interface or a wireless interface. Depending on the actual application scenario, the device connected to the input / output interface 1004 can be a component of the electronic device 1000, or it can be an external device connected to the electronic device 1000 when needed.
[0304] The bus 1005 for connecting the components may include a path to transmit information between the above components. The bus 1005 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. According to different functions, the bus 1005 may be divided into an address bus, a data bus, a control bus, etc.
[0305] Optionally, for the solution provided by the embodiment of the present invention, the memory 1002 can be used to store a computer program for executing the solution of the present invention, and run by the processor 1001. When the processor 1001 runs the computer program, the action of the method or device provided by the embodiment of the present invention is implemented.
[0306] Based on the same principle as the method provided in the embodiment of the present application, the embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the corresponding content of the aforementioned method embodiment can be implemented.
[0307] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the corresponding content of the aforementioned method embodiment can be implemented.
[0308] It should be noted that the terms "first", "second", "third", "fourth", "1", "2", 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 numbers used in this way can be interchangeable where appropriate, so that the embodiments of the application described herein can be implemented in an order other than that shown or described in the drawings.
[0309] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios of execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.
[0310] The above is only an optional implementation method for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.
Claims
1. A device management method, characterized in that: The method comprises: In response to a device addition request for a target network device, determine a current state of each management node in a management node set; the management node is used to manage the network device, and the current state of the management node includes a first state and a second state, the first state represents that the management node is operating normally, and the second state represents that the management node is operating abnormally; Based on the current status of each of the management nodes, determining each first node that is operating normally from each of the management nodes; Querying the number of network devices managed by each first node from a database; the database includes device identifiers of each network device managed by each first node; Based on the number of network devices managed by each of the first nodes, determining a target node with the least number of devices managed by each of the first nodes; The target node is determined as the management node of the target network device, a connection between the target node and the target network device is established, and the database is updated.
2. The method according to claim 1, characterized in that The device adding request carries a target device address of a target network device; The establishing a connection between the target node and the target network device includes: The target device address of the target network device is sent to the target node, so that the target node establishes a connection with the target network device through the target device address.
3. The method according to claim 1, characterized in that The establishing a connection between the target node and the target network device includes: The association information between the target device identifier of the target network device and the target node identifier of the target node to be assigned is sent to the registration center, so that the registration center responds to the registration request of the target network device, queries the node address of the target node identifier corresponding to the target device identifier carried in the registration request, and sends the node address to the target network device, so that the target network device is connected to the target node through the node address.
4. The method according to claim 1, characterized in that Also includes: Get the node addition request for the management node; The node adding request carries a first node identifier of a node to be added; Based on the first node identifier, adding the node to be added to the management node set; The node addition request is generated based on any of the following methods: In response to a new adding instruction for a node to be added, generating the node adding request; When receiving the heartbeat information sent by the node to be added and detecting that the node to be added is not in the management node set, generating the node addition request; It is detected that the number of devices managed by each management node in the management node set meets a first preset condition, the node to be added is determined from the standby node set, and the node addition request is generated.
5. The method according to claim 4, characterized in that Before adding the node to be added to the management node set based on the first node identifier, the method further includes: Determine the current state of the node to be added as the second state; After adding the node to be added to the management node set based on the first node identifier, the method further includes: The current state of the node to be added is updated to the first state.
6. The method according to claim 1, characterized in that Also includes: Get the node deletion request for the management node; The node deletion request carries a second node identifier of the node to be deleted; Based on the second node identifier, deleting the node to be deleted from the management node set; The node deletion request is generated based on any of the following methods: In response to a deletion instruction for a node to be deleted, generating the node deletion request; It is detected that the number of devices managed by each management node in the management node set meets the second preset condition, and the number of devices managed by the node to be deleted meets the third preset condition, and the node deletion request is generated.
7. The method according to claim 6, characterized in that Before deleting the node to be deleted from the management node set based on the second node identifier, the method further includes: The current state of the node to be deleted is determined as the second state.
8. The method according to claim 6, characterized in that Before deleting the node to be deleted from the management node set based on the second node identifier, the method further includes: Determining at least one first network device managed by the node to be deleted; For each first network device, based on the current state of each second node and the number of managed network devices, determine a third node from each second node; the second node is a management node in the management node set other than the node to be deleted; The third node is determined as the management node of the first network device, and a connection is established between the first network device and the third node.
9. The method according to claim 8, characterized in that Before establishing the connection between the first network device and the third node, the method further includes: Sending a first disconnection instruction to the node to be deleted, so that the node to be deleted is disconnected from the first network device; The establishing a connection between the first network device and the third node includes: The first device address of the first network device is sent to the third node, so that the third node establishes a connection with the first network device through the first device address.
10. The method according to claim 8, characterized in that Before establishing the connection between the first network device and the third node, the method further includes: Sending a second disconnection connection to the to-be-deleted node; the second disconnection connection is used to instruct the to-be-deleted node to disconnect from the first network device and no longer receive a connection from the first network device; The establishing a connection between the first network device and the third node includes: The association information between the first device identifier of the first network device and the node identifier of the third node is sent to a registration center, so that the registration center responds to the registration request of the first network device, queries the node address of the third node, and sends the node address of the third node to the first network device, so that the first network device is connected to the third node through the node address of the third node; the registration request of the first network device is generated by the first network device when it detects that the node to be deleted cannot be connected.
11. The method according to claim 1, characterized in that: Also includes: Sending a status query request to each management node in the management node set according to a preset period; If no response information of any management node to the status query request is received within a preset time, the operation status of the management node is determined to be a second status; For each network device managed by the management node, a new management node is determined respectively.
12. A device management apparatus, characterized in that: The device comprises: A first determination module is used to determine the current state of each management node in the management node set in response to a device addition request for a target network device; the management node is used to manage the network device, and the current state of the management node includes a first state and a second state, the first state represents that the management node is operating normally, and the second state represents that the management node is operating abnormally; A second determining module, configured to determine first nodes that are operating normally from the management nodes based on a current state of the management nodes; A query module, used to query the number of network devices managed by each first node from a database; the database includes device identifiers of each network device managed by each first node; A third determining module, configured to determine, from each of the first nodes, a target node with the least number of managed devices based on the number of network devices managed by each of the first nodes; A connection module is used to determine the target node as the management node of the target network device, establish a connection between the target node and the target network device, and update the database.
13. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the computer program to implement the method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.