Server system control method and device and storage medium

By acquiring historical primary/standby information of the control nodes and database reference information in the server system, the current primary/standby mode is automatically determined, solving the problem of manual intervention after node switching in the server system, improving operating efficiency and applicability, especially in embedded devices.

CN120929310APending Publication Date: 2025-11-11ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510878123.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-26
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

Existing server systems have difficulty automatically resuming primary/standby mode after a primary/standby node switchover and the recovery of a normal node, requiring manual intervention. This results in low operating efficiency and the risk of data loss, and is particularly unsuitable for embedded devices.

Method used

By acquiring historical master-slave information from the first and second control nodes and combining it with reference master-slave information in the database, the current master-slave mode is automatically determined, reducing manual intervention. Redis database is used to achieve efficient configuration synchronization and failover, ensuring adaptive node switching.

Benefits of technology

It enables automated master/slave switching of server systems in case of node failure, improving operational efficiency, reducing manual intervention steps and the risk of data loss, and is suitable for embedded devices with hardware limitations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120929310A_ABST
    Figure CN120929310A_ABST
Patent Text Reader

Abstract

The invention discloses a control method and device of a server system and a storage medium, the method is applied to a first control node in the server system, the server system at least comprises a second control node and a database, and the first control node, the second control node and the database are in communication connection. The method comprises the following steps: determining current main and standby information according to first historical main and standby information of a first control node and obtained second historical main and standby information of a second control node; obtaining reference main and standby information of the first control node in a database; determining a target mode of the first control node from the main and standby modes according to a comparison result between the current main and standby information and the reference main and standby information; and starting operation is performed according to the target mode. According to the scheme, the operation efficiency of the server can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of equipment control technology, and in particular to a control method, device, and storage medium for a server system. Background Technology

[0002] During the operation of a computer system, redundancy backup technologies can ensure high reliability and stability. Backup resources can quickly replace or support the main controller when it fails, thereby ensuring continuous system operation and data security.

[0003] Currently, existing server operations can include two server nodes: a primary node and a backup node. The primary node operates in primary control mode, and the backup node operates in backup control mode. If the primary node malfunctions, the backup node can be switched to primary control mode to replace the malfunctioning primary node (malfunctioning node) and continue executing business logic.

[0004] However, after the abnormal node recovers, the primary and backup operation modes of the server system have already been switched. The recovered node is difficult to run normally after restarting. Manual intervention is required to reset the primary and backup operation modes of each control node to redetermine the primary and backup modes of each control node, which makes the server operating efficiency very low. Summary of the Invention

[0005] This application provides at least one control method, apparatus, device, and computer-readable storage medium for a server system.

[0006] This application provides a control method for a server system. The method is applied to a first control node in the server system, which further includes at least a second control node and a database. The first control node, the second control node, and the database are connected in communication. The method includes: determining current primary / backup information based on first historical primary / backup information of the first control node and second historical primary / backup information of the second control node; obtaining reference primary / backup information of the first control node in the database; determining a target mode of the first control node from the primary / backup modes based on a comparison between the current primary / backup information and the reference primary / backup information; and starting operation according to the target mode.

[0007] In one embodiment, the primary / backup mode includes a primary control mode and a backup control mode. Determining the target mode of the first control node from the primary / backup modes based on the comparison result between the current primary / backup information and the reference primary / backup information includes: in response to the comparison result indicating that the current primary / backup information is consistent with the reference primary / backup information, and the current primary / backup information and the reference primary / backup information indicate that the first control node corresponds to the primary control mode, then determining the primary control mode as the target mode of the first control node; and in response to the comparison result indicating that the current primary / backup information is consistent with the reference primary / backup information, and the current primary / backup information and the reference primary / backup information indicate that the first control node corresponds to the backup control mode, then determining the backup control mode as the target mode of the first control node.

[0008] In one embodiment, the primary / backup mode includes a primary control mode and a backup control mode. Determining the target mode of the first control node from the primary / backup modes based on the comparison result between the current primary / backup information and the reference primary / backup information includes: in response to the comparison result indicating that the current primary / backup information and the reference primary / backup information are inconsistent, and the current primary / backup information indicates that the first control node corresponds to the backup control mode, and the reference primary / backup information indicates that the first control node corresponds to the primary control mode, then resetting the database and determining the backup control mode as the target mode of the first control node; in response to the comparison result indicating that the current primary / backup information and the reference primary / backup information are inconsistent, and the current primary / backup information indicates that the first control node corresponds to the primary control mode, and the reference primary / backup information indicates that the first control node corresponds to the backup control mode, then waiting for the second control node to reset the database and determining the primary control mode as the target mode of the first control node.

[0009] In one embodiment, after starting operation according to the target mode, the method further includes: if the target mode is a master control mode, in response to the received signaling data sent by the client, obtaining service data from a first data source according to the signaling data to obtain first service data; sending the first service data to a service execution node to enable the service execution node to process the first service data; sending the signaling data to a second control node to enable the second control node to obtain the service data from the first data source according to the signaling data to obtain second service data; in response to an anomaly in the first control node, sending an anomaly message to the second control node to enable the second control node to switch to the master control mode, and sending the second service data to the service execution node for processing.

[0010] In one embodiment, before sending an exception message to the second control node in response to an anomaly in the first control node to switch the second control node to the master control mode, the method further includes: detecting whether there is an anomaly in the service process of the first control node according to the first keep-alive process in the first control node; if there is an anomaly, reducing the service weight of the first control node according to the first keep-alive process.

[0011] In one embodiment, the abnormal information includes weight reduction information. The step of sending abnormal information to the second control node in response to an anomaly in the first control node, causing the second control node to switch to the master control mode, includes: generating the weight reduction information based on the reduced service weight of the first control node in response to an anomaly in the first control node; and sending the weight reduction information to the second keep-alive process of the second control node through the first keep-alive process, so that the second control node switches to the master control mode based on the received weight reduction information.

[0012] In one embodiment, after starting operation according to the target mode, the method further includes: if the target mode is a master control mode, in response to the received signaling data sent by the client, obtaining data from a second data source according to the signaling data to obtain third service data; sending the third service data to a service execution node so that the service execution node processes the third service data; sending the signaling data to a second control node so that the second control node obtains data from the third data source according to the signaling data to obtain fourth service data; in response to an anomaly in the first control node, controlling the second control node to switch to the master control mode so that the second control node establishes a connection with the second data source, obtains the third service data from the second data source, and sends the third service data and the fourth service data to the service execution node for processing.

[0013] In one embodiment, determining the current primary / backup information based on the first historical primary / backup information of the first control node and the obtained second historical primary / backup information of the second control node includes: obtaining the current timestamp, the first timestamp of the first historical primary / backup information, and the second timestamp of the second historical primary / backup information; and determining the current primary / backup information from the first historical primary / backup information and the second historical primary / backup information based on the comparison result between the current timestamp and the first timestamp, and the comparison result between the current timestamp and the second timestamp.

[0014] A second aspect of this application provides a control device for a server system, comprising: a current information determination module, configured to determine current primary / backup information based on first historical primary / backup information of the first control node and second historical primary / backup information of the second control node obtained therefrom; a reference information acquisition module, configured to acquire reference primary / backup information of the first control node in the database; a mode determination module, configured to determine a target mode of the first control node from primary / backup modes based on a comparison result between the current primary / backup information and the reference primary / backup information; and a running module, configured to start running according to the target mode.

[0015] A third aspect of this application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the control method of the server system described above.

[0016] The fourth aspect of this application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a processor, implement the control method of the server system described above.

[0017] The above solution obtains the first historical primary / backup information of the first control node and the second historical primary / backup information of the second control node. Based on the first and second historical primary / backup information, it determines the current primary / backup information to be set for the first control node in the current operating scenario. It also obtains the reference primary / backup information of the first control node in the database, which records the primary / backup information set by the first control node during operation in historical operating scenarios. The historical operating scenarios are earlier than the current operating scenario. By comparing the current primary / backup information and the reference primary / backup information, it can be determined whether the primary / backup information of the first control node in the current operating scenario is consistent with that in the historical operating scenarios. Therefore, based on the comparison results between the current primary / backup information and the reference primary / backup information, the target mode that the first control node should currently run can be determined from the primary / backup modes. The system starts running according to the target mode, realizing that the control node adaptively determines the target mode to be run in the server system operating scenario. This reduces the step of manually resetting the primary / backup mode and improves the operating efficiency of the server system.

[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this application. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.

[0020] Figure 1 This is a flowchart illustrating an exemplary embodiment of the control method for the server system of this application;

[0021] Figure 2 This is an exemplary system structure diagram of the control method of the server system in this application;

[0022] Figure 3 This is an exemplary business process diagram of the control method of the server system in this application;

[0023] Figure 4 This is an exemplary abnormal switching process diagram in the control method of the server system of this application;

[0024] Figure 5 This is another exemplary abnormal switching process diagram in the control method of the server system of this application;

[0025] Figure 6 This is a block diagram illustrating a control device for a server system, as shown in an exemplary embodiment of this application.

[0026] Figure 7 This is a schematic diagram of the structure of an embodiment of the electronic device of this application;

[0027] Figure 8 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0028] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0029] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.

[0030] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this document means two or more. Moreover, the term "at least one" in this document means any combination of at least two of any one or more of a plurality of objects. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0031] Currently, among the existing server system control methods, the dual-machine hot standby method is one of the redundancy backup methods (therefore, this application mainly uses a server system as an example for illustration, but does not limit the application of this method to more scenarios, such as some small computer devices, embedded devices, etc.). A server system can include at least two server nodes: a primary node and a backup node. The primary node operates in primary control mode, and the backup node operates in backup control mode. When the primary node malfunctions, the backup node can be switched to primary control mode to replace the malfunctioning primary node (malfunctioning node) and continue executing business logic.

[0032] However, in traditional dual-machine hot standby methods, manual intervention is required when data anomalies occur. For example, after the first primary-standby switchover in the server system, the original standby machine becomes the primary machine, and the data is intact. The manual intervention to restore the primary-standby state involves backing up and restoring the current primary machine's database to the original primary machine, and then running the original primary machine's database in standby mode alongside the current primary machine. This allows the original primary machine to switch to standby mode and become the current standby machine in the current operating environment. This process is very time-consuming and labor-intensive, impacting server operating efficiency and the efficiency of dual-machine hot standby.

[0033] Furthermore, if a new control node is replaced in the server system, there is a risk of data loss. For example, after the entire device restarts, the newly added node may become the master node, resulting in the loss of the original master node's configuration.

[0034] In addition, traditional dual-machine hot standby methods have low versatility and are not suitable for small scenarios such as embedded systems. They often need to run in a Docker environment, which is complex to configure and cannot be adapted to embedded devices with hardware limitations.

[0035] Please see Figure 1 , Figure 1 This is a flowchart illustrating an exemplary embodiment of the control method for the server system of this application. The method of this application can be applied to a first control node in a server system. The server system further includes at least a second control node and a database, and the first control node, the second control node, and the database are connected in communication. Specifically, it may include the following steps:

[0036] Step S110: Determine the current primary / backup information based on the first historical primary / backup information of the first control node and the second historical primary / backup information of the second control node obtained.

[0037] It should be noted that during each server operation, each control node records and saves its corresponding primary / standby information for each operation, thus obtaining the historical primary / standby information of each control node. For example, in the nth operation, the first control node operates in primary control mode, and the second control node operates in standby control mode; in the (n+1)th operation, the first historical primary / standby information of the first control node is primary control mode, and the second historical primary / standby information of the second control node is standby control mode. The historical primary / standby information recorded by each control node can represent one or more operation processes; this is not limited here. The primary / standby information mentioned in the embodiments of this application can be considered as configuration information.

[0038] It should also be noted that under normal server operation, the primary / standby information of each control node typically remains unchanged. Therefore, each time the server starts up, the primary / standby mode of each control node in the current operating scenario can appropriately reference the primary / standby reference information from historical operating scenarios (historical primary / standby reference information). For example, if the first historical primary / standby information of the first control node indicates primary control mode, it can still operate in primary control mode in the current scenario, serving as the primary control node in the server system; if the second historical primary / standby information of the second control node indicates standby control mode, it can still operate in standby control mode in the current scenario, serving as the standby control node in the server system. Furthermore, the first historical primary / standby information of the first control node can record only the operating mode of the first control node at that time, or it can also record the operating mode of the second control node at that time; the same applies to the second historical primary / standby information, and there is no limitation here.

[0039] However, in abnormal server operation states, the primary / standby information of each control node may change. Therefore, the current primary / standby information represents the possible primary / standby mode that each control node may be running, not a certainty that each control node will definitely be running in the primary / standby mode.

[0040] For example, in determining the current primary / backup information, it can be based on the first historical primary / backup information or the second historical primary / backup information. For instance, after determining that the current primary / backup information of the first control node is in primary control mode based on the first historical primary / backup information, the current primary / backup information of the second control node can be determined by default to backup control mode; or after determining that the current primary / backup information of the second control node is in backup control mode based on the second historical primary / backup information, the current primary / backup information of the first control node can be determined by default to primary control mode, etc., without limitation here.

[0041] Another example is determining the current primary / backup information based on the first and second historical primary / backup information. For instance, it involves determining whether the first and second historical primary / backup information match. If they match, the current historical information can be determined based on either of these historical primary / backup information. The method for determining match can include, but is not limited to, ensuring that the primary / backup mode of the first control node and / or the primary / backup mode of the second control node, as represented by the first and / or second historical primary / backup information, are consistent with the primary / backup mode of the first and / or the second control node, as represented by the second historical primary / backup information. For example, the first and second historical primary / backup information might both indicate that the first control node is in primary control mode, or vice versa. If the first and second historical primary / backup information do not match, it can be determined which information is closer to the current time, and the most up-to-date historical primary / backup information is used to determine the current primary / backup information. Alternatively, the most up-to-date historical primary / backup information can be directly used, omitting the process of determining the consistency of historical primary / backup information.

[0042] Step S120: Obtain the reference master / slave information of the first control node in the database.

[0043] The database type in this application can be selected as needed based on specific application scenarios, and is not limited here. Preferably, the database in this application can be Redis. Redis is an open-source, high-performance key-value store database, a typical representative of in-memory NoSQL databases. It adopts a single-threaded architecture to achieve high throughput, supports various data structures including strings, lists, hash tables, sets, and sorted sets, and has rich advanced functional modules, covering Lua script execution, transaction support, publish-subscribe mechanism, as well as failover implemented through Redis Sentinel and distributed scaling capabilities provided by Redis Cluster.

[0044] Choosing Redis database makes the method of this application applicable to hardware-constrained embedded devices. By using Redis's master-slave high consistency and publish-subscribe pattern, and by using memory-based data processing, the system configuration does not need to be persisted to disk (there is no need to persist it to the storage medium), which significantly reduces hardware limitations.

[0045] In conjunction with the preceding steps, it should be noted that under normal server system operation, after each control node starts running according to its corresponding primary / standby information, the database corresponding to each node will also store the corresponding primary / standby information. Different control nodes can correspond to different databases (for example, the database in this application can be a Redis cluster), which is not limited here. The primary / standby information stored in the database can be actively written by the control node or passively recorded by the database, thus obtaining reference primary / standby information, which will not be elaborated upon here.

[0046] For example, after the first control node starts in master mode, it synchronizes its own configuration (including but not limited to the first historical master-slave information) to the corresponding Redis. After the Redis cluster starts, it can record the startup information (master-slave information) of this operation to the local storage of the first control node, and obtain reference master-slave information for reference when starting next time.

[0047] Specifically, under normal operating conditions, the historical primary / secondary information recorded by the control node itself should be consistent with the reference primary / secondary information stored in its corresponding Redis database. Therefore, obtaining the reference primary / secondary information of the first control node in the database can be used to determine whether the primary / secondary information of the first control node has changed, and can also, to some extent, determine whether there are any abnormalities in the server system.

[0048] Step S130: Based on the comparison results between the current primary / backup information and the reference primary / backup information, determine the target mode of the first control node from the primary / backup modes.

[0049] Based on the steps described above, by comparing the current master / slave information recorded in the control node with the reference master / slave information recorded in the Redis database, the target mode of the first control node can be determined from the master / slave modes (including master control mode and standby control mode) according to the comparison results.

[0050] For example, for the first control node, if the current primary / backup information and the reference primary / backup information are consistent, and the current primary / backup information and the reference primary / backup information indicate that the first control node is in primary control mode, then the primary control mode is selected from the primary / backup modes as the target mode for the first control node. Similarly, for the second control node, if the current primary / backup information and the reference primary / backup information are consistent, and the current primary / backup information and the reference primary / backup information indicate that the second control node is in backup control mode, then the backup control mode is selected from the primary / backup modes as the target mode for the second control node.

[0051] If the current primary / standby information and the reference primary / standby information are inconsistent, a reset operation is required based on the specific conflict situation to switch the primary / standby mode of the first control node and the second control node. This will not be elaborated here.

[0052] Step S140: Start running according to the target mode.

[0053] Based on the preceding steps, after determining the target mode of the first control node, the first control node can start running according to the target mode. If the first control node is in master control mode, it will start running in master control mode, thus becoming the master control node. If the first control node is in standby control mode, it will start running in standby control mode, thus becoming the standby control node.

[0054] As can be seen, this application obtains the first historical primary / backup information of the first control node and the second historical primary / backup information of the second control node, and determines the current primary / backup information to be set for the first control node in the current operating scenario based on the first and second historical primary / backup information; it obtains the reference primary / backup information of the first control node in the database, which records the primary / backup information set by the first control node during operation in historical operating scenarios; the historical operating scenarios are earlier than the current operating scenarios; by comparing the current primary / backup information and the reference primary / backup information, it can be determined whether the primary / backup information of the first control node in the current operating scenario is consistent with the primary / backup information in the historical operating scenarios. Therefore, based on the comparison results between the current primary / backup information and the reference primary / backup information, the target mode that the first control node should currently run can be determined from the primary / backup modes; and the system is started and run according to the target mode, so that the control node can adaptively determine the target mode to be run in the server system operating scenario, reducing the step of manually resetting the primary / backup mode and improving the operating efficiency of the server system.

[0055] Based on the above embodiments, this application provides examples to illustrate the applicable scenarios of the overall solution system of this application. See also... Figure 2 As shown, Figure 2 This is an exemplary system architecture diagram of the server system control method of this application. The method of this application can be applied to scenarios such as video stream encoding and decoding, for example, running in a matrix device (a matrix device is a device that includes an encoding and decoding card), and particularly relates to a dual-controller hot standby cluster of embedded matrix devices.

[0056] The entire matrix device can include a dual-control hot standby system consisting of two control boards (control nodes) and multiple expandable service boards (service execution nodes). The control boards and service boards are isolated from the external network, and external interaction is handled by the control boards. The dual-control hot standby system consists of a primary control board (primary control node) and a backup control board (backup control node). During operation, external services are handled by the primary control board, while the backup control board acts as a hot standby, taking over services when the primary control board malfunctions. It should be noted that, unless otherwise specified, at the initial startup of the matrix device, only the first and second control boards are distinguished; the primary and backup control boards in the current operating scenario are determined only after their primary and backup priorities are established.

[0057] Each control board may include at least 3 modules, such as:

[0058] (1) keepalvied (keep-alive process module): provides internal virtual IP control, Redis cluster control, Redis process health detection, business service process health detection, etc.

[0059] (2) Redis-server (database service module): Responsible for synchronizing the configurations of the primary and backup control boards based on Redis's publish-subscribe features. During operation, the Redis service can be responsible only for configuration synchronization and not for configuration persistence.

[0060] (3) Service Process: Provides external virtual IP control. In actual operation, the backup control board's service process can choose to disable its own port and then reactivate it when switching to master control mode.

[0061] Based on the above embodiments, this application embodiment describes the steps of determining the target mode of the first control node from the primary / backup modes based on the comparison result between the current primary / backup information and the reference primary / backup information. The primary / backup modes include a primary control mode and a backup control mode. Specifically, the method of this embodiment includes the following steps:

[0062] If the comparison result indicates that the current primary / backup information is consistent with the reference primary / backup information, and the current primary / backup information and the reference primary / backup information represent the primary control mode corresponding to the first control node, then the primary control mode is determined as the target mode of the first control node; if the comparison result indicates that the current primary / backup information is consistent with the reference primary / backup information, and the current primary / backup information and the reference primary / backup information represent the backup control mode corresponding to the first control node, then the backup control mode is determined as the target mode of the first control node.

[0063] In conjunction with the foregoing embodiments, after the matrix device is started, the first control node can obtain the power-on status of the second control node through the microcontroller system. If the second control node is not powered on, the first control node will start directly in the form of a single control board (as the master control node).

[0064] It should be noted that before the matrix device starts up, the first control node and the second control node are usually not distinguished as master / slave. Therefore, the first control node and the second control node can be the same or different. The method of this application can be applied to the second control node in the same way. Essentially, in an application scenario where the second control node is the execution subject, after the matrix device starts up, the second control node can obtain the power-on status of the first control node through the microcontroller system. If the first control node is not powered on, the second control node starts directly as a single control board (as the master control node). The first control node and the second control node can both apply this method simultaneously. After determining the master / slave relationship between the first and second control nodes, their execution processes then follow the preset master control mode and standby control mode respectively.

[0065] In other embodiments of this application, the first control node and the second control node may also run the same or different method steps, which can be set as needed according to the actual application scenario, and will not be elaborated here. The embodiments of this application are mainly explained from the perspective of the operation of the first control node.

[0066] If both the first control node and the second control node are powered on, the first control node can obtain the second historical primary / backup information stored by the second control node and the first historical primary / backup information stored by itself. It can then, according to the method described in the foregoing embodiments, elect the current primary / backup information based on the first and second historical primary / backup information. In fact, the current primary / backup information also serves as a reference for the primary / backup relationship of each node during the current operation. By comparing the current primary / backup information with the reference primary / backup information, the target primary / backup information that should be set during the current operation can be determined.

[0067] The first control node can obtain its corresponding Redis cluster information (including reference master / slave information). If the current master / slave information is consistent with the first control node's reference master / slave information in the Redis cluster, and both the current master / slave information and the reference master / slave information indicate that the first control node is the master node, the first control node can start in master mode. If the current master / slave information is consistent with the first control node's reference master / slave information in the Redis cluster, and both the current master / slave information and the reference master / slave information indicate that the first control node is the slave node, the first control node can start in slave mode.

[0068] Similarly, the second control node can also implement the method described above in this application, determining whether the current master-slave information is consistent with the reference master-slave information of the second control node in the Redis cluster, and the master-slave relationship represented by the current master-slave information and the reference master-slave information, which will not be elaborated in detail.

[0069] Based on the above embodiments, this application embodiment describes the steps of determining the target mode of the first control node from the primary / backup modes based on the comparison result between the current primary / backup information and the reference primary / backup information. The primary / backup modes include a primary control mode and a backup control mode. Specifically, the method of this embodiment includes the following steps:

[0070] If the comparison result indicates that the current primary / backup information is inconsistent with the reference primary / backup information, and the current primary / backup information indicates the backup control mode corresponding to the first control node while the reference primary / backup information indicates the primary control mode corresponding to the first control node, then the database is reset, and the backup control mode is determined as the target mode of the first control node. If the comparison result indicates that the current primary / backup information is inconsistent with the reference primary / backup information, and the current primary / backup information indicates the primary control mode corresponding to the first control node while the reference primary / backup information indicates the backup control mode corresponding to the first control node, then the database is waited for the second control node to reset, and the primary control mode is determined as the target mode of the first control node.

[0071] In conjunction with the foregoing embodiments, if the comparison results indicate that the current primary / backup information is inconsistent with the reference primary / backup information, it indicates that the primary / backup relationship of each node has been switched, which may be due to an anomaly that occurred during the previous operation.

[0072] Therefore, on the one hand, when the current primary / backup information is inconsistent with the reference primary / backup information, if the current primary / backup information represents the backup control mode corresponding to the first control node and the reference primary / backup information obtained from Redis represents the primary control mode corresponding to the first control node, then the Redis cluster can be reset by restarting the keepalived process, so that the Redis corresponding to the first control node is changed to the backup control mode, and then the first control node can be started and run in the backup control mode.

[0073] On the other hand, when the current primary / standby information is inconsistent with the reference primary / standby information, if the current primary / standby information indicates the primary control mode of the first control node, and the reference primary / standby information obtained from Redis indicates the standby control mode of the first control node, then it is necessary to wait for the second control node to restart the keepalived process, reset the Redis cluster, and change the Redis corresponding to the second control node to standby control mode, thereby preventing the second control node from occupying the primary control mode. Then the first control node will start and run in primary control mode.

[0074] Furthermore, if the first control node starts in master mode, it can synchronize its own configuration (including but not limited to master / slave information) to Redis. If the first control node starts in slave mode, it can retrieve the Redis configuration and save it to its local storage. Therefore, after the Redis cluster starts, the master / slave information from this operation can be recorded and saved for use in subsequent operations.

[0075] Based on the above embodiments, this application embodiment describes the steps after startup and operation according to the target mode. Specifically, the method of this embodiment includes the following steps:

[0076] If the target mode is the master control mode, in response to the signaling data sent by the client, the system obtains the first service data from the first data source based on the signaling data; the first service data is then sent to the service execution node for processing; the signaling data is sent to the second control node for obtaining the second service data from the first data source based on the signaling data; in response to an anomaly in the first control node, an anomaly message is sent to the second control node to switch to the master control mode, and the second service data is sent to the service execution node for processing.

[0077] This embodiment, in conjunction with the foregoing embodiments, primarily illustrates the specific business process after the matrix device is started. See the examples below. Figure 3 As shown, Figure 3 This is an exemplary business process diagram of the control method of the server system in this application. The first business data and the second business data can essentially be the same type of data.

[0078] If the first control node operates in master mode, then it is the master control node; if the second control node operates in standby mode, then it is the standby control node. Both the master and standby control nodes can simultaneously obtain business data from the first data source and distribute the data to their respective business boards. When the master control node fails, the standby control node and business boards can seamlessly take over data services, ensuring uninterrupted data flow on the business boards.

[0079] For example, the client manages the matrix device through an external virtual IP address, and users can send signaling to the matrix device through the client. After receiving the signaling, the business service process 2 of the master control node obtains the first business data (such as audio and video data) from the first data source through business service process 1, and forwards the obtained business data to the service card. At the same time, it can also synchronize signaling and related configuration information with the backup control node. Here, business service process 1 and business service process 2 can be two different business service processes. Each control node can include at least two business service processes. Business service process 2 can be responsible for the signaling flow, and business service process 1 can be responsible for the data flow.

[0080] In another example, for the second control node in this scenario, after the backup control node's business service process receives the signaling sent by the master control node based on RPC communication (Remote Procedure Call), it will also request audio and video data from the first data source as a backup data stream (second business data), and at the same time forward the backup data to the business board.

[0081] It should be noted that in this scenario, the service board can process only one data stream. That is, when both primary and backup data exist, the backup data is not processed. The service board will only process the backup data when a problem occurs in the data stream, such as a failure or anomaly of the primary control node. The service stream switching can be completed internally within the service board, thus ensuring rapid switching between primary and backup modes. Specifically, when the primary control node fails, an exception message can be sent to the backup control node to initiate a primary / backup switch, causing the second control node (backup control node) to switch to primary control mode; alternatively, the backup control node (second control node) can actively detect the primary control node (first control node), without limitation.

[0082] Based on the above embodiments, this application embodiment describes the steps prior to sending an exception message to the second control node in response to an anomaly in the first control node, causing the second control node to switch to master control mode. Specifically, the method of this embodiment includes the following steps:

[0083] The first keep-alive process in the first control node is used to detect whether there are any abnormalities in the business service processes in the first control node; if there are abnormalities, the business weight of the first control node is reduced according to the first keep-alive process.

[0084] Referring to the foregoing embodiments, the method for determining whether the first control node (master node) is abnormal in this application can be detected through the keepalived keep-alive process. Examples can be found as follows... Figure 4 As shown, Figure 4 This is an exemplary abnormal switching process diagram in the control method of the server system of this application.

[0085] For example, if the first control node is the master control node, when its business service process encounters an anomaly, the detection script of its keepalived process (the first keepalive process) will detect the anomaly. At this time, the first keepalive process reduces its own business weight, generates anomaly information, and can send the anomaly information to the keepalived process (the second keepalive process) of the second control node through the VRRP protocol (Virtual Router Redundancy Protocol).

[0086] Based on the above embodiments, this application embodiment describes the steps of sending exception information to the second control node in response to an anomaly in the first control node, causing the second control node to switch to master control mode. The exception information includes weight reduction information. Specifically, the method of this embodiment includes the following steps:

[0087] In response to an anomaly in the first control node, a weight reduction information is generated based on the reduced service weight of the first control node. The weight reduction information is then sent to the second keep-alive process of the second control node through the first keep-alive process, so that the second control node switches to master control mode based on the received weight reduction information.

[0088] Referring to the foregoing embodiments, after detecting an anomaly in the first control node, the first keep-alive process reduces the service weight and generates weight reduction information. This weight reduction information may include, but is not limited to, the reduced weight, the weight difference before and after the reduction, and / or the number of weight reductions. Different implementation methods can be selected based on different weight reduction information, which will not be elaborated here. Furthermore, the first keep-alive process can send the weight reduction information to the second keep-alive process of the second control node, so that the second control node switches to master control mode based on the received weight reduction information.

[0089] For example, it can be determined whether the reduced weight is less than a preset weight threshold. If so, the second control node switches to the master control mode; if not, it can be considered as an abnormal false detection or a repairable abnormality (the impact on the first control node is not serious), so it can continue to operate normally without switching.

[0090] Another example is determining whether the weight difference before and after the weight reduction is greater than a preset weight threshold. If so, the second control node switches to master control mode; if not, it can be considered a false alarm or a repairable anomaly (without serious impact on the first control node), so no switching is required and it continues to operate normally. The preset weight threshold in this example can be the same as or different from the predicted weight threshold in the previous example; this is not limited here.

[0091] Another example is whether the number of times the weight is reduced is greater than a preset threshold (e.g., 3 times). If so, the second control node switches to the master control mode; if not, it can be considered as a false alarm or a repairable anomaly (the impact on the first control node is not serious), so it can continue to operate normally without switching.

[0092] Specifically, if the second control node detects a decrease in the service weight of the first control node, it can switch to a primary / standby mode, changing from a standby node to a primary control node, setting an internal virtual IP, and simultaneously setting the second control node's Redis-server to primary control mode. After the first control node's keepalived changes to standby mode, it will remove both its internal and external virtual IPs, and simultaneously change the first control node's Redis-server to standby mode. Once the second control node's service processes detect that its Redis has changed to primary control mode, they will configure an external virtual IP and take over the related services previously running on the first control node.

[0093] Based on the above embodiments, this application embodiment describes the steps after startup and operation according to the target mode. Specifically, the method of this embodiment includes the following steps:

[0094] If the target mode is the master control mode, in response to the signaling data received from the client, data is obtained from the second data source based on the signaling data to obtain the third service data; the third service data is sent to the service execution node so that the service execution node can process the third service data; the signaling data is sent to the second control node so that the second control node can obtain data from the third data source based on the signaling data to obtain the fourth service data; in response to the first control node's abnormality, the second control node is controlled to switch to the master control mode so that the second control node can establish a connection with the second data source, obtain the third service data from the second data source, and send the third service data and the fourth service data to the service execution node for processing.

[0095] In conjunction with the foregoing embodiments, in order to improve resource utilization, the method of this embodiment can also be used to simultaneously invoke the first control node and the second control node for business processing.

[0096] If the first control node operates in master mode, it becomes the master control node; if the second control node operates in standby mode, it becomes the standby control node. The master and standby control nodes can obtain business data from the second and third data sources, respectively, and distribute the data to their corresponding business boards. When the master control node fails, the standby control node and business boards can seamlessly take over data services, ensuring uninterrupted data flow on the business boards. This also prevents the resources of the second control node from being idle while the first control node is operating normally as the master control node. See the example below. Figure 5 As shown, Figure 5 This is another exemplary abnormal switching process diagram in the control method of the server system of this application.

[0097] For example, the client can issue signaling requiring both the primary control node and the backup control node to simultaneously request data from the second and third data sources. Upon receiving the signaling, the primary control node will forward it to the backup control node. Unlike the previous embodiment, the primary control node requests service data from the second data source, obtains the third service data, and forwards it to the service board. The backup control node requests service data from the third data source, obtains the fourth service data, and forwards it to the service board. The third and fourth service data can be the same type of data or different types of data.

[0098] In this scenario, the service board does not distinguish between primary and backup data, but processes all data. Specifically, the third and fourth service data can be processed by the same service board, or by different service boards; there is no limitation here.

[0099] When the primary control node fails, the backup control node takes over the data link between the primary control node and the second data source, ensuring that the service board can receive data from both the second and third data sources through the backup control node. This method reduces resource waste and improves resource utilization.

[0100] The method described in this application allows the backup node to establish data links simultaneously, increasing the stability of the data links during primary / backup failover and reducing resource idleness.

[0101] Based on the above embodiments, this application embodiment describes the steps for determining the current primary / standby information based on the first historical primary / standby information of the first control node and the obtained second historical primary / standby information of the second control node. Specifically, the method of this embodiment includes the following steps:

[0102] Obtain the current timestamp, the first timestamp of the first historical primary / backup information, and the second timestamp of the second historical primary / backup information; determine the current primary / backup information from the first historical primary / backup information and the second historical primary / backup information based on the comparison results between the current timestamp and the first timestamp, and the comparison results between the current timestamp and the second timestamp.

[0103] In conjunction with the foregoing embodiments, in the process of determining the current primary / backup information based on the first and second historical primary / backup information, the current timestamp, the first timestamp corresponding to the first historical primary / backup information, and the second timestamp corresponding to the second historical primary / backup information can be obtained. By comparing the current timestamp with the first timestamp and the second timestamp, it can be determined which of the first and second historical primary / backup information is closer to the current time.

[0104] It should be noted that since a control node may remain in an abnormal state for an extended period or be replaced by another control node (e.g., by adding a third control node), the current primary / backup information determined by the most recent historical primary / backup information is more reliable and effective.

[0105] The method described in this application eliminates the need for manual intervention during device startup, and avoids the risk of losing relevant configurations due to primary / standby switching. By automatically detecting configuration priorities and determining the primary / standby relationship of each node, it also prevents the loss of original system configurations caused by a new node starting in non-preemptive mode becoming the primary node.

[0106] Based on the above embodiments, it should be noted that the matrix device of this application supports the plug-and-play replacement of the control board, thereby realizing the replacement of control nodes. For example, if a control node experiences an irreparable malfunction or in order to quickly put it into operation, the control board of the malfunctioning control node can be removed, and a normally functioning control board can be inserted into the slot. Therefore, in practical application scenarios, it is necessary to determine whether the control node (hardware) has been replaced.

[0107] For clarity, control boards that haven't been replaced are referred to as native boards (native single boards), while replaced control boards are referred to as non-native boards (non-native single boards). For native boards, the serial number stored on the control board matches the actual serial number of the device obtained during operation. For non-native boards, the serial number stored on the control board does not match the actual serial number of the device obtained during operation.

[0108] Therefore, the startup process of business services will negotiate the primary / standby relationship based on different scenarios, as shown in the table below:

[0109]

[0110] It should be further noted that the entity executing the control method of the server system can be the control device of the server system. For example, the control method of the server system can be executed by a terminal device, a server, or other processing devices. The terminal device can be a user equipment (UE), computer, mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. In some possible implementations, the control method of the server system can be implemented by the processor calling computer-readable instructions stored in memory.

[0111] Figure 6This is a block diagram illustrating a control device for a server system, as shown in an exemplary embodiment of this application. Figure 6 As shown, the control device 600 of this exemplary server system includes: a current information determination module 610, a reference information acquisition module 620, a mode determination module 630, and an operation module 640. Specifically:

[0112] The current information determination module 610 is used to determine the current primary / backup information based on the first historical primary / backup information of the first control node and the second historical primary / backup information of the second control node obtained.

[0113] The reference information acquisition module 620 is used to acquire the reference master and backup information of the first control node in the database.

[0114] The mode determination module 630 is used to determine the target mode of the first control node from the primary and backup modes based on the comparison results between the current primary and backup information and the reference primary and backup information.

[0115] Run module 640, used to start and run according to the target mode.

[0116] In the control device of this exemplary server system, by acquiring the first historical primary / backup information of the first control node and the second historical primary / backup information of the second control node, the current primary / backup information to be set for the first control node in the current operating scenario is determined based on the first and second historical primary / backup information. Reference primary / backup information of the first control node in the database is acquired; this reference information records the primary / backup information set by the first control node during operation in historical operating scenarios. Historical operating scenarios are earlier than the current operating scenario. By comparing the current primary / backup information and the reference primary / backup information, it can be determined whether the primary / backup information of the first control node in the current operating scenario is consistent with that in historical operating scenarios. Therefore, based on the comparison result between the current primary / backup information and the reference primary / backup information, the target mode that the first control node should currently run can be determined from the primary / backup modes. The system is then started and run according to the target mode, enabling the control node to adaptively determine the target mode to be run in the server system operating scenario. This reduces the need for manual reset of the primary / backup mode and improves the operating efficiency of the server system.

[0117] It should be noted that the apparatus and method provided in the above embodiments belong to the same concept, and the specific ways in which each module and unit performs operations have been described in detail in the method embodiments, and will not be repeated here. In practical applications, the apparatus provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the apparatus can be divided into different functional modules to complete all or part of the functions described above, and this is not a limitation.

[0118] The functions of each module can be found in the implementation examples of the control method of the server system, and will not be repeated here.

[0119] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. The electronic device 100 includes a memory 101 and a processor 102. The processor 102 is used to execute program instructions stored in the memory 101 to implement the steps in any of the above-described server system control method embodiments. In a specific implementation scenario, the electronic device 100 may include, but is not limited to, a microcomputer or a server. In addition, the electronic device 100 may also include mobile devices such as laptops and tablets, which are not limited here.

[0120] Specifically, processor 102 controls itself and memory 101 to implement the steps in any of the above-described server system control method embodiments. Processor 102 may also be referred to as a CPU (Central Processing Unit). Processor 102 may be an integrated circuit chip with signal processing capabilities. Processor 102 may also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor. Furthermore, processor 102 may be implemented using integrated circuit chips.

[0121] In this exemplary electronic device, by acquiring the first historical primary / backup information of the first control node and the second historical primary / backup information of the second control node, the current primary / backup information to be set for the first control node in the current operating scenario is determined based on the first and second historical primary / backup information. Reference primary / backup information of the first control node in the database is acquired; this reference information records the primary / backup information set by the first control node during operation in historical operating scenarios. Historical operating scenarios are earlier than the current operating scenario. By comparing the current primary / backup information and the reference primary / backup information, it can be determined whether the primary / backup information of the first control node in the current operating scenario is consistent with that in historical operating scenarios. Therefore, based on the comparison result between the current primary / backup information and the reference primary / backup information, the target mode that the first control node should currently run can be determined from the primary / backup modes. The system is then started and run according to the target mode, enabling the control node to adaptively determine the target mode to run in the server system operating scenario. This reduces the need for manual reset of the primary / backup mode and improves the operating efficiency of the server system.

[0122] Please see Figure 8 , Figure 8 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. The computer-readable storage medium 110 stores program instructions 111 that can be executed by a processor. The program instructions 111 are used to implement the steps in any of the above-described server system control method embodiments.

[0123] In this exemplary storage medium, by running program instructions in the storage medium, the first historical primary / backup information of the first control node and the second historical primary / backup information of the second control node are obtained. Based on the first and second historical primary / backup information, the current primary / backup information to be set for the first control node in the current operating scenario is determined. The reference primary / backup information of the first control node in the database is obtained. The reference primary / backup information records the primary / backup information set by the first control node during operation in historical operating scenarios. The historical operating scenarios are earlier than the current operating scenario. By comparing the current primary / backup information and the reference primary / backup information, it can be determined whether the primary / backup information of the first control node in the current operating scenario is consistent with the primary / backup information in the historical operating scenarios. Thus, based on the comparison result between the current primary / backup information and the reference primary / backup information, the target mode that the first control node should currently run can be determined from the primary / backup modes. The system is started and run according to the target mode, realizing that the control node adaptively determines the target mode to be run in the server system operating scenario, reducing the step of manually resetting the primary / backup mode and improving the operating efficiency of the server system.

[0124] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0125] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.

[0126] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0127] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A control method for a server system, characterized in that, The method is applied to a first control node in the server system, which further includes at least a second control node and a database. The first control node, the second control node, and the database are communicatively connected. The method includes: Based on the first historical primary / backup information of the first control node and the second historical primary / backup information of the second control node obtained, the current primary / backup information is determined; Obtain the reference primary / backup information of the first control node in the database; Based on the comparison result between the current primary / backup information and the reference primary / backup information, the target mode of the first control node is determined from the primary / backup modes; Start and run according to the target mode.

2. The method according to claim 1, characterized in that, The primary / standby mode includes a primary control mode and a standby control mode. Determining the target mode of the first control node from the primary / standby mode based on the comparison result between the current primary / standby information and the reference primary / standby information includes: In response to the comparison result indicating that the current primary / backup information is consistent with the reference primary / backup information, and the current primary / backup information and the reference primary / backup information indicating that the first control node corresponds to the primary control mode, the primary control mode is determined as the target mode of the first control node. In response to the comparison result indicating that the current primary / backup information is consistent with the reference primary / backup information, and the current primary / backup information and the reference primary / backup information indicating that the first control node corresponds to the backup control mode, the backup control mode is determined as the target mode of the first control node.

3. The method according to claim 1, characterized in that, The primary / standby mode includes a primary control mode and a standby control mode. Determining the target mode of the first control node from the primary / standby mode based on the comparison result between the current primary / standby information and the reference primary / standby information includes: In response to the comparison result indicating that the current primary / backup information is inconsistent with the reference primary / backup information, and the current primary / backup information indicating that the first control node corresponds to the backup control mode and the reference primary / backup information indicating that the first control node corresponds to the primary control mode, the database is reset and the backup control mode is determined as the target mode of the first control node. In response to the comparison result indicating that the current primary / backup information is inconsistent with the reference primary / backup information, and the current primary / backup information indicates the primary control mode corresponding to the first control node and the reference primary / backup information indicates the backup control mode corresponding to the first control node, the system waits for the second control node to reset the database and determines the primary control mode as the target mode of the first control node.

4. The method according to claim 1, characterized in that, After starting the operation according to the target mode, the method further includes: If the target mode is the master control mode, in response to the signaling data sent by the received client, the service data is obtained from the first data source according to the signaling data to obtain the first service data; The first service data is sent to the service execution node so that the service execution node processes the first service data. The signaling data is sent to the second control node, so that the second control node obtains the service data from the first data source based on the signaling data, and obtains the second service data. In response to an anomaly in the first control node, an anomaly message is sent to the second control node to cause the second control node to switch to the master control mode, and the second service data is sent to the service execution node for processing.

5. The method according to claim 4, characterized in that, Before responding to an anomaly in the first control node and sending an anomaly message to the second control node to switch the second control node to the master control mode, the method further includes: The first keep-alive process in the first control node is used to detect whether there are any abnormalities in the business service processes in the first control node. If an anomaly is detected, the service weight of the first control node will be reduced according to the first keep-alive process.

6. The method according to claim 5, characterized in that, The abnormal information includes weight reduction information. The step of responding to an abnormality in the first control node by sending abnormal information to the second control node to cause the second control node to switch to the master control mode includes: In response to an anomaly in the first control node, the weight reduction information is generated based on the reduced service weight of the first control node. The weight reduction information is sent from the first keep-alive process to the second keep-alive process of the second control node, so that the second control node switches to the master control mode according to the received weight reduction information.

7. The method according to claim 1, characterized in that, After starting the operation according to the target mode, the method further includes: If the target mode is the master control mode, in response to the signaling data sent by the client, data is obtained from the second data source according to the signaling data to obtain the third service data; The third service data is sent to the service execution node so that the service execution node processes the third service data. The signaling data is sent to the second control node, so that the second control node can obtain data from the third data source based on the signaling data to obtain the fourth service data; In response to an anomaly in the first control node, the second control node is switched to the master control mode so that the second control node can establish a connection with the second data source, obtain the third service data from the second data source, and send the third service data and the fourth service data to the service execution node for processing.

8. The method according to claim 1, characterized in that, The step of determining the current primary / standby information based on the first historical primary / standby information of the first control node and the obtained second historical primary / standby information of the second control node includes: Obtain the current timestamp, the first timestamp of the first historical primary / backup information, and the second timestamp of the second historical primary / backup information; Based on the comparison between the current timestamp and the first timestamp, and the comparison between the current timestamp and the second timestamp, the current primary / backup information is determined from the first historical primary / backup information and the second historical primary / backup information.

9. An electronic device, characterized in that, The method includes a memory and a processor, the processor being configured to execute program instructions stored in the memory to implement the method according to any one of claims 1 to 8.

10. A computer-readable storage medium having program instructions stored thereon, characterized in that, When the program instructions are executed by the processor, they implement the method described in any one of claims 1 to 8.