A cluster deployment method and device, electronic equipment and computer readable medium

By receiving cluster deployment requests, obtaining scenario identifiers, calling toolkits to identify abnormal cluster master nodes, and switching slave nodes to master nodes, the system resolves potential issues caused by differences in technical skill levels during Redis cluster deployment, thereby improving deployment security and performance.

CN116302716BActive Publication Date: 2026-07-10CHINA CONSTRUCTION BANK +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2023-03-09
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

When deploying Redis clusters, the varying skill levels of database administrators and technicians in different regions can lead to significant differences in deployment quality and timelines, making it easy to overlook or make mistakes, thus creating potential risks for online database incidents.

Method used

By receiving a cluster deployment request, obtaining a scenario identifier, calling the structure program toolkit, identifying the abnormal cluster master node, obtaining slave node performance data, switching the target slave node to the master node, and continuing to run the toolkit until successful.

Benefits of technology

Promptly address deployment anomalies to avoid potential incidents and improve cluster performance and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302716B_ABST
    Figure CN116302716B_ABST
Patent Text Reader

Abstract

This application discloses a cluster deployment method, apparatus, electronic device, and computer-readable medium, relating to the field of cloud computing technology. One specific implementation includes receiving a cluster deployment request and obtaining a corresponding scenario identifier; invoking and running a corresponding structured program toolkit based on the scenario identifier; determining the corresponding abnormal cluster master node in response to a detected runtime exception; determining each cluster slave node corresponding to the abnormal cluster master node and obtaining performance data for each cluster slave node; based on the performance data, determining a target cluster slave node from among the cluster slave nodes, and then switching the target cluster slave node to the cluster master node; and continuing to run the structured program toolkit until successful execution based on the cluster master node and each cluster slave node. This allows for timely handling of exceptions during cluster deployment, avoiding potential security risks and improving the performance and security of the deployed cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, and in particular to a cluster deployment method, apparatus, electronic device, and computer-readable medium. Background Technology

[0002] As the primary in-memory database storage solution, Redis (Remote Dictionary Server) is being deployed in various provinces, cities, and branches. However, due to various factors, deployment is typically carried out on-site by database administrators (DBAs), operations personnel, and technicians in each location. The deployment methods, configurations, and cluster architectures vary significantly. Local network conditions, lack of internet access, and inconsistent operator skill levels further contribute to inconsistent deployment quality and timelines. This can lead to omissions or errors during cluster deployment, potentially creating serious security risks for the online database. Summary of the Invention

[0003] In view of this, embodiments of this application provide a cluster deployment method, apparatus, electronic device, and computer-readable medium, which can solve the problem that omissions or errors exist when deploying clusters, which may pose serious hidden dangers to online databases.

[0004] To achieve the above objectives, according to one aspect of the embodiments of this application, a cluster deployment method is provided, comprising:

[0005] Receive cluster deployment requests and obtain the corresponding scenario identifier;

[0006] Based on the scenario identifier, the corresponding structure program toolkit is invoked and run. In response to the detection of a runtime exception, the corresponding abnormal cluster master node is determined.

[0007] Identify the individual cluster slave nodes corresponding to the abnormal cluster master node and obtain the performance data of each cluster slave node;

[0008] Based on performance data, the target cluster slave node is determined from each cluster slave node, and then the target cluster slave node is switched to the cluster master node;

[0009] Based on the cluster master node and each cluster slave node, continue running the structure program toolkit until it runs successfully.

[0010] Optionally, the corresponding abnormal cluster master node is determined, including:

[0011] The first service listening component is invoked to send the first and second instructions to the cluster master node corresponding to the cluster deployment request, and to receive the response results of the first and second instructions.

[0012] Based on the response results of the first and second instructions, determine whether each cluster master node has crashed, and obtain the first judgment result;

[0013] In response to the first judgment result being that the cluster master node has crashed, the first judgment result is sent to each of the second service listening components, and the second judgment results returned by each of the second service listening components are received.

[0014] Determine the number of cluster master nodes that have crashed in each of the second judgment results. If the number exceeds a preset threshold, determine that the cluster master node is an abnormal cluster master node.

[0015] Optionally, switching the target cluster from a node to the cluster master node includes:

[0016] Determine the set of service listening components and the election strategy corresponding to the scene identifier;

[0017] Based on the election strategy, the target service listening component is determined from the set of service listening components;

[0018] Invoke the target service listener component to switch the target cluster slave node to the cluster master node.

[0019] Optionally, obtain the performance data of each cluster slave node, including:

[0020] Obtain online status data, response speed data, and connection duration data for each cluster slave node.

[0021] Optionally, after switching the target cluster from a node to the cluster master node, the method further includes:

[0022] Based on the cluster master node and each cluster slave node, generate master-slave relationship data;

[0023] Synchronize the master-slave relationship data to each service listener component in the service listener component collection.

[0024] Optionally, run the structure program toolkit, including:

[0025] Determine the functions corresponding to the structure program toolkit, and then determine the logical core of the cluster master node corresponding to the functions;

[0026] Assign functions to logic cores.

[0027] Optionally, the logical core of the cluster master node corresponding to the function is determined, including:

[0028] Get the configuration metric data corresponding to the function;

[0029] Based on the configuration metric data, determine the logical core of the cluster master node corresponding to the function.

[0030] In addition, this application also provides a cluster deployment apparatus, including:

[0031] The receiving unit is configured to receive cluster deployment requests and obtain the corresponding scenario identifier;

[0032] The abnormal cluster master node determination unit is configured to call and run the corresponding structure program toolkit according to the scenario identifier, and determine the corresponding abnormal cluster master node in response to the detection of a runtime exception.

[0033] The data acquisition unit is configured to identify each cluster slave node corresponding to the abnormal cluster master node and acquire the performance data of each cluster slave node.

[0034] The switching unit is configured to determine the target cluster slave node from among the various cluster slave nodes based on performance data, and then switch the target cluster slave node to the cluster master node;

[0035] The running unit is configured to continue running the structure program toolkit based on the cluster master node and each cluster slave node until it runs successfully.

[0036] Optionally, the abnormal cluster master node determination unit is further configured to:

[0037] The first service listening component is invoked to send the first and second instructions to the cluster master node corresponding to the cluster deployment request, and to receive the response results of the first and second instructions.

[0038] Based on the response results of the first and second instructions, determine whether each cluster master node has crashed, and obtain the first judgment result;

[0039] In response to the first judgment result being that the cluster master node has crashed, the first judgment result is sent to each of the second service listening components, and the second judgment results returned by each of the second service listening components are received.

[0040] Determine the number of cluster master nodes that have crashed in each of the second judgment results. If the number exceeds a preset threshold, determine that the cluster master node is an abnormal cluster master node.

[0041] Optionally, the switching unit is further configured to:

[0042] Determine the set of service listening components and the election strategy corresponding to the scene identifier;

[0043] Based on the election strategy, the target service listening component is determined from the set of service listening components;

[0044] Invoke the target service listener component to switch the target cluster slave node to the cluster master node.

[0045] Optionally, the data acquisition unit is further configured to:

[0046] Obtain online status data, response speed data, and connection duration data for each cluster slave node.

[0047] Optionally, the device also includes a synchronization unit configured to:

[0048] Based on the cluster master node and each cluster slave node, generate master-slave relationship data;

[0049] Synchronize the master-slave relationship data to each service listener component in the service listener component collection.

[0050] Optionally, the operating unit is further configured to:

[0051] Determine the functions corresponding to the structure program toolkit, and then determine the logical core of the cluster master node corresponding to the functions;

[0052] Assign functions to logic cores.

[0053] Optionally, the operating unit is further configured to:

[0054] Get the configuration metric data corresponding to the function;

[0055] Based on the configuration metric data, determine the logical core of the cluster master node corresponding to the function.

[0056] In addition, this application also provides a cluster deployment electronic device, including: one or more processors; and a storage device for storing one or more programs, which, when executed by one or more processors, enable the one or more processors to implement the cluster deployment method described above.

[0057] In addition, this application also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the cluster deployment method described above.

[0058] To achieve the above objectives, according to another aspect of the embodiments of this application, a computer program product is provided.

[0059] A computer program product according to an embodiment of this application includes a computer program that, when executed by a processor, implements the cluster deployment method provided in an embodiment of this application.

[0060] One embodiment of the above invention has the following advantages or beneficial effects: This application receives a cluster deployment request and obtains the corresponding scenario identifier; it calls and runs the corresponding structure program toolkit according to the scenario identifier; in response to detecting a runtime exception, it determines the corresponding abnormal cluster master node; it determines each cluster slave node corresponding to the abnormal cluster master node and obtains the performance data of each cluster slave node; based on the performance data, it determines the target cluster slave node from among the cluster slave nodes, and then switches the target cluster slave node to the cluster master node; based on the cluster master node and each cluster slave node, it continues to run the structure program toolkit until it runs successfully. This allows for timely handling of exceptions during cluster deployment, avoiding potential safety hazards and improving the performance and security of the deployed cluster.

[0061] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0062] The accompanying drawings are provided to better understand this application and do not constitute an undue limitation thereof. Wherein:

[0063] Figure 1 This is a schematic diagram of the main flow of a cluster deployment method according to an embodiment of this application;

[0064] Figure 2 This is a schematic diagram of the main flow of a cluster deployment method according to an embodiment of this application;

[0065] Figure 3 This is a schematic diagram of the main process of a cluster deployment method according to an embodiment of this application;

[0066] Figure 4 This is a schematic diagram of the main units of a cluster deployment apparatus according to an embodiment of this application;

[0067] Figure 5 This is an exemplary system architecture diagram to which embodiments of this application can be applied;

[0068] Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers in the embodiments of this application. Detailed Implementation

[0069] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These embodiments should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the collection, analysis, use, transmission, and storage of user personal information involved in the technical solutions of this application comply with relevant laws and regulations, are used for legitimate and reasonable purposes, are not shared, disclosed, or sold outside of these legitimate uses, and are subject to supervision and management by regulatory authorities. Necessary measures should be taken to prevent unauthorized access to such personal information data, ensure that personnel authorized to access personal information data comply with relevant laws and regulations, and ensure the security of user personal information. Once this user personal information data is no longer needed, the risk should be minimized by restricting or even prohibiting data collection and / or deleting the data.

[0070] When used, including in certain relevant applications, data is deidentified to protect user privacy, for example by removing specific identifiers, controlling the amount or specificity of stored data, controlling how data is stored, and / or other methods.

[0071] Figure 1 This is a schematic diagram illustrating the main flow of a cluster deployment method according to an embodiment of this application, as follows: Figure 1 As shown, the cluster deployment methods include:

[0072] Step S101: Receive cluster deployment request and obtain the corresponding scenario identifier.

[0073] In this embodiment, the execution entity of the cluster deployment method (e.g., a server) can receive cluster deployment requests via wired or wireless connections. Upon receiving the cluster deployment request, the execution entity can obtain the scenario identifier carried in the request. Specifically, the scenario identifier can be used to characterize the cluster deployment scenario. Specific cluster deployment scenarios may include scenarios with a large number of read requests and priority persistence, scenarios emphasizing high performance, scenarios for building data centers, and scenarios with a large number of writes, etc. This embodiment does not specifically limit the cluster deployment scenario. Each scenario has a corresponding scenario identifier. For example, the scenario identifiers corresponding to scenarios with a large number of read requests and priority persistence, scenarios emphasizing high performance, scenarios for building data centers, and scenarios with a large number of writes can be 1, 2, 3, and 4, respectively.

[0074] In scenarios with a large number of read requests and prioritized persistence, a master-slave cluster deployment architecture is adopted. This architecture uses a two-tier structure: the first tier provides write capabilities, and the second tier provides read capabilities or guarantees data persistence. This is the most common deployment mode, typically used when there are a large number of read requests and prioritize persistence. It ensures high performance while maintaining high availability. Due to the high redundancy of the dual-slave databases, data loss can be minimized and a rapid switchover can be performed in the event of a failure.

[0075] For high-performance-critical scenarios, a cascaded replication cluster deployment architecture is adopted. Cascaded replication uses a three-tier architecture: the first tier provides write capabilities, the second tier provides read capabilities and rapid failover, and the third tier serves as a backup layer. For services insensitive to data synchronization latency, it can be used for read operations. This mode is used in scenarios prioritizing high performance. When the production environment experiences high concurrency and the data is temporarily cached, this deployment mode can effectively improve the throughput of the primary database. If the primary database fails, it can quickly switch to the next tier, achieving high availability and recovery.

[0076] The scenario for building a data center adopts a master-master replication cluster deployment architecture, also known as dual-active. It is generally used to build a data center, including a primary data center and a backup data center. The primary data center carries user data, and the backup data center is used to back up the data in the primary data center, enabling disaster recovery or multi-active environments.

[0077] For scenarios with high write volumes, a multi-master, one-slave cluster deployment architecture is employed. This mode is frequently used in scenarios with heavy write activity. It is more suitable for applications whose business technology stack uses short connections, such as PHP's short connections. It can distribute extremely high concurrency across multiple master databases, thereby achieving high CPU load capacity. Here, the slave database synchronizes with all master databases, primarily serving as the final data consistency database. For example, when summarizing and aggregating some data, it is centrally synchronized to the slave database to implement queries.

[0078] Step S102: Invoke and run the corresponding structure program toolkit according to the scenario identifier, and determine the corresponding abnormal cluster master node in response to the detection of a running exception.

[0079] After obtaining the scenario identifier, the executing entity can invoke and run the corresponding structure program toolkit based on the scenario identifier. For example, the structure program toolkit could be a remote dictionary server (Redis) structure program toolkit, specifically a Redis architecture program installation script. When the executing entity detects an exception while running the structure program toolkit, it invokes an exception detection program to determine the cluster master node where the exception occurs. Specifically, the exception could be, for example, a data center network problem, a server environment problem, a problem with the technical level of the deployment personnel, or a communication cost problem; this embodiment does not specifically limit the types of exceptions that may occur.

[0080] Step S103: Determine each cluster slave node corresponding to the abnormal cluster master node and obtain the performance data of each cluster slave node.

[0081] The cluster master node can be represented as a master, and the cluster slave nodes can be represented as slaves. One master can correspond to one or more slaves. Multiple masters can correspond to one slave.

[0082] Specifically, the performance data of each cluster slave node is obtained, including: online status data, response speed data, and connection duration data of each cluster slave node, which are then used as the performance data of each cluster slave node.

[0083] Step S104: Based on the performance data, determine the target cluster slave node from each cluster slave node, and then switch the target cluster slave node to the cluster master node.

[0084] For example, based on performance data, the target cluster slave node is determined from each cluster slave node, including: retaining those with online status data, eliminating those with slow response speed, eliminating those with long disconnection time from the original master, and finally selecting the target cluster slave node, i.e. the target slave, with the highest priority, smallest offset, and smallest server run ID (the server run ID is the identification code of each server for each run, and multiple run IDs can be generated by a server running multiple times), to serve as the new master.

[0085] Specifically, switching the target cluster from a node to the cluster master node includes: determining the set of service listening components and the election strategy corresponding to the scenario identifier; determining the target service listening component from the set of service listening components according to the election strategy; and invoking the target service listening component to switch the target cluster from a node to the cluster master node.

[0086] For example, a service listening component, such as a Sentinel, is a Redis high-availability service listening component; it's a special Redis service. It doesn't provide data read / write operations, only monitoring. Besides monitoring individual Redis nodes, Sentinels also monitor each other. Once a Sentinel detects a failure in a master node, it performs an automatic failover operation, promoting one of the slaves of the failed master node to the new master node, and synchronizing the remaining slaves to the new master node, completing a rapid switchover process. A set of service listening components, such as a set of Sentinels, corresponds to a scenario identifier. The set of service listening components corresponding to a scenario identifier is the set of Sentinels in that scenario. Sentinel quality checks vote according to an election strategy, determining the Sentinel with the most votes as the target Sentinel, i.e., the target service listening component. The target service listening component then performs the master-slave switch, transforming the target cluster slave node into the cluster master node.

[0087] Specifically, after switching the target cluster slave node to the cluster master node, the method also includes: generating master-slave relationship data based on the cluster master node and each cluster slave node; and synchronizing the master-slave relationship data to each service listening component in the service listening component set.

[0088] After switching the target cluster from a slave node to a master node, new master-slave relationship data is generated. The executing entity can then invoke the target service listener components to synchronize the new master-slave relationship data to all service listener components in the service listener component set. This completes the switchover process.

[0089] Step S105: Based on the cluster master node and each cluster slave node, continue running the structure program toolkit until it runs successfully.

[0090] After the node switch is completed, the executing entity can continue to run the structure program toolkit based on the new master-slave relationship, and repeat the master-slave node switch when an exception is encountered again, so as to run the structure program toolkit based on the running master-slave node until it runs successfully.

[0091] Specifically, running the structure program toolkit includes: determining the function corresponding to the structure program toolkit, and then determining the logical core of the cluster master node corresponding to the function; and allocating the function to the logical core.

[0092] For example, a remote dictionary service like Redis needs to be deployed on a 4-core, 8GB server. Using a corresponding architecture toolkit, such as a one-click deployment script, the central processing unit (CPU) and memory are passed to the script to determine the optimal CPU and memory usage ratio for nested script parameters. For instance, the one-click deployment script will set the values ​​of `server_cpulist` and `bio_cpulist` in the Redis parameters to `server_cpulist 0,1,2` and `bio_cpulist 3`. Different Redis functionalities are allocated to different logical cores and written to the configuration file `redis.conf`.

[0093] Specifically, determining the logical core of the cluster master node corresponding to the function includes: obtaining the configuration indicator data corresponding to the function, for example, the logical cores corresponding to the function of server_cpulist in the Redis parameters are 0, 1, and 2, and the logical core of the function of bio_cpulist is 3; and determining the logical core of the cluster master node corresponding to the function based on the configuration indicator data, for example, the logical cores corresponding to the function of server_cpulis passed by the structure program toolkit can be 0, 1, and 2, and the logical cores corresponding to bio_cpulist passed by the structure program toolkit can be 3.

[0094] This embodiment receives a cluster deployment request and obtains the corresponding scenario identifier; based on the scenario identifier, it calls and runs the corresponding structure program toolkit; in response to a detected runtime exception, it identifies the corresponding abnormal cluster master node; it determines each cluster slave node corresponding to the abnormal cluster master node and obtains the performance data of each cluster slave node; based on the performance data, it identifies the target cluster slave node from among the cluster slave nodes and then switches the target cluster slave node to the cluster master node; based on the cluster master node and each cluster slave node, it continues to run the structure program toolkit until it runs successfully. This allows for timely handling of exceptions during cluster deployment, avoiding potential security risks and improving the performance and security of the deployed cluster.

[0095] Figure 2 This is a schematic diagram of the main process of a cluster deployment method according to an embodiment of this application, as follows: Figure 2 As shown, the cluster deployment methods include:

[0096] Step S201: Receive cluster deployment request and obtain the corresponding scenario identifier.

[0097] Step S202: Invoke and run the corresponding structure program toolkit according to the scenario identifier. In response to the detection of a running exception, call the first service listening component to send the first instruction and the second instruction to the cluster master node corresponding to the cluster deployment request, and receive the returned first instruction response result and the second instruction response result.

[0098] When an abnormality is detected in the structure program toolkit, the executing entity can call the first service listening component, such as all sentinels in the scene corresponding to the scene identifier, to send the first instruction, such as the ping instruction, to each cluster master node corresponding to the cluster deployment request, and send the second instruction, such as the info instruction, to receive the returned first instruction response result, i.e. whether each cluster master and slave node is online, and to receive the returned second instruction response result, i.e. the status of each cluster master and slave node.

[0099] Step S203: Based on the first instruction response result and the second instruction response result, determine whether each cluster master node has crashed, so as to obtain the first judgment result.

[0100] Based on the online status of each cluster master and slave node indicated by the first command response result and the status of each cluster master and slave node indicated by the second command response result, the first and second command response results obtained by each sentinel are synchronized to other sentinels to ensure mutual correspondence and synchronize the status information of each node. For example, based on data synchronization, the executing entity can call Sentinel 1 to send a hello action to each cluster master node to check if there are any downed nodes. If all are normal, it will send normal notifications to other sentinels. If Sentinel 1 keeps sending hello to a cluster master node corresponding to the scene identifier without receiving a response and obtains the flags:SRI_S_DOWN message, it determines that the master has crashed and outputs this as the first judgment result.

[0101] Step S204: In response to the first judgment result being that the cluster master node has crashed, the first judgment result is sent to each of the second service listening components, and the second judgment results returned by each of the second service listening components are received.

[0102] When Sentinel 1 outputs the first judgment result that the cluster master node has crashed, it can send SENTINEL is-master-down-by-addr to each of the second service listening components, i.e., other sentinels, to tell them that the master has crashed. After receiving the first judgment result, the other sentinels will send hello to the corresponding master to probe and return the probe result, i.e., return each of the second judgment results.

[0103] Step S205: Determine the number of cluster master nodes that have crashed in each of the second judgment results. If the number exceeds a preset threshold, determine that the cluster master node is an abnormal cluster master node.

[0104] The number of sentinels that believe the cluster master node is down in the second judgment result is determined. When this number exceeds a preset threshold (for example, more than half of the total number of sentinels), it can be determined that the cluster master node is down, that is, the cluster master node is determined to be an abnormal cluster master node.

[0105] Step S206: Determine each cluster slave node corresponding to the abnormal cluster master node and obtain the performance data of each cluster slave node.

[0106] Performance data can include online status data, response speed data, and connection duration data.

[0107] Step S207: Based on performance data, determine the target cluster slave node from each cluster slave node, and then switch the target cluster slave node to the cluster master node.

[0108] For example, in the performance data, online status data is retained for those that are online, while those with slow response times and those that have been disconnected from the original master for a long time are eliminated. Ultimately, the node with the highest priority, smallest offset, and smallest run ID (a server run ID is an identification code for each server's execution; multiple runs of a server can generate multiple run IDs) will be selected as the target cluster slave node, which will then serve as the new master. The sentinel will send a "slave of no one" operation to the new master and send the new master address to other cluster slave nodes.

[0109] Step S208: Based on the cluster master node and each cluster slave node, continue running the structure program toolkit until it runs successfully.

[0110] The program toolkit runs on the cluster master node and each cluster slave node in a normal operating state until it runs successfully. Timely handling of anomalies during cluster deployment prevents potential security risks and improves the performance and security of the deployed cluster.

[0111] Figure 3 This is a schematic diagram illustrating an application scenario of a cluster deployment method according to an embodiment of this application. The cluster deployment method of this embodiment is applied to a high-availability cluster deployment scenario. Figure 3 As shown, one-click deployment involves a central control server that can be accessed via SSH without a password on all other servers. The central control server stores Redis configuration files, the Redis installation package, Sentinel configuration files, compilation dependencies, the Sentinel installation package, and switching scripts, etc.

[0112] Figure 3 The one-click deployment script in the software determines the Redis servers to be deployed (e.g., Redis cluster 1, including Redis master, Redis slave, and Redis slave) and sentinel servers (e.g., sentinel cluster 1, including sentinel 1, sentinel 2, and sentinel 3) based on the input parameters; determines the master-slave relationship based on the number of Redis servers; sets the size of Redis configuration parameters, persistence strategies, etc., and optimizes operating system parameters based on the input parameters; and adjusts appropriate sentinel-related parameter configurations based on the definition of the sentinel server, such as listening interval, retry time and number of times after disconnection, and minimum switching time.

[0113] For example, the passed parameters can include:

[0114] -c 1: Specifies the maximum number of CPU cores that the Redis server can use.

[0115] -m 4: Specifies the maximum size of content that Redis is allowed to use. The unit is GB.

[0116] -p / data / : Specifies the path where Redis is installed.

[0117] -M ip:port: Specifies the IP address and port of the master database.

[0118] -S ip1:port;ip2:port : Specifies the slave IP address and port.

[0119] -P passwd: Specifies the login password and synchronization password for the Redis instance.

[0120] -t sentinel: This parameter can be sentinel, ms, or alone. Among them, sentinel is a high-availability structure, ms is a master-slave architecture, and alone is a single-machine architecture.

[0121] -v ip: Specifies the VIP, which is used by the sentry.

[0122] -A yes: Specifies whether to enable AOF persistence. Options are yes and no.

[0123] -R yes: Specifies whether to enable RDB persistence. Options are yes and no.

[0124] -T 5000: Specifies the time the sentry is out of contact, in milliseconds.

[0125] -N mymaster: Specifies the cluster name. Used in sentinel configuration.

[0126] Most of the Redis and Sentinel configuration parameters listed above have been set to optimal settings and are included in the installation package. The optimal configuration of a small number of parameters is related to server resource configuration. Therefore, CPU, memory, and persistence metrics are particularly important in the parameters passed to the one-click installation script. The optimization schemes nested within the script will perform optimal configurations based on these metrics. These include reasonable memory allocation (related to memory usage, i.e., the number of membytes), the maximum usable memory for Redis (related to CPU), read / write performance and data importance (related to persistence), and the optimal number of Sentinel members to elect (calculated based on -M and -S). The script enables rapid deployment of Redis across multiple architectures by combining the Redis configuration file (redis.conf), the Sentinel configuration file (sentinel.conf), and Linux system parameters to debug the optimal parameter ratios, maximizing server performance. It also supports rapid deployment of Redis across multiple architectures, combining single-machine, master-slave, and high-availability deployments, all completed through a one-click deployment script. In addition to quickly deploying Redis and Sentinel, the one-click deployment script also unifies and standardizes deployment processes. The embodiments of this application can realize a Redis cluster that supports multiple scenarios and features unified configuration, unified architecture, rapid offline deployment, high performance, and high availability.

[0127] Figure 4 This is a schematic diagram of the main units of a cluster deployment apparatus according to an embodiment of this application. Figure 4 As shown, the cluster deployment device 400 includes a receiving unit 401, an abnormal cluster master node determination unit 402, a data acquisition unit 403, a switching unit 404, and an operation unit 405.

[0128] The receiving unit 401 is configured to receive cluster deployment requests and obtain the corresponding scenario identifier.

[0129] The abnormal cluster master node determination unit 402 is configured to call and run the corresponding structure program toolkit according to the scenario identifier, and determine the corresponding abnormal cluster master node in response to the detection of a runtime exception.

[0130] The data acquisition unit 403 is configured to determine each cluster slave node corresponding to the abnormal cluster master node and acquire the performance data of each cluster slave node.

[0131] Switching unit 404 is configured to determine the target cluster slave node from among the various cluster slave nodes based on performance data, and then switch the target cluster slave node to the cluster master node.

[0132] Run unit 405 is configured to continue running the structure program toolkit based on the cluster master node and each cluster slave node until it runs successfully.

[0133] In some embodiments, the abnormal cluster master node determination unit 402 is further configured to: invoke a first service listening component to send a first instruction and a second instruction to the cluster master node corresponding to the cluster deployment request, and receive the returned first instruction response result and second instruction response result; determine whether each cluster master node is down based on the first instruction response result and the second instruction response result to obtain a first judgment result; in response to the first judgment result indicating that the cluster master node is down, send the first judgment result to each second service listening component, and receive each second judgment result returned by each second service listening component; determine the number of cluster master nodes down in each second judgment result, and in response to the number exceeding a preset threshold, determine the cluster master node as an abnormal cluster master node.

[0134] In some embodiments, the switching unit 404 is further configured to: determine the set of service listening components and the election strategy corresponding to the scenario identifier; determine the target service listening component from the set of service listening components according to the election strategy; and call the target service listening component to switch the target cluster from a node to the cluster master node.

[0135] In some embodiments, the data acquisition unit 403 is further configured to acquire online status data, response speed data, and connection duration data of each cluster slave node.

[0136] In some embodiments, the apparatus further includes a synchronization unit configured to: generate master-slave relationship data based on the cluster master node and each cluster slave node; and synchronize the master-slave relationship data to each service listening component in the service listening component set.

[0137] In some embodiments, the execution unit 405 is further configured to: determine the function corresponding to the structured program toolkit, and then determine the logical core of the cluster master node corresponding to the function; and allocate the function to the logical core.

[0138] In some embodiments, the running unit 405 is further configured to: acquire configuration indicator data corresponding to the function; and determine the logical core of the cluster master node corresponding to the function based on the configuration indicator data.

[0139] It should be noted that the cluster deployment method and cluster deployment device in this application are related in terms of specific implementation content, so repeated content will not be described again.

[0140] Figure 5 An exemplary system architecture 500 is shown that can be applied to the cluster deployment method or cluster deployment apparatus of the embodiments of this application.

[0141] like Figure 5As shown, system architecture 500 may include terminal devices 501, 502, and 503, a network 504, and a server 505. Network 504 serves as the medium for providing communication links between terminal devices 501, 502, and 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0142] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0143] Terminal devices 501, 502, and 503 can be various electronic devices with clustered processing screens and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0144] Server 505 can be a server providing various services, such as a backend management server supporting cluster deployment requests submitted by users using terminal devices 501, 502, and 503 (this is just an example). The backend management server can receive cluster deployment requests and obtain the corresponding scenario identifier; based on the scenario identifier, it calls and runs the corresponding structured program toolkit; in response to a runtime exception, it identifies the corresponding abnormal cluster master node; it identifies each cluster slave node corresponding to the abnormal cluster master node and obtains the performance data of each cluster slave node; based on the performance data, it determines the target cluster slave node from among the cluster slave nodes and then switches the target cluster slave node to the cluster master node; based on the cluster master node and each cluster slave node, it continues to run the structured program toolkit until successful. This allows for timely handling of exceptions during cluster deployment, avoiding potential security risks and improving the performance and security of the deployed cluster.

[0145] It should be noted that the cluster deployment method provided in this application embodiment is generally executed by server 505, and correspondingly, the cluster deployment device is generally set in server 505.

[0146] It should be understood that Figure 5 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0147] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing a terminal device according to the embodiments of this application. Figure 6The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0148] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the computer system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0149] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0150] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this application.

[0151] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. Computer-readable storage media can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0152] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0153] The units described in the embodiments of this application can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor can be described as including a receiving unit, an abnormal cluster master node determination unit, a data acquisition unit, a switching unit, and an execution unit. The names of these units do not necessarily limit the specific unit itself.

[0154] In another aspect, this application also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the device receives a cluster deployment request, obtains the corresponding scenario identifier, calls and runs the corresponding structured program toolkit according to the scenario identifier, determines the corresponding abnormal cluster master node in response to a detected runtime exception, determines each cluster slave node corresponding to the abnormal cluster master node, obtains the performance data of each cluster slave node, determines the target cluster slave node from among the cluster slave nodes based on the performance data, and then switches the target cluster slave node to the cluster master node; and continues to run the structured program toolkit until successful execution based on the cluster master node and each cluster slave node.

[0155] The computer program product of this application includes a computer program that, when executed by a processor, implements the cluster deployment method in the embodiments of this application.

[0156] According to the technical solution of the embodiments of this application, anomalies can be handled in a timely manner when deploying a cluster, avoiding potential accidents and improving the performance and security of the deployed cluster.

[0157] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A cluster deployment method, characterized in that, include: Receive cluster deployment request, obtain the corresponding scenario identifier, and match the corresponding cluster deployment architecture based on the scenario identifier; According to the cluster deployment architecture, call and run the corresponding structure program tool package, and in response to the detection of a running exception, determine the corresponding abnormal cluster master node; Identify each cluster slave node corresponding to the abnormal cluster master node, and obtain the performance data of each cluster slave node; Based on the performance data, a target cluster slave node is determined from the various cluster slave nodes, and then the target cluster slave node is switched to the cluster master node; Based on the cluster master node and each cluster slave node, continue running the structure program toolkit until it runs successfully; The step of running the structure program toolkit includes: determining the function corresponding to the structure program toolkit, and then determining the logical core of the cluster master node corresponding to the function; and allocating the function to the logical core. The step of determining the logical core of the cluster master node corresponding to the function includes: obtaining the configuration indicator data corresponding to the function; and determining the logical core of the cluster master node corresponding to the function based on the configuration indicator data.

2. The method according to claim 1, characterized in that, The process of determining the corresponding abnormal cluster master node includes: The first service listening component is invoked to send a first instruction and a second instruction to the cluster master node corresponding to the cluster deployment request, and to receive the returned first instruction response result and second instruction response result. Based on the first instruction response result and the second instruction response result, determine whether each cluster master node has crashed, so as to obtain the first judgment result; In response to the first judgment result being that the cluster master node has crashed, the first judgment result is sent to each of the second service listening components, and the second judgment results returned by each of the second service listening components are received. The number of cluster master nodes that have crashed in each of the second judgment results is determined, and in response to the number exceeding a preset threshold, the cluster master node is determined to be an abnormal cluster master node.

3. The method according to claim 1, characterized in that, The step of switching the target cluster slave node to the cluster master node includes: Determine the set of service listening components and the election strategy corresponding to the scenario identifier; According to the election strategy, the target service listening component is determined from the set of service listening components; Invoke the target service listening component to switch the target cluster slave node to the cluster master node.

4. The method according to claim 1, characterized in that, The process of obtaining the performance data of each cluster slave node includes: Obtain online status data, response speed data, and connection duration data of each cluster slave node.

5. The method according to claim 3, characterized in that, After switching the target cluster slave node to the cluster master node, the method further includes: Based on the cluster master node and each cluster slave node, master-slave relationship data is generated; The master-slave relationship data is synchronized to each service listening component in the service listening component set.

6. A cluster deployment device, characterized in that, include: The receiving unit is configured to receive cluster deployment requests, obtain the corresponding scenario identifier, and match the corresponding cluster deployment architecture based on the scenario identifier. The abnormal cluster master node determination unit is configured to call and run the corresponding structure program tool package according to the cluster deployment architecture, and determine the corresponding abnormal cluster master node in response to the detection of a runtime exception. The data acquisition unit is configured to determine each cluster slave node corresponding to the abnormal cluster master node and acquire the performance data of each cluster slave node. The switching unit is configured to determine a target cluster slave node from among the various cluster slave nodes based on the performance data, and then switch the target cluster slave node to the cluster master node; The running unit is configured to continue running the structure program toolkit according to the cluster master node and each cluster slave node until the operation is successful; The running unit is further configured to: determine the function corresponding to the structure program toolkit, and then determine the logical core of the cluster master node corresponding to the function; and allocate the function to the logical core. The running unit is further configured to: acquire configuration indicator data corresponding to the function; and determine the logical core of the cluster master node corresponding to the function based on the configuration indicator data.

7. The apparatus according to claim 6, characterized in that, The abnormal cluster master node determination unit is further configured to: The first service listening component is invoked to send a first instruction and a second instruction to the cluster master node corresponding to the cluster deployment request, and to receive the returned first instruction response result and second instruction response result. Based on the first instruction response result and the second instruction response result, determine whether each cluster master node has crashed, so as to obtain the first judgment result; In response to the first judgment result being that the cluster master node has crashed, the first judgment result is sent to each of the second service listening components, and the second judgment results returned by each of the second service listening components are received. The number of cluster master nodes that have crashed in each of the second judgment results is determined, and in response to the number exceeding a preset threshold, the cluster master node is determined to be an abnormal cluster master node.

8. The apparatus according to claim 6, characterized in that, The switching unit is further configured to: Determine the set of service listening components and the election strategy corresponding to the scenario identifier; According to the election strategy, the target service listening component is determined from the set of service listening components; Invoke the target service listening component to switch the target cluster slave node to the cluster master node.

9. The apparatus according to claim 6, characterized in that, The data acquisition unit is further configured to: Obtain online status data, response speed data, and connection duration data of each cluster slave node.

10. The apparatus according to claim 8, characterized in that, The device also includes a synchronization unit configured to: Based on the cluster master node and each cluster slave node, master-slave relationship data is generated; The master-slave relationship data is synchronized to each service listening component in the service listening component set.

11. A cluster-deployed electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.

12. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.

13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-5.