A method of time synchronization and related components

CN116846501BActive Publication Date: 2026-09-22JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310576293.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-19
Publication Date
2026-09-22
Estimated Expiration
2043-05-19

AI Technical Summary

Technical Problem

但由于通过NTP服务进行时间同步时,每次只能调节少量时间,且每次调节操作之间的间隔长,这种时间同步方式对于时间偏差较大的情况调节速度慢,导致服务器集群中的服务器持续上报告警信息,影响服务器集群信息展示的准确性

Benefits of technology

[0040]本发明提供的一种时间同步的方法及相关组件,在发现时间不同步的情况后,停止从服务器与主时间服务器的自动时间校正,避免服务器集群产生告警误报;基于用户操作通过远程连接协议对时间进行手动调整,每次可以调节较大量的时间,且调节速度快,调节时间的效率相比自动时间校正来说更高;同时在完成时间同步后,恢复从服务器与主时间服务器的自动时间校正,保留服务器集群的自动校正功能的同时,保证了服务器集群信息展示的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116846501B_ABST
    Figure CN116846501B_ABST
Patent Text Reader

Abstract

The application discloses a time synchronization method and related components, and relates to the technical field of server cluster, wherein after discovering that the time is not synchronized, the automatic time correction of the slave server and the master time server is stopped, so that the alarm false alarm of the server cluster is avoided; the time is manually adjusted based on the user operation through the remote connection protocol, a large amount of time can be adjusted each time, the adjustment speed is fast, and the adjustment efficiency is higher than that of the automatic time correction; meanwhile, after the time synchronization is completed, the automatic time correction of the slave server and the master time server is restored, so that the automatic correction function of the server cluster is retained, and the accuracy of the information display of the server cluster is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of server cluster technology, and in particular to a time synchronization method and related components. Background Technology

[0002] The purpose of time synchronization is to calibrate the times of different servers so that their relative time deviations are zero or very small. For large server clusters, time synchronization is fundamental for the normal operation of the cluster and the exchange of information between servers, and is a prerequisite for establishing connection links between them. Specifically, during the setup of a server cluster environment, one server in the cluster is designated as the master time server, and the other servers are designated as slave servers. The slave servers use the master time server as their clock source to ensure that the time of the entire server cluster is consistent with the clock source, thus achieving time synchronization.

[0003] In related technologies, when a time discrepancy occurs between a slave server and the master time server in a server cluster, automatic time correction is performed using the NTP (Network Time Protocol) service. This involves exchanging time information between the slave server and the master time server to obtain the master time information and then performing multiple modulation corrections on the slave server experiencing the time discrepancy to adjust its local time. However, because time synchronization via NTP can only adjust a small amount of time at a time, and the intervals between each adjustment are long, this time synchronization method is slow when dealing with large time discrepancies. This causes servers in the cluster to continuously report alarm information, affecting the accuracy of the displayed cluster information. Summary of the Invention

[0004] The purpose of this invention is to provide a time synchronization method and related components, which can adjust a large amount of time each time, and the adjustment speed is fast. The efficiency of time adjustment is higher than that of automatic time correction, thus ensuring the accuracy of server cluster information display.

[0005] To address the aforementioned technical problems, this invention provides a time synchronization method applied to a server cluster, wherein the server cluster includes a master time server and multiple slave servers connected to the master time server, and the method includes:

[0006] When a time discrepancy is detected between the slave server and the master time server, the automatic time correction between the slave server and the master time server is stopped.

[0007] The time of the slave server is adjusted based on user operation via a remote connection protocol to synchronize the time of the slave server with that of the master time server;

[0008] Once the slave server synchronizes its time with the master time server, the automatic time correction between the slave server and the master time server is restored.

[0009] On the one hand, before detecting a time discrepancy between the slave server and the master time server, the method further includes:

[0010] Obtain the time difference between the slave server and the master time server;

[0011] Determine whether the time difference is greater than a preset time difference threshold;

[0012] If so, it is determined that there is a time discrepancy between the slave server and the master time server.

[0013] On the one hand, after detecting a time discrepancy between the slave server and the master time server, the method further includes:

[0014] Set the storage disks in the server cluster to maintenance mode;

[0015] After the slave server synchronizes its time with the master time server, the following is also included:

[0016] Cancel the maintenance status set for the storage disks in the server cluster.

[0017] On the other hand, after detecting a time discrepancy between the slave server and the master time server, the method further includes:

[0018] The heartbeat interval for sending heartbeats from the server to the master time server is adjusted from a first heartbeat interval to a preset second heartbeat interval, wherein the duration of the first heartbeat interval is less than the duration of the second heartbeat interval;

[0019] After the slave server synchronizes its time with the master time server, the following is also included:

[0020] The heartbeat interval for sending heartbeats from the slave server to the master time server is adjusted from the second heartbeat interval to the first heartbeat interval.

[0021] On the one hand, before stopping the time correction between the slave server and the master time server, the method further includes:

[0022] Determine whether the storage high availability service of the slave server is functioning normally;

[0023] If so, proceed to the step of stopping the time correction between the slave server and the master time server;

[0024] If not, then the storage high availability service of the slave server is repaired.

[0025] On the one hand, after restoring the automatic time correction between the slave server and the master time server, the method further includes:

[0026] Determine whether no alarm information has appeared in the server cluster within the preset verification time;

[0027] If so, the server cluster is determined to be in a normal state.

[0028] On the other hand, before restoring the automatic time correction between the slave server and the master time server, the method further includes:

[0029] Obtain the time difference between the slave server and the master time server;

[0030] Determine whether the time difference is greater than a preset time difference threshold;

[0031] If so, it is determined that there is a time discrepancy between the slave server and the master time server.

[0032] The present invention also provides a time synchronization device applied to a processor in a server cluster, the server cluster further including a master time server and multiple slave servers connected to the master time server, the device comprising:

[0033] The automatic time correction stop module is used to stop the automatic time correction between the slave server and the master time server when a time discrepancy is detected between the slave server and the master time server.

[0034] The remote correction module is used to adjust the time of the slave server based on user operation via a remote connection protocol, so as to synchronize the time of the slave server with that of the master time server;

[0035] An automatic time correction and recovery module is used to restore the automatic time correction between the slave server and the master time server after the slave server has synchronized its time with the master time server.

[0036] The present invention also provides a server cluster, including a master time server and multiple slave servers connected to the master time server, and further comprising:

[0037] Memory, used to store computer programs;

[0038] A processor for executing the computer program to implement the time synchronization method as described above.

[0039] The present invention also provides a computer-readable storage medium on which a computer program is stored, wherein the target computer program, when executed by a processor, implements the steps of the time synchronization method as described above.

[0040] This invention provides a time synchronization method and related components. Upon detecting time discrepancies, it stops automatic time correction between the slave server and the master time server to avoid false alarms from the server cluster. It allows for manual time adjustment via a remote connection protocol based on user operation, enabling adjustments to a larger amount of time at a time with faster speed and higher efficiency compared to automatic time correction. Simultaneously, after time synchronization is complete, it resumes automatic time correction between the slave server and the master time server, preserving the automatic correction function of the server cluster while ensuring the accuracy of the displayed server cluster information. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the prior art and embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 A flowchart of a time synchronization method provided in an embodiment of the present invention;

[0043] Figure 2 A flowchart illustrating another time synchronization method provided in an embodiment of the present invention;

[0044] Figure 3 A schematic diagram of a time synchronization device provided in an embodiment of the present invention;

[0045] Figure 4 This is a schematic diagram of a server cluster structure provided in an embodiment of the present invention;

[0046] Figure 5 This is a schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present invention. Detailed Implementation

[0047] The core of this invention is to provide a time synchronization method and related components, which can adjust a large amount of time each time, and the adjustment speed is fast. The efficiency of time adjustment is higher than that of automatic time correction, thus ensuring the accuracy of server cluster information display.

[0048] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0049] Please refer to Figure 1 , Figure 1 A flowchart of a time synchronization method provided in this embodiment of the invention, applied to a server cluster, the server cluster including a master time server and multiple slave servers connected to the master time server, the method including:

[0050] S101: When a time discrepancy is detected between the slave server and the master time server, stop the automatic time correction between the slave server and the master time server;

[0051] In a specific implementation, the availability is enhanced by periodically checking the status of the server cluster to confirm whether there are any time synchronization issues. Generally, this check is performed every 10 minutes. If there is a time synchronization issue between the slave server and the master time server, and the error between the two servers is large, then the automatic time correction between the slave server and the master time server is stopped. That is, the NTP service of all servers in the cluster is stopped using the `systemctl stop ntpd` command, so that the server time can be adjusted according to user operations later.

[0052] It should be noted that this embodiment does not limit the specific type of server cluster. In some embodiments, the time synchronization method of this embodiment is mainly for distributed storage systems. A distributed storage system is a storage platform designed for mid-to-high-end storage applications. It features high reliability, high scalability, and high performance, and provides a dedicated interface management platform for service settings, alarm monitoring, and statistical information display. The service settings, alarm monitoring, and statistical information display of cluster nodes all rely on the cluster's clock synchronization. If the time is inconsistent, it will lead to some service settings failures, false alarms, and abnormal statistical information display.

[0053] During the setup of the storage system environment, a server is selected as the master time server. Other servers in the server cluster use this master time server as their clock source and as the reference for time synchronization. For small time discrepancies on nodes, time synchronization can be achieved through the NTP service. However, if a cluster node experiences a large time discrepancy, or if the master time server itself has a time error, time consistency among the cluster nodes cannot be guaranteed.

[0054] By default, the server's NTP service updates its time from an external time server. In a cluster, it's sufficient to ensure all servers in the cluster have the same time. Therefore, one server is configured as the master time server, and the other servers act as clients, retrieving time data from the master time server to avoid network connectivity issues. The selection of the master time server is typically based on the IP address range of the servers in the cluster. This configuration depends on your gateway and network segment; as long as communication between hosts on the local area network is guaranteed, it's acceptable. This configuration authorizes the range of hosts within the local area network that can synchronize their time with the local network. Therefore, time discrepancies could arise because a slave server is shut down, experiences a power outage, or its time deviates from the master time server's, or the master time server itself may be out of sync with the correct time.

[0055] This embodiment does not limit the specific method for detecting time asynchrony between the slave server and the master time server. For example, a time threshold can be preset, and the time difference between the slave server and the master time server can be judged periodically. When the time difference exceeds the time threshold, it is determined that the time between the slave server and the master time server is out of sync. Alternatively, it can be determined by time anomaly alarm information, or other methods can be used to detect the time difference between the slave server and the master time server. Operators can set these methods according to the actual situation.

[0056] S102: Adjust the time of the slave server based on user operation via a remote connection protocol to synchronize the time of the slave server with that of the master time server;

[0057] In a specific embodiment, when the time discrepancy is due to a difference between the slave server and the master time server, the operator can select any server in the server cluster, log in to the time-disconnected slave server via a remote connection protocol, and use the `date -s` command to adjust the time on the slave server. The `date` command can be used to display or set the system time and date. If only the `date` command is entered during actual operation, the system will display the current system time in the default format. The `date` command modifies the time, and different command parameters can be followed to achieve different time modification effects. For example, `date -s "2023-03-10 15:51:50"` will adjust the slave server's time to 2023-03-10 15:51:50, that is, set the server's time to 15:51:50 on March 10, 2023.

[0058] It should be noted that the time interval between each adjustment should not exceed 20 seconds. If the time interval between each adjustment is too long, the server's alarm system may make a misjudgment, that is, it may assume that the clock on one end has failed and automatically issue an alarm, which may cause business risks. Therefore, when the time error is large, multiple adjustments are required, and the server cluster must be ensured to be in a normal state before each adjustment.

[0059] If the time discrepancy is due to a deviation between the master time server's own time and the correct time, the operator can select any server in the server cluster, log in to the master time server via a remote connection protocol, and use the date -s command to adjust the master time server's time.

[0060] This embodiment does not limit the specific type of remote connection protocol. In this embodiment, the SSH protocol (Secure Shell) is used to establish a connection between a server with a different time and a server operated by an operator. Of course, other remote connection protocols with communication functions can also be used, as long as they can establish a communication connection between the two servers and can issue time adjustment instructions to the server with a different time through the remote connection protocol.

[0061] S103: After the slave server synchronizes its time with the master time server, restore the automatic time correction between the slave server and the master time server.

[0062] In a specific embodiment, once the time of each server in the cluster is consistent, the NTP service of all servers in the cluster is restarted, and the status of the NTP service is checked. When the status of the NTP service is normal, the time synchronization process ends.

[0063] This invention provides a time synchronization method and related components. Upon detecting time discrepancies, it stops automatic time correction between the slave server and the master time server to avoid false alarms from the server cluster. It allows for manual time adjustment via a remote connection protocol based on user operation, enabling adjustments to a larger amount of time at a time with faster speed and higher efficiency compared to automatic time correction. Simultaneously, after time synchronization is complete, it resumes automatic time correction between the slave server and the master time server, preserving the automatic correction function of the server cluster while ensuring the accuracy of the displayed server cluster information.

[0064] Based on the above embodiments:

[0065] In some embodiments, before S101 detects a time discrepancy between the slave server and the master time server, the method further includes:

[0066] Obtain the time difference between the slave server and the master time server;

[0067] In a specific embodiment, the ntpq -p command is used to query the NTP servers in the network, and the relationship between the master time server and each slave server is displayed. Specifically, a list with detailed information is obtained. The offset in the table represents the time offset between the master time server and the slave servers, in milliseconds (ms). The closer the offset is to 0, the closer the time of the slave server is to the master time server.

[0068] Determine if the time difference is greater than a preset time difference threshold;

[0069] If so, it is determined that there is a time discrepancy between the slave server and the master time server.

[0070] In a specific embodiment, the offset value returned after the ntpq-p command is issued is observed. If the error exceeds 1000, that is, exceeds the preset time difference threshold, it is determined that there is a time discrepancy between the slave server and the master time server.

[0071] This embodiment uses the offset value to obtain the time difference between the slave server and the master time server, and determines whether there is a time asynchrony based on the time difference threshold. Even if the time anomaly alarm fails to detect the time anomaly, it greatly improves the operability of operation and maintenance and the reliability of the system, making it convenient for operators to manage and maintain.

[0072] In some embodiments, after S101 detects a time discrepancy between the slave server and the master time server, the method further includes:

[0073] Set the storage disks in the server cluster to maintenance mode;

[0074] In a specific embodiment, when a time discrepancy is detected between the slave server and the master time server, the `icfs osd set noout` command is used to set the storage disks in the server cluster to maintenance mode. This means setting the OSD (Object Storage Device) to noout mode. In this state, the OSD will not be taken out of the cluster, preventing it from being set to down and taken out during time adjustment due to time changes. The data in this OSD will be transferred to other OSDs, and after confirming the OSD status is normal, the data will be migrated back to the original OSD. Here, OSD generally refers to the storage disk used to store data in a server, but it can also be other storage devices. Each server may have multiple OSDs, and data synchronization and transfer between OSDs are possible.

[0075] After synchronizing the time between the slave server and the master time server, the following is also included:

[0076] Cancel the maintenance status setting for the storage disks in the server cluster.

[0077] This embodiment improves the performance of the server cluster by setting the storage disks in the server cluster to maintenance mode, thus avoiding the waste of resources caused by the repeated transfer and migration of data in the OSD occupying the server's processing channels.

[0078] In some embodiments, after S101 detects a time discrepancy between the slave server and the master time server, the method further includes:

[0079] The heartbeat interval for sending heartbeats from the slave server to the master time server is adjusted from the first heartbeat interval to a preset second heartbeat interval, where the duration of the first heartbeat interval is shorter than the duration of the second heartbeat interval.

[0080] For server clusters, determining whether a server is still connected to other servers can be done by checking if it frequently sends messages to them. If messages are frequently received from this server, the connection between servers is likely fine. However, some servers don't frequently send messages to other servers. For these servers, a heartbeat mechanism can be used to determine their online status. Specifically, each time a slave server sends specific data to the master time server after the first heartbeat interval, if the master time server doesn't receive the data message from the slave server within the first heartbeat interval, it considers the slave server offline, meaning the connection between the slave server and the master time server is broken.

[0081] After the slave server sends a heartbeat to the master time server, the master time server returns specific data accordingly. The slave server then sets its local time based on the returned heartbeat. In a specific embodiment, to avoid abnormal operations related to time adjustment during the process of correcting the slave server's time, the heartbeat interval is extended, typically to 1 minute, but can also be longer.

[0082] After synchronizing the time between the slave server and the master time server, the following is also included:

[0083] The heartbeat interval for sending heartbeats from the slave server to the master time server will be adjusted from the second heartbeat interval to the first heartbeat interval.

[0084] In a specific embodiment, after the time synchronization operation is completed, the heartbeat interval between the slave server and the master time server is restored from 1 minute to 6 seconds, that is, the heartbeat time mechanism is restored to its original state.

[0085] This embodiment improves the efficiency and accuracy of time synchronization by adjusting the heartbeat time interval to avoid the heartbeat time mechanism affecting time synchronization based on user operations.

[0086] In some embodiments, before S101 stops time correction between the slave server and the master time server, the method further includes:

[0087] Determine if the storage high availability service on the server is functioning correctly;

[0088] If so, proceed to the step of stopping automatic time correction between the slave server and the master time server;

[0089] If not, then repair the storage high availability service on the slave server.

[0090] Storage high availability is designed to meet the high real-time requirements of production systems and the high availability of production data. When any storage device fails, to ensure uninterrupted business operations, another storage device can continue to provide complete data services. This process mainly involves matching storage devices using IP addresses. Specifically, each server has its own physical IP address, and each physical IP address has its own corresponding virtual IP address. When a server fails, the virtual IP address is automatically matched with the physical IP address of another server. Failover switching is completed automatically without manual intervention. The entire process does not affect other servers' read and write operations, achieving zero data loss and ensuring business continuity.

[0091] In a specific embodiment, server failures, power outages, or removal from the cluster may cause abnormalities in the storage high availability service of the slave server. Therefore, before time correction, the storage high availability service of the slave server must be tested. If any abnormalities are found, they should be repaired in a timely manner to ensure the availability of the storage high availability service.

[0092] This embodiment ensures the availability of the storage high availability service from the slave server by detecting the storage high availability function, ensuring uninterrupted business during time synchronization and improving the reliability of the server cluster.

[0093] In some embodiments, after S103 restores automatic time correction between the slave server and the master time server, the method further includes:

[0094] Determine whether no alarm messages have appeared in the server cluster within the preset verification time;

[0095] If so, the server cluster is considered to be in a normal state.

[0096] In a specific embodiment, the cluster status is observed continuously for 30 minutes. If it remains in a normal state, i.e., no alarm information appears, the time synchronization process of the cluster server is terminated.

[0097] Specifically, IT system administrators, developers, and monitoring personnel must promptly understand and adjust any issues related to storage performance and resources within the server cluster to minimize disruption to normal production line operations. When equipment malfunctions or the system enters an abnormal operating state for any reason, the system can generate alarm messages and log information based on the type and module of the fault. If a network management system is configured, these alarm messages will be sent to the network management system via SNMP (Simple Network Management Protocol). The device can detect its environment; if the environment exceeds the requirements for normal operation, it will issue corresponding alarm messages.

[0098] Alarms can be categorized based on their impact on the system: events and faults. Events refer to critical events recorded during normal system operation and generally have no impact on the system; faults refer to alarms that may affect the normal operation of the system. In this embodiment, the alarm information mainly refers to alarm information caused by faults in the server cluster.

[0099] The reporting, recovery, and display of alarm information from servers in a server cluster all rely on the cluster's clock information. Timely synchronization of the cluster node time avoids false alarms and ensures the accuracy of alarm and statistical information display.

[0100] This embodiment monitors alarm information and the status of the server cluster after time synchronization is completed, so as to ensure that the server cluster can be dealt with in a timely manner when anomalies occur, thereby improving the reliability and performance of the server cluster.

[0101] In some embodiments, before S103 restores automatic time correction between the slave server and the master time server, the method further includes:

[0102] Obtain the time difference between the slave server and the master time server;

[0103] Determine if the time difference is greater than a preset time difference threshold;

[0104] If so, it is determined that there is a time discrepancy between the slave server and the master time server.

[0105] In a specific embodiment, the ntpq -p command is used to query the NTP servers in the network, and the relationship between the master time server and each slave server is displayed. Specifically, a list with detailed information is obtained. The offset in the table represents the time offset between the master time server and the slave servers, in milliseconds (ms). The closer the offset is to 0, the closer the time of the slave server is to the master time server.

[0106] In a specific embodiment, the offset value returned after the ntpq-p command is issued is observed. If the error exceeds 1000, that is, exceeds the preset time difference threshold, it is determined that there is a time discrepancy between the slave server and the master time server.

[0107] Even after manual adjustment by the user, the server cluster may still experience time discrepancies. In such cases, manual adjustment can be performed again. If the time difference is not significant, time correction can also be performed automatically through the NTP service.

[0108] This embodiment uses the offset value to obtain the time difference between the slave server and the master time server, and determines whether there is a time asynchrony based on the time difference threshold. Even if the time anomaly alarm fails to detect the time anomaly, it greatly improves the operability of operation and maintenance and the reliability of the system, making it convenient for operators to manage and maintain.

[0109] Please refer to Figure 2 , Figure 2 A flowchart of another time synchronization method provided in an embodiment of the present invention:

[0110] S201: Periodically check the status of the distributed storage cluster to confirm if there are any time synchronization issues;

[0111] S202: When a time discrepancy is detected among cluster nodes, set the maintenance mode icfs osd set noout, that is, set the osd to noout state. In this state, the osd will not be taken out of the cluster.

[0112] S203: Check and confirm the high availability of storage services;

[0113] S204: If the storage high availability service is not in a normal state, first repair the high availability service to restore it to a normal state;

[0114] S205: If the storage high availability service is in normal condition, adjust the heartbeat interval of the storage high availability service to 1 minute;

[0115] S206: Stop the NTP service on all nodes in the cluster using systemctl stop ntpd;

[0116] S207: Log in to the node with out-of-sync time via SSH and use the date -s command to adjust the time, such as date -s "2023-03-10 15:51:50". The time interval between each adjustment should not exceed 20 seconds. If the time error is large, multiple adjustments are required. Before each adjustment, ensure that the cluster state has been restored to normal.

[0117] S208: After the time of all nodes in the cluster is consistent, restart the NTP service on all nodes and confirm that the NTP status is normal;

[0118] S209: After the cluster status returns to normal, restore the storage high availability service heartbeat configuration and set the heartbeat interval to 6 seconds;

[0119] S210: Check the cluster status and storage high availability service status to ensure that they are all in normal condition;

[0120] S211: Cancel the maintenance module via the icfs osd unset noout command;

[0121] S212: Observe the cluster status continuously for 30 minutes. If it remains in a normal state, the cluster node time synchronization process ends.

[0122] Please refer to Figure 3 , Figure 3 This is a schematic diagram of a time synchronization device provided in an embodiment of the present invention. It is applied to a processor in a server cluster, which also includes a master time server and multiple slave servers connected to the master time server. The device includes:

[0123] The automatic time correction stop module 301 is used to stop the automatic time correction between the slave server and the master time server when a time discrepancy is detected between the slave server and the master time server.

[0124] The remote correction module 302 is used to adjust the time of the slave server based on user operation via a remote connection protocol, so as to synchronize the time of the slave server with that of the master time server.

[0125] The automatic time correction and recovery module 303 is used to restore the automatic time correction between the slave server and the master time server after the slave server has synchronized its time with the master time server.

[0126] In some embodiments, it also includes:

[0127] The first time difference acquisition module is used to obtain the time difference between the slave server and the master time server;

[0128] The first time difference judgment module is used to determine whether the time difference is greater than the preset time difference threshold.

[0129] The first-time asynchronous determination module is used to determine that there is a time discrepancy between the slave server and the master time server when the time difference is greater than a preset time difference threshold.

[0130] In some embodiments, it also includes:

[0131] The maintenance status setting module is used to set the storage disks in the server cluster to maintenance status;

[0132] Also includes:

[0133] The maintenance status cancellation module is used to cancel the maintenance status set for storage disks in a server cluster.

[0134] In some embodiments, it also includes:

[0135] The heartbeat interval adjustment module is used to adjust the heartbeat interval between the slave server and the master time server from the first heartbeat interval to a preset second heartbeat interval, wherein the duration of the first heartbeat interval is shorter than the duration of the second heartbeat interval.

[0136] Also includes:

[0137] The heartbeat interval recovery module is used to adjust the heartbeat interval between the slave server sending heartbeats to the master time server from the second heartbeat interval to the first heartbeat interval.

[0138] In some embodiments, it also includes:

[0139] The storage high availability detection module is used to determine whether the storage high availability service of the slave server is functioning properly;

[0140] The storage high availability normal module is used to stop the automatic time correction between the slave server and the master time server when the storage high availability service of the slave server is functioning normally.

[0141] The storage high availability repair module is used to repair the storage high availability service of the slave server when the service is malfunctioning.

[0142] In some embodiments, it also includes:

[0143] The alarm detection module is used to determine whether no alarm information has appeared in the server cluster within a preset verification time.

[0144] The cluster normality determination module is used to determine that the server cluster is in a normal state when no alarm information appears within a preset verification period.

[0145] In some embodiments, it also includes:

[0146] The second time difference acquisition module is used to acquire the time difference between the slave server and the master time server.

[0147] The second time difference judgment module is used to determine whether the time difference is greater than the preset time difference threshold.

[0148] The second time asynchrony determination module is used to determine that there is a time asynchrony between the slave server and the master time server when the time difference is greater than a preset time difference threshold.

[0149] For a description of the time synchronization device provided by the present invention, please refer to the above embodiments; the present invention will not be described in detail here.

[0150] Please refer to Figure 4 , Figure 4 A schematic diagram of a server cluster structure provided in an embodiment of the present invention includes a master time server and multiple slave servers connected to the master time server, and further includes:

[0151] Memory 401 is used to store computer programs;

[0152] Processor 402 is used to implement the time synchronization method described above when executing a computer program.

[0153] The processor 402 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 402 may be implemented using at least one hardware form selected from DSP (Digital Signal Processor), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 402 may also include a main processor and a coprocessor. The main processor, also known as the central processing unit, is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 402 may integrate a GPU (graphics processing unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 402 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0154] The memory 401 may include one or more computer-readable storage media, which may be non-transitory. The memory 401 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 401 is used to store at least the following computer program, which, after being loaded and executed by the processor 402, is capable of implementing the relevant steps of the metadata management method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 401 may also include an operating system and data, and the storage method may be temporary or permanent storage. The operating system may include Windows, Unix, Linux, etc. The data may include, but is not limited to, data related to the metadata management method.

[0155] In some embodiments, the metadata caching device may further include a display screen, an input / output interface, a communication interface, a power supply, and a communication bus.

[0156] It will be understood by those skilled in the art that Figure 4 The structure shown does not constitute a limitation on the metadata caching device and may include more or fewer components than illustrated.

[0157] For an introduction to the server cluster provided by this invention, please refer to the above embodiments; the invention itself will not be described in detail here.

[0158] Please refer to Figure 5 , Figure 5 This is a schematic diagram of a computer-readable storage medium provided in an embodiment of the present invention. The target computer-readable storage medium 501 stores a computer program 502. When the target computer program 502 is executed by a processor, it implements the steps of the time synchronization method described above.

[0159] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium 501. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the related technology, 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 executes all or part of the steps of the methods described in the various embodiments of this application. Specifically, the computer-readable storage medium 501 can include, but is not limited to, any type of disk, including floppy disks, optical disks, and portable hard drives, or any type of media or device suitable for storing instructions or data, etc., and this application does not make any special limitations here.

[0160] For a description of the computer-readable storage medium provided by the present invention, please refer to the above embodiments; the present invention will not be described in detail here.

[0161] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0162] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0163] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

Claims

1. A time synchronization method, characterized in that, Applied to a server cluster, the server cluster including a master time server and multiple slave servers connected to the master time server, the method includes: When a time discrepancy is detected between the slave server and the master time server, the automatic time correction between the slave server and the master time server is stopped. The time of the slave server is adjusted based on user operation via a remote connection protocol to synchronize the time of the slave server with that of the master time server; Once the slave server synchronizes its time with the master time server, the automatic time correction between the slave server and the master time server is restored. Before detecting a time discrepancy between the slave server and the master time server, the method further includes: Obtain the time difference between the slave server and the master time server; Determine whether the time difference is greater than a preset time difference threshold; If so, it is determined that there is a time discrepancy between the slave server and the master time server; After detecting a time discrepancy between the slave server and the master time server, the method further includes: Set the storage disks in the server cluster to maintenance mode; After the slave server synchronizes its time with the master time server, the following is also included: Cancel the maintenance status set for the storage disks in the server cluster.

2. The time synchronization method as described in claim 1, characterized in that, After detecting a time discrepancy between the slave server and the master time server, the process further includes: The heartbeat interval for sending heartbeats from the server to the master time server is adjusted from the first heartbeat interval to a preset second heartbeat interval, wherein the duration of the first heartbeat interval is less than the duration of the second heartbeat interval; After the slave server synchronizes its time with the master time server, the following is also included: The heartbeat interval for sending heartbeats from the slave server to the master time server is adjusted from the second heartbeat interval to the first heartbeat interval.

3. The time synchronization method as described in claim 1, characterized in that, Before stopping the time correction between the slave server and the master time server, the method further includes: Determine whether the storage high availability service of the slave server is functioning normally; If so, proceed to the step of stopping the time correction between the slave server and the master time server; If not, then the storage high availability service of the slave server is repaired.

4. The time synchronization method as described in claim 1, characterized in that, After restoring automatic time correction between the slave server and the master time server, the process further includes: Determine whether no alarm information has appeared in the server cluster within the preset verification time; If so, the server cluster is determined to be in a normal state.

5. The time synchronization method according to any one of claims 1 to 4, characterized in that, Before restoring automatic time correction between the slave server and the master time server, the method further includes: Obtain the time difference between the slave server and the master time server; Determine whether the time difference is greater than a preset time difference threshold; If so, it is determined that there is a time discrepancy between the slave server and the master time server.

6. A time synchronization device, characterized in that, The device comprises a processor used in a server cluster, the server cluster further comprising a master time server and multiple slave servers connected to the master time server, and the processor being used in a server cluster. The automatic time correction stop module is used to stop the automatic time correction between the slave server and the master time server when a time discrepancy is detected between the slave server and the master time server. The remote correction module is used to adjust the time of the slave server based on user operation via a remote connection protocol, so as to synchronize the time of the slave server with that of the master time server; An automatic time correction and recovery module is used to restore the automatic time correction between the slave server and the master time server after the slave server has synchronized its time with the master time server. The device further includes: The first time difference acquisition module is used to acquire the time difference between the slave server and the master time server; The first time difference determination module is used to determine whether the time difference is greater than a preset time difference threshold. The first-time asynchronous determination module is used to determine that there is a time asynchrony between the slave server and the master time server when the time difference is greater than a preset time difference threshold. The maintenance status setting module is used to set the storage disks in the server cluster to maintenance status after detecting that there is a time discrepancy between the slave server and the master time server. The maintenance status cancellation module is used to cancel the maintenance status set for the storage disks in the server cluster after the slave server synchronizes its time with the master time server.

7. A server cluster, characterized in that, It includes a master time server and multiple slave servers connected to the master time server, and also includes: Memory, used to store computer programs; A processor, configured to implement the time synchronization method as described in any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the time synchronization method as described in any one of claims 1 to 5.