Service management method and device, electronic equipment and storage medium

By obtaining and updating the deployment information of the distributed cluster, identifying and starting the only required target services, the problems of inefficiency and resource waste in the distributed cluster are solved, and efficient utilization of resources is achieved.

CN119225925APending Publication Date: 2024-12-31JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411231091.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Inefficiency and waste of resources due to automatic activation of all services in distributed clusters.

Method used

By obtaining deployment information, updating database parameters, identifying and starting only target services, controlling the startup of each target service, reducing unnecessary service startup, and improving resource utilization.

Benefits of technology

It improves the task efficiency of distributed clusters, reduces resource waste, and ensures the normal operation of the cluster and efficient utilization of resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225925A_ABST
    Figure CN119225925A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of service management, in particular to a service management method and device, electronic equipment and a storage medium. Acquiring deployment information corresponding to the distributed cluster; according to the deployment information, parameter information in a database corresponding to the distributed cluster is updated, and first current parameter information is generated; identifying the first current parameter information, and determining a target service needing to be started in the distributed cluster; and controlling each target service to start. And all services in the distributed cluster do not need to be started. Therefore, under the condition that normal work of the distributed cluster is guaranteed, the number of the target services started in the distributed cluster is reduced, then the task completion efficiency of the distributed cluster can be improved, the resource utilization rate in the distributed cluster is improved, and waste of resources in the distributed cluster is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of service management, and in particular to a service management method, device, electronic device and storage medium. Background Art

[0002] As the business grows, the architecture of distributed cluster systems becomes increasingly complex. In many cases, there are many nodes in a distributed cluster, and the services in each node are also very complex.

[0003] In the prior art, when a cluster is deployed, all services are usually automatically enabled, which results in a large number of services being started in the distributed cluster and occupying a large amount of resources.

[0004] Therefore, the above method results in low efficiency of the distributed cluster in completing tasks and leads to waste of resources. Summary of the invention

[0005] In view of this, the present invention provides a service management method, device, electronic device and storage medium to solve the problem that the prior art causes low efficiency of distributed clusters in completing tasks and causes waste of resources.

[0006] In a first aspect, the present invention provides a service management method, the method comprising:

[0007] Get the deployment information corresponding to the distributed cluster;

[0008] According to the deployment information, the parameter information in the database corresponding to the distributed cluster is updated to generate first current parameter information;

[0009] Identify the first current parameter information and determine the target service that needs to be started in the distributed cluster;

[0010] Control the startup of each target service.

[0011] The embodiment of the present application provides a service management method, which obtains the deployment information corresponding to the distributed cluster; based on the deployment information, the parameter information in the database corresponding to the distributed cluster is updated to generate the first current parameter information, thereby ensuring the accuracy of the generated first current parameter information. The first current parameter information is identified to determine the target service that needs to be started in the distributed cluster, thereby ensuring the accuracy of the target task that needs to be started. The startup of each target service is controlled, thereby eliminating the need to start all services in the distributed cluster. Thereby, while ensuring the normal operation of the distributed cluster, the number of target services started in the distributed cluster is reduced, thereby improving the efficiency of the distributed cluster in completing tasks, and improving the resource utilization in the distributed cluster, thereby avoiding the waste of resources in the distributed cluster.

[0012] In an optional implementation, controlling each target service to start includes:

[0013] Identify the first current parameter information, and search therefrom for system platform parameters corresponding to the distributed cluster and service instance parameters corresponding to each target service;

[0014] Start each target service according to the system platform parameters and the service instance parameters corresponding to each target service.

[0015] An embodiment of the present application provides a service management method, which identifies the first current parameter information, and searches therefrom for the system platform parameters corresponding to the distributed cluster and the service instance parameters corresponding to each target service; starts each target service according to the system platform parameters and the service instance parameters corresponding to each target service, thereby ensuring the accuracy of each started target service.

[0016] In an optional implementation, starting each target service according to the system platform parameter and the service instance parameter corresponding to each target service includes:

[0017] Generate target configuration files corresponding to each target service based on system platform parameters and service instance parameters;

[0018] Start each target service according to each target configuration file.

[0019] The embodiment of the present application provides a service management method, which generates a target configuration file corresponding to each target service according to the system platform parameters and each service instance parameter, thereby ensuring the accuracy of the generated target configuration file corresponding to each target service. According to each target configuration file, each target service is started, thereby ensuring the accuracy of starting the target service.

[0020] In an optional embodiment, the method further includes:

[0021] Receive service operation instructions corresponding to the distributed cluster input by the user;

[0022] According to the service operation instruction, the first current parameter information in the database is updated to generate the second current parameter information;

[0023] According to the second current parameter information, operations are performed on each current service corresponding to the distributed cluster.

[0024] The embodiment of the present application provides a service management method, receiving a service operation instruction corresponding to a distributed cluster input by a user; according to the service operation instruction, updating the first current parameter information in the database, generating the second current parameter information, and ensuring the accuracy of the generated second current parameter information. According to the second current parameter information, operating each current service corresponding to the distributed cluster, ensuring the accuracy of the operation on each current service.

[0025] In an optional embodiment, the method further includes:

[0026] Receive cluster upgrade instructions input by users, where the cluster upgrade instructions are used to upgrade the distributed cluster;

[0027] According to the cluster upgrade instructions, identify each current service in the distributed cluster;

[0028] Determine the services to be restarted from the current services;

[0029] Restart each service to be restarted and upgrade the distributed cluster;

[0030] Update the upgrade status and upgrade time of the distributed cluster.

[0031] The embodiment of the present application provides a service management method, which receives a cluster upgrade instruction input by a user, and identifies each current service in a distributed cluster according to the cluster upgrade instruction, thereby ensuring the accuracy of identifying each current service in the distributed cluster. From each current service, determine the service to be restarted that needs to be restarted, thereby ensuring the accuracy of the service to be restarted that needs to be restarted. Restart each service to be restarted, and upgrade the distributed cluster, thereby ensuring the accuracy of upgrading the distributed cluster. Update the upgrade status and upgrade time corresponding to the distributed cluster, ensure the accuracy of the upgrade status and upgrade time corresponding to the updated distributed cluster, and then trace the upgrade of the distributed cluster.

[0032] In an optional embodiment, the method further includes:

[0033] Monitor the master database in the distributed cluster to detect whether any abnormality occurs in the master database;

[0034] When an exception occurs in the main database, obtain the current running data and current running services corresponding to the main database;

[0035] Find the backup slave database corresponding to the master database; the backup slave database is the backup database of the master database on the slave node in the distributed cluster, and the data in the backup slave database is consistent with the data in the master database;

[0036] Disconnect from the main database;

[0037] Connect to the backup slave database;

[0038] Find the current running data from the backup database;

[0039] Based on the current running data, each currently running service is controlled to continue running.

[0040] The embodiment of the present application provides a service management method, which monitors the main database in the distributed cluster, detects whether the main database has an abnormality, and ensures the accuracy of the detection results. When an abnormality occurs in the main database, the current operating data and the current operating services corresponding to the main database are obtained, which ensures the accuracy of the current operating data and the current operating services corresponding to the main database, and then after the main database is replaced, it can continue to work based on the current operating data and the current operating services. Find the backup slave database corresponding to the main database to ensure the accuracy of the backup slave database corresponding to the main database. Disconnect the connection with the main database; connect to the backup slave database, thereby realizing the switching from the main database to the slave database of the distributed cluster. Find the current operating data from the backup slave database, and control each currently operating service to continue to run based on the current operating data, so as to ensure the accuracy of controlling each currently operating service to continue to run, and avoid errors in the current operating service.

[0041] In an optional embodiment, the method further includes:

[0042] Get the upgrade package corresponding to the service to be upgraded in the distributed cluster;

[0043] Load the upgrade package to upgrade the service.

[0044] The embodiment of the present application provides a service management method, which obtains an upgrade package corresponding to a service to be upgraded in a distributed cluster; loads the upgrade package, and upgrades the service to be upgraded, thereby ensuring the accuracy of upgrading the service to be upgraded.

[0045] In a second aspect, the present invention provides a service management device, the device comprising:

[0046] The acquisition module is used to obtain the deployment information corresponding to the distributed cluster;

[0047] An updating module, used to update the parameter information in the database corresponding to the distributed cluster according to the deployment information, and generate first current parameter information;

[0048] A determination module, used to identify the first current parameter information and determine a target service that needs to be started in the distributed cluster;

[0049] The control module is used to control each target service device.

[0050] The embodiment of the present application provides a service management device, which obtains the deployment information corresponding to the distributed cluster; based on the deployment information, the parameter information in the database corresponding to the distributed cluster is updated to generate the first current parameter information, thereby ensuring the accuracy of the generated first current parameter information. The first current parameter information is identified to determine the target service that needs to be started in the distributed cluster, thereby ensuring the accuracy of the target task that needs to be started. The startup of each target service is controlled, thereby eliminating the need to start all services in the distributed cluster. Thereby, while ensuring the normal operation of the distributed cluster, the number of target services started in the distributed cluster is reduced, thereby improving the efficiency of the distributed cluster in completing tasks, and improving the resource utilization in the distributed cluster, thereby avoiding the waste of resources in the distributed cluster.

[0051] In a third aspect, the present invention provides an electronic device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the service management method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0052] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the service management method of the first aspect or any corresponding embodiment thereof.

[0053] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the service management method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0055] Figure 1 is a flow chart of a first service management method according to an embodiment of the present invention;

[0056] Figure 2 is a flow chart of a second service management method according to an embodiment of the present invention;

[0057] Figure 3is a flow chart of a third service management method according to an embodiment of the present invention;

[0058] Figure 4 is a flowchart of a fourth service management method according to an embodiment of the present invention;

[0059] Figure 5 is a flowchart of a fifth service management method according to an embodiment of the present invention;

[0060] Figure 6 is a flow chart of a sixth service management method according to an embodiment of the present invention;

[0061] Figure 7 is a schematic diagram of the structure of a distributed cluster according to an embodiment of the present invention;

[0062] Figure 8 is a structural block diagram of a service management device according to an embodiment of the present invention;

[0063] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0065] It should be noted that the execution subject of the service management method provided in the embodiment of the present application may be a service management device, and the service management device may be implemented as part or all of an electronic device through software, hardware, or a combination of software and hardware, wherein the electronic device may be any node in a distributed cluster. In the following method embodiments, the execution subject is an electronic device as an example for explanation.

[0066] According to an embodiment of the present invention, a service management method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0067] In this embodiment, a service management method is provided, which can be used for the above-mentioned electronic device. Figure 1 is a flow chart of a service management method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0068] Step S101, obtaining deployment information corresponding to the distributed cluster.

[0069] Specifically, the electronic device may search for a configuration file corresponding to the distributed cluster in a storage space corresponding to the distributed cluster, and then identify the configuration file to determine deployment information corresponding to the distributed cluster.

[0070] The deployment information may include information such as the address, node information, and port of the cluster. The embodiments of the present application do not specifically limit the deployment information.

[0071] Step S102: updating parameter information in a database corresponding to the distributed cluster according to the deployment information to generate first current parameter information.

[0072] Specifically, the electronic device can analyze the acquired deployment information, wherein the deployment information may include configuration, node information, service status, etc. of the distributed cluster. By parsing this information, the database parameters that need to be updated and their specific locations can be determined.

[0073] The electronic device then uses an appropriate database connection method to establish a connection to the database corresponding to the distributed cluster. This may involve using a database driver, providing a database connection string, user name, and password to ensure that the database can be successfully accessed.

[0074] Once the database connection is established, the electronic device can update the parameter information in the database according to the instructions in the deployment information. This may include modifying existing parameter values, adding new parameters, or deleting parameters that are no longer needed. The update operation can be completed by executing SQL statements or using specific database management tools.

[0075] After completing the update of the parameter information, it is necessary to generate the first current parameter information. This can be achieved by querying the database or obtaining the updated parameter value. The first current parameter information represents the current state of the updated database parameter.

[0076] Step S103: Identify the first current parameter information and determine the target service that needs to be started in the distributed cluster.

[0077] Specifically, the electronic device may parse the first current parameter information. The parameter information may include content related to the configuration of the distributed cluster, service status, environmental variables, etc. By carefully analyzing the first current parameter, key information related to service startup may be extracted.

[0078] Next, the electronic device determines the definition and startup rules of the service based on the architecture and design of the distributed cluster. This may include the name of the service, dependencies, startup conditions, etc. These rules are usually defined in the cluster's configuration files, service lists, or other related documents.

[0079] Then, based on the parsed parameter information and service definition rules, all services in the distributed cluster are screened. According to the distributed cluster work requirements and target tasks, the target services that need to be started for the distributed cluster to complete the work and target tasks are determined.

[0080] Optionally, when determining the target services that need to be started, the electronic device can also perform a detailed analysis of the dependencies between the various target services. Understand which services depend on other services, as well as the degree and type of dependence. Then, determine the critical paths in the entire system, that is, those service chains that are critical to the normal operation of the system. Services on these critical paths usually have a higher priority. The electronic device divides services into different levels according to the hierarchy of dependencies. Bottom-level services are usually relied on by upper-level services, so the priority of bottom-level services may be relatively high. Then, consider the importance of each target service in the business. If some services are critical to the key functions or core processes of the business, then their priority should be higher. In addition, the electronic device can also analyze the resource requirements of each target service, including computing resources, memory, network bandwidth, etc. Then, according to the resource requirements of each target service, adjust the corresponding priority of each target service.

[0081] Step S104, controlling each target service to start.

[0082] Specifically, after determining each target service, the electronic device may control each target service to start.

[0083] This step will be described in detail below.

[0084] The embodiment of the present application provides a service management method, which obtains the deployment information corresponding to the distributed cluster; based on the deployment information, the parameter information in the database corresponding to the distributed cluster is updated to generate the first current parameter information, thereby ensuring the accuracy of the generated first current parameter information. The first current parameter information is identified to determine the target service that needs to be started in the distributed cluster, thereby ensuring the accuracy of the target task that needs to be started. The startup of each target service is controlled, thereby eliminating the need to start all services in the distributed cluster. Thereby, while ensuring the normal operation of the distributed cluster, the number of target services started in the distributed cluster is reduced, thereby improving the efficiency of the distributed cluster in completing tasks, and improving the resource utilization in the distributed cluster, thereby avoiding the waste of resources in the distributed cluster.

[0085] In this embodiment, a service management method is provided, which can be used for the above-mentioned electronic device. Figure 2 is a flow chart of a service management method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0086] Step S201, obtaining deployment information corresponding to the distributed cluster.

[0087] For details about this step, please refer to the above description of step S101, which will not be elaborated here.

[0088] Step S202: Update the parameter information in the database corresponding to the distributed cluster according to the deployment information to generate first current parameter information.

[0089] For details about this step, please refer to the above description of step S102, which will not be elaborated here.

[0090] Step S203: Identify the first current parameter information and determine the target service that needs to be started in the distributed cluster.

[0091] For details about this step, please refer to the above description of step S103, which will not be elaborated here.

[0092] Step S204, controlling each target service to start.

[0093] Specifically, the above step S204 may include the following steps:

[0094] Step S2041: Identify the first current parameter information, and search therefrom for system platform parameters corresponding to the distributed cluster and service instance parameters corresponding to each target service.

[0095] Specifically, the electronic device may parse the first current parameter information. The first current parameter information may include content related to the configuration, service status, and environment variables of the distributed cluster. The electronic device may extract key information related to the system platform and service instance corresponding to the distributed cluster by parsing the first current parameter information.

[0096] Then, in the key information obtained by parsing, the system platform parameters corresponding to the distributed cluster are searched. The system platform parameters may include the number of nodes, node configuration, network settings, storage configuration, etc. of the cluster. Then, the electronic device searches for the service instance parameters corresponding to each target service. The service instance parameters may include the version number of the service, the configuration file path, the startup parameters, the dependent library, etc.

[0097] Optionally, the electronic device classifies and organizes the found system platform parameters and service instance parameters according to parameter types, services they belong to, or other relevant standards, so as to better manage and use the system platform parameters and service instance parameters.

[0098] Step S2042: starting each target service according to the system platform parameters and the service instance parameters corresponding to each target service.

[0099] Specifically, the above step S2042 may include the following steps:

[0100] Step a1: Generate a target configuration file corresponding to each target service according to the system platform parameters and each service instance parameter.

[0101] Specifically, the electronic device can select a configuration template suitable for the target service. The configuration template corresponding to the target service can be pre-defined and contain various configuration items and parameters required for the service. Then, the electronic device maps the system platform parameters and each service instance parameter to the corresponding position in the configuration template. Optionally, the electronic device can use parameter replacement or variable assignment to fill in the actual parameter value into the placeholder in the template.

[0102] The electronic device then customizes or adjusts certain configuration items based on specific needs. This can include modifying default values, adding specific configuration options, or personalizing settings based on the environment. Next, the electronic device uses the mapped and customized parameters to generate target configuration files corresponding to each target service.

[0103] Optionally, after generating the target configuration file corresponding to the target service, the electronic device may verify it to ensure its correctness and completeness. Optionally, the electronic device may check the syntax, format and rationality of parameters of the target configuration file to ensure that there are no missing or erroneous configuration items.

[0104] Step a2: start each target service according to each target configuration file.

[0105] Specifically, the electronic device can read the target configuration file corresponding to each target service. Among them, the target configuration file contains various settings and parameters of the service, such as the port number of the service, database connection information, log level, etc. Then, before starting the target service, the electronic device can prepare the corresponding environment according to the requirements in the target configuration file. This may include creating directories, setting permissions, loading dependent libraries, etc. After the environment is ready, the electronic device can use the corresponding commands or scripts to start the target service. These commands or scripts usually set the operating parameters of the service according to the parameters in the configuration file and start the service process.

[0106] Optionally, after the target service is started, the electronic device can monitor each target service to ensure that the target service is running normally. The electronic device can monitor the process status, resource usage, log output, etc. of the target service. If an abnormality is found in the target service, the electronic device can take corresponding measures to handle it, such as restarting the service, sending an alarm, etc.

[0107] Optionally, if the target configuration file needs to be updated during the operation of the target service, the electronic device can first stop the target service, then read the updated target configuration file, and restart the target service, so as to ensure that the target service always uses the latest configuration information during operation.

[0108] The embodiment of the present application provides a service management method, which identifies the first current parameter information, searches for the system platform parameters corresponding to the distributed cluster and the service instance parameters corresponding to each target service; generates a target configuration file corresponding to each target service according to the system platform parameters and each service instance parameter, and ensures the accuracy of the generated target configuration file corresponding to each target service. According to each target configuration file, each target service is started, and the accuracy of starting the target service is ensured.

[0109] In an optional embodiment of the present application, Figure 3 As shown, the above service management method may further include the following steps:

[0110] Step S301: receiving a service operation instruction corresponding to a distributed cluster input by a user.

[0111] Specifically, the user inputs a service operation instruction through an interactive interface or command line with the distributed cluster, wherein the service operation instruction may be an operation such as adding, deleting or modifying service parameters of a service in the distributed cluster.

[0112] Step S302: According to the service operation instruction, the first current parameter information in the database is updated to generate second current parameter information.

[0113] Specifically, after receiving the service operation instruction input by the user, the electronic device parses the service operation instruction, which may include identifying the type of the service operation instruction, the target service, and related parameters.

[0114] Then, the electronic device reads the first current parameter information currently stored from the database. The first current parameter information may include content related to the configuration, service status, and environmental variables of the distributed cluster. The electronic device makes corresponding changes and updates to the first current parameter information according to the parsed service operation instructions. This may involve modifying the configuration parameters of the service, updating the status information of the service, etc. After completing the parameter update, the electronic device generates the updated second current parameter information and stores the second current parameter information back in the database for subsequent query and use.

[0115] Step S303: operating each current service corresponding to the distributed cluster according to the second current parameter information.

[0116] Specifically, the electronic device can parse the acquired second current parameter information to extract key information such as the identification, status, and configuration parameters of each current service. Then, based on the parsed parameter information, determine the type of operation that needs to be performed on each current service. Among them, the operation type may include starting a service, stopping a service, updating a service configuration, and redeploying a service. For each current service, the electronic device can perform a corresponding operation based on the determined operation type. The corresponding operation may include: sending a control command to a service node, updating a configuration file, triggering a deployment process, and other specific operation steps.

[0117] The embodiment of the present application provides a service management method, receiving a service operation instruction corresponding to a distributed cluster input by a user; according to the service operation instruction, updating the first current parameter information in the database, generating the second current parameter information, and ensuring the accuracy of the generated second current parameter information. According to the second current parameter information, operating each current service corresponding to the distributed cluster, ensuring the accuracy of the operation on each current service.

[0118] In an optional embodiment of the present application, Figure 4 As shown, the above service management method may further include the following steps:

[0119] Step S401: receiving a cluster upgrade instruction input by a user.

[0120] Among them, the cluster upgrade instruction is used to upgrade the distributed cluster.

[0121] Specifically, the user may input a cluster upgrade instruction through an interactive interface or a command line with the distributed cluster, so that the electronic device may receive the cluster upgrade instruction input by the user.

[0122] Step S402: identifying each current service in the distributed cluster according to the cluster upgrade instruction.

[0123] Specifically, the electronic device can parse the received cluster upgrade instruction to determine the service scope and specific requirements that need to be upgraded. Then, the electronic device obtains the currently running service list from the management system or configuration file of the distributed cluster. According to the parsed upgrade instruction and the obtained current service list, each current service in the distributed cluster is identified.

[0124] Step S403: Determine the service to be restarted that needs to be restarted from the current services.

[0125] Specifically, the electronic device can determine whether each current service is abnormal or needs to be restarted based on the results of identifying each current service. This may involve checking the key indicators, error codes, resource usage, etc. of the service. Then, the electronic device defines the conditions under which the service needs to be restarted based on the design and requirements of the distributed cluster. These conditions may include situations based on specific error types, service performance degradation, resource exhaustion, etc. The electronic device can screen each current service according to the defined restart conditions and determine the services to be restarted that meet the conditions. The electronic device marks the screened services to be restarted for subsequent restart operations.

[0126] Step S404: restart each service to be restarted and upgrade the distributed cluster.

[0127] Specifically, the electronic device can develop a detailed restart plan based on the number and importance of the services to be restarted. The plan may include the order, time intervals, and possible backup measures of the restart. Before the electronic device restarts, it notifies all relevant personnel, including users, administrators, and other relevant parties. Inform them of the time of the restart, the expected impact, and any necessary precautions. Before the restart, the electronic device can back up all important data to prevent data loss or corruption. This can include databases, configuration files, and other critical data. Then, the electronic device restarts each service to be restarted in turn according to the restart plan. This may involve steps such as stopping the service, updating the configuration file, and restarting the service. During the restart process, the electronic device can closely monitor the status and performance of the service. Ensure that the service can start normally and check for any errors or abnormalities. After the service restarts, the electronic device can verify whether its function is normal. Perform some basic tests to ensure that the service can respond to requests correctly and provide the expected results.

[0128] Next, after all services to be restarted are restarted, the electronic device can perform the upgrade operation of the distributed cluster. This may involve steps such as updating software versions, installing patches, and adjusting configurations. During the upgrade process, the electronic device may also need to closely monitor the status and performance of the distributed cluster. Ensure that the upgrade process goes smoothly and check for any problems or anomalies. After the upgrade is complete, verify that the distributed cluster is functioning properly. Perform some comprehensive tests to ensure that the cluster is functioning properly and providing the expected performance and functionality.

[0129] Step S405: update the upgrade status and upgrade time corresponding to the distributed cluster.

[0130] Specifically, the electronic device can determine the upgrade status of the distributed cluster. This can be determined by checking the completion of each stage or task in the upgrade process. The upgrade status can be "upgrading", "upgrade successful", "upgrade failed", etc. The electronic device then updates it to the corresponding system or record based on the determined upgrade status. This can be a management system, configuration file, database or other relevant storage location of the distributed cluster. At the same time, the electronic device records the upgrade time of the distributed cluster. The upgrade time can be the time when the upgrade starts, the time when the upgrade is completed, or other relevant time points. Recording the upgrade time can help track the progress and history of the upgrade.

[0131] The embodiment of the present application provides a service management method, which receives a cluster upgrade instruction input by a user, and identifies each current service in a distributed cluster according to the cluster upgrade instruction, thereby ensuring the accuracy of identifying each current service in the distributed cluster. From each current service, determine the service to be restarted that needs to be restarted, thereby ensuring the accuracy of the service to be restarted that needs to be restarted. Restart each service to be restarted, and upgrade the distributed cluster, thereby ensuring the accuracy of upgrading the distributed cluster. Update the upgrade status and upgrade time corresponding to the distributed cluster, ensure the accuracy of the upgrade status and upgrade time corresponding to the updated distributed cluster, and then trace the upgrade of the distributed cluster.

[0132] In an optional embodiment of the present application, Figure 5 As shown, the above service management method may further include the following steps:

[0133] Step S501 , monitor the main database in the distributed cluster to detect whether an abnormality occurs in the main database.

[0134] Specifically, the electronic device can determine the indicators of the main database to be monitored. These indicators may include performance indicators of the database (such as CPU usage, memory usage, disk I / O, etc.), the number of database connections, transaction processing rate, error log, etc. Then, the electronic device selects a suitable monitoring tool based on the determined monitoring indicators and configures the monitoring of the main database. This includes setting the monitoring frequency, monitoring indicators, alarm thresholds, etc. Among them, you can use the monitoring tools that come with the database, or you can use third-party monitoring tools. Some common monitoring tools include Nagios, Zabbix, Prometheus, etc.

[0135] Then, the electronic device obtains the monitoring data of the main database collected by the monitoring tool at the configured frequency, and analyzes the collected monitoring data to detect whether an abnormality occurs in the main database. The analysis function provided by the data analysis tool or the monitoring system can be used to identify abnormal patterns, trends and potential problems.

[0136] Step S502: when an exception occurs in the main database, the current running data and the current running service corresponding to the main database are obtained.

[0137] Specifically, when an abnormality occurs in the main database, such as a failure, performance degradation or other abnormalities, the electronic device can trigger a corresponding mechanism to obtain the current operating data and current operating services of the main database.

[0138] Optionally, the electronic device can establish a connection with the main database using an appropriate database connection method. Then, use SQL statements or other data query methods to obtain the current running data in the main database. This may include data in a database table, data in a cache, or other related data. Then, the electronic device can determine the currently running services related to the main database, which may rely on the main database to provide data or perform operations.

[0139] Step S503, searching for the backup slave database corresponding to the master database.

[0140] The backup slave database is a backup database of the master database on the slave node in the distributed cluster. The data in the backup slave database is consistent with the data in the master database.

[0141] Specifically, the electronic device can determine the backup strategy of the master database. The backup strategy usually includes the frequency of backup, the storage location of the backup, and the retention strategy of the backup. The electronic device checks the configuration file of the master database. The configuration file may contain the connection information, address or other related configurations of the backup slave database. Then, the electronic device uses the tools or commands provided by the database management system to query whether there is a backup slave database corresponding to the master database in the system. If the backup is stored in a specific directory, the backup directory can be checked to find possible backup slave databases. The backup directory may contain copies of backup files or databases. Thereby, the backup slave database corresponding to the master database is found.

[0142] Step S504: disconnect the connection with the main database.

[0143] Specifically, the electronic device can determine the way to establish a connection with the main database, such as the programming language, database driver or connection library used. Then, the electronic device calls the corresponding method to disconnect the connection with the main database according to the connection method used. This is usually achieved by calling a specific method of the connection object.

[0144] During the disconnection process, abnormal situations may occur, such as network problems or database errors. Appropriate exception handling mechanisms need to be added to the code to ensure that exceptions are properly handled and resources are released when they occur. After disconnecting, the electronic device can also release resources related to the connection, such as memory, file handles, etc. This can be done by closing the connection object, releasing related variables, or performing other necessary cleanup operations. In addition, the electronic device can also confirm that the connection to the primary database has been successfully disconnected by checking the connection status or performing other related verification operations.

[0145] Step S505, connecting to the backup slave database.

[0146] Specifically, the electronic device can obtain the location of the backup slave database, such as the address and port number of the server. Then, the electronic device selects an appropriate connection method according to the type of the backup slave database. Common connection methods include using a database management tool (such as MySQL Workbench, SQL Server Management Studio, etc.) or connecting through a programming interface (such as JDBC, ODBC, etc.). Then, in the connection tool or programming interface, configure the connection parameters. After configuring the connection parameters, connect to the backup slave database.

[0147] Step S506, searching the backup database for current running data.

[0148] Specifically, the electronic device may identify each data in the backup slave database, and search the backup slave database for the current running data according to the identification result.

[0149] Step S507: Based on the current running data, control each currently running service to continue running.

[0150] Specifically, the electronic device can analyze the current operation data to understand the current operation status of each currently running service, and then control each currently running service to continue running based on the current operation status of each currently running service.

[0151] The embodiment of the present application provides a service management method, which monitors the main database in the distributed cluster, detects whether the main database has an abnormality, and ensures the accuracy of the detection results. When an abnormality occurs in the main database, the current operating data and the current operating services corresponding to the main database are obtained, which ensures the accuracy of the current operating data and the current operating services corresponding to the main database, and then after the main database is replaced, it can continue to work based on the current operating data and the current operating services. Find the backup slave database corresponding to the main database to ensure the accuracy of the backup slave database corresponding to the main database. Disconnect the connection with the main database; connect to the backup slave database, thereby realizing the switching from the main database to the slave database of the distributed cluster. Find the current operating data from the backup slave database, and control each currently operating service to continue to run based on the current operating data, so as to ensure the accuracy of controlling each currently operating service to continue to run, and avoid errors in the current operating service.

[0152] In an optional embodiment of the present application, Figure 6 As shown, the above service management method may further include the following steps:

[0153] Step S601: Obtain an upgrade package corresponding to the service to be upgraded in the distributed cluster.

[0154] Specifically, the electronic device can receive the upgrade package corresponding to the service to be upgraded in the distributed cluster input by the user, the electronic device can also obtain the upgrade package corresponding to the service to be upgraded in the distributed cluster from the server, and the electronic device can also receive the upgrade package corresponding to the service to be upgraded in the distributed cluster sent by other devices.

[0155] The embodiment of the present application does not specifically limit the manner in which the electronic device obtains the upgrade package corresponding to the service to be upgraded in the distributed cluster.

[0156] Step S602: load the upgrade package to upgrade the service to be upgraded.

[0157] Specifically, after obtaining the upgrade package corresponding to the service to be upgraded, the electronic device can stop the service to be upgraded through a service management tool, a command line interface or other related management methods. Stopping the service to be upgraded can ensure that no new requests will be received during the upgrade process, thereby avoiding data loss or other potential problems. Before upgrading, the electronic device can back up the data of the service to be upgraded. In this way, data recovery can be performed when problems occur during the upgrade process to ensure the security and integrity of the data.

[0158] The electronic device can then copy the upgrade package file to a specified directory, use an installer or other related methods to load the upgrade package to the server or environment where the service to be upgraded is located. Then, according to the specific requirements of the upgrade package, execute the installation script, execute commands, or make other configuration changes. The specific steps of the upgrade operation will vary depending on the type of upgrade package and the requirements of the service to be upgraded.

[0159] The embodiment of the present application provides a service management method, which obtains an upgrade package corresponding to a service to be upgraded in a distributed cluster; loads the upgrade package, and upgrades the service to be upgraded, thereby ensuring the accuracy of upgrading the service to be upgraded.

[0160] In an optional embodiment of the present application, Figure 7 The figure is a schematic diagram of the structure of a distributed cluster. Specifically, the service management method provided in the embodiment of the present application may include the following steps:

[0161] (1) After the cluster is deployed, the initialization service will modify the database parameter information. This parameter information may include database connection configuration, data storage settings, etc. to ensure that the database can work properly and interact with other services.

[0162] (2) The initialization service starts the daemon service and passes the database connection parameters to the daemon service. The daemon service is a continuously running process that is responsible for monitoring and managing the running status of other services and taking appropriate measures when necessary.

[0163] (3) After the daemon service is started, it connects to the database using the passed-in database connection parameters. It then retrieves the service instance table in the database to obtain information about the deployed services.

[0164] (4) The daemon service retrieves system platform parameters and service strength parameters from the database. These parameters may include server configuration information, service resource requirements, etc. Based on these parameters, the daemon service enables the corresponding services to ensure the normal operation of the system. Based on these parameters, a configuration file is generated, and based on the configuration file, the corresponding services are enabled.

[0165] (5) When the configuration service adds, deletes, or modifies service parameters, it will modify the information in the database table accordingly. At the same time, it will also notify the daemon service so that the daemon service can update the service's operating status in a timely manner.

[0166] (6) The daemon service will determine whether modifications are needed based on the update time in the database table. If modifications are needed, the service will add, close or restart the corresponding service according to the specific situation to ensure the correctness and stability of the service.

[0167] (7) The configuration service can load upgrade packages to upgrade the system. The upgrade package may contain new features, fixed vulnerabilities, or other improvements. By loading the upgrade package, the system can be updated and optimized.

[0168] (8) When the cluster system is upgraded, the daemon service will restart the related services and set the upgrade status and upgrade time of the cluster system. This ensures that the services can be stopped and restarted normally during the upgrade process and records the upgrade time and status.

[0169] (9) If the database switches from master to slave, the initialization service will restart the daemon service and modify the database parameters of the daemon service. This ensures that the daemon service can correctly connect to the new database master node and continue to monitor and manage the running status of the service.

[0170] (10) After the daemon service is restarted, it will connect to the slave database and restore the previous running data. This ensures that the service can continue to work after the database switch without losing the previous running status and data.

[0171] In the present embodiment, a service management device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0172] This embodiment provides a service management device, such as Figure 8 As shown, including:

[0173] The acquisition module 701 is used to acquire the deployment information corresponding to the distributed cluster;

[0174] An updating module 702 is used to update the parameter information in the database corresponding to the distributed cluster according to the deployment information to generate first current parameter information;

[0175] A determination module 703 is used to identify the first current parameter information and determine a target service that needs to be started in the distributed cluster;

[0176] The control module 704 is used to control the startup of each target service.

[0177] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0178] The service management device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0179] The embodiment of the present invention also provides an electronic device having the above Figure 8 The service management device shown.

[0180] See also Fig. 9 , Fig. 9 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Fig. 9 As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 10 is taken as an example.

[0181] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware integrated circuit. The hardware integrated circuit may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.

[0182] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0183] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0184] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0185] The electronic device further comprises a communication interface 30 for the electronic device to communicate with other devices or a communication network.

[0186] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0187] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0188] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A service management method, characterized in that: The method comprises: Get the deployment information corresponding to the distributed cluster; According to the deployment information, the parameter information in the database corresponding to the distributed cluster is updated to generate first current parameter information; Identifying the first current parameter information, and determining a target service that needs to be started in the distributed cluster; Control the startup of each target service.

2. The method according to claim 1, characterized in that The controlling each of the target services to start includes: Identify the first current parameter information, and search therefrom for system platform parameters corresponding to the distributed cluster and service instance parameters corresponding to each of the target services; Each of the target services is started according to the system platform parameters and the service instance parameters corresponding to each of the target services.

3. The method according to claim 2, characterized in that The starting each of the target services according to the system platform parameters and the service instance parameters corresponding to each of the target services includes: Generate a target configuration file corresponding to each target service according to the system platform parameters and each service instance parameter; According to each of the target configuration files, each of the target services is started.

4. The method according to claim 1, characterized in that: The method further comprises: Receiving a service operation instruction corresponding to the distributed cluster input by a user; According to the service operation instruction, the first current parameter information in the database is updated to generate second current parameter information; According to the second current parameter information, operations are performed on each current service corresponding to the distributed cluster.

5. The method according to any one of claims 1 or 4, characterized in that: The method further comprises: Receiving a cluster upgrade instruction input by a user, where the cluster upgrade instruction is used to upgrade the distributed cluster; According to the cluster upgrade instruction, identifying each current service in the distributed cluster; Determine, from the current services, a service to be restarted that needs to be restarted; Restart each of the services to be restarted and upgrade the distributed cluster; Update the upgrade status and upgrade time corresponding to the distributed cluster.

6. The method according to claim 1, characterized in that The method further comprises: Monitor the main database in the distributed cluster to detect whether an abnormality occurs in the main database; When an exception occurs in the main database, the current running data and the current running service corresponding to the main database are obtained; Searching for a backup slave database corresponding to the master database; the backup slave database is a backup database of the master database on a slave node in the distributed cluster, and the data in the backup slave database is consistent with the data in the master database; Disconnecting from the primary database; Connecting to the backup slave database; Searching the current running data from the backup database; Based on the current running data, each of the currently running services is controlled to continue running.

7. The method according to claim 1, characterized in that The method further comprises: Obtaining an upgrade package corresponding to the service to be upgraded in the distributed cluster; The upgrade package is loaded to upgrade the service to be upgraded.

8. A service management device, characterized in that: The device comprises: The acquisition module is used to obtain the deployment information corresponding to the distributed cluster; An updating module, configured to update the parameter information in the database corresponding to the distributed cluster according to the deployment information, and generate first current parameter information; A determination module, configured to identify the first current parameter information and determine a target service that needs to be started in the distributed cluster; The control module is used to control the startup of each target service.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the service management method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the service management method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Distributed cluster configuration method based on SHELL script

    CN119781908A

  • A distributed cluster configuration method based on a SHELL script

    CN119781908B

  • Software state management and upgrading method and system supporting multi-mode deployment

    CN121364863A