Search

CN-122018637-A - Time synchronization method, device, equipment and computer readable storage medium

CN122018637ACN 122018637 ACN122018637 ACN 122018637ACN-122018637-A

Abstract

The invention discloses a time synchronization method, a device, equipment and a computer readable storage medium, which are applied to the technical field of computers and comprise the steps of acquiring standard time from a network time protocol server when a baseboard management controller is normally connected with the network time protocol server, acquiring the standard time from a database server when the baseboard management controller is not normally connected with the network time protocol server, wherein the database server is an intermediate scheduling and storage node for centrally storing time synchronization related data of the baseboard management controller, and updating the local time of the baseboard management controller according to the acquired standard time. The invention breaks through the mode that the traditional BMC only connects with the NTP server in a single way, designs the database server as a core scheduling node, realizes double links with the NTP direct connection synchronization as a main and the database scheduling and the network BMC node indirect synchronization as an auxiliary, and reduces the synchronization failure probability caused by the single NTP link fault from the structure.

Inventors

  • ZHANG LUYING

Assignees

  • 浪潮计算机科技有限公司

Dates

Publication Date
20260512
Application Date
20260129

Claims (10)

  1. 1. A method of time synchronization, comprising: When the baseboard management controller is normally connected with the network time protocol server, standard time is acquired from the network time protocol server; When the baseboard management controller is not normally connected with the network time protocol server, standard time is acquired from a database server, wherein the database server is an intermediate scheduling and storage node for centrally storing time synchronization related data of the baseboard management controller; and updating the local time of the baseboard management controller according to the acquired standard time.
  2. 2. The time synchronization method of claim 1, wherein when the baseboard management controller is not normally connected to the network time protocol server, obtaining the standard time from the database server comprises: when the baseboard management controller is not normally connected with the network time protocol server, a query request is initiated to the database server by utilizing the baseboard management controller, and baseboard management controller equipment records with the connected state flag bit of the network time protocol server being 1 in a database are screened out, wherein the database is a database deployed in the database server; Determining a target baseboard management controller device record according to the baseboard management controller time recorded in the baseboard management controller device record and the network time protocol server acquisition time; and extracting a network time protocol server acquisition time from the target baseboard management controller device record as the target time.
  3. 3. The time synchronization method of claim 2, wherein determining a target baseboard management controller device record based on the baseboard management controller time and the network time protocol server acquisition time recorded in the baseboard management controller device record, comprises: Acquiring the baseboard management controller time and the network time protocol server acquisition time from the baseboard management controller equipment record; And recording the time of the baseboard management controller and the acquisition time of the network time protocol server as the target baseboard management controller equipment record.
  4. 4. The time synchronization method according to claim 2, wherein extracting a network time protocol server acquisition time from the target baseboard management controller device record as the target time comprises: if the target baseboard management controller equipment records are a plurality of records, selecting one record with the latest recording time from the plurality of target baseboard management controller equipment records; And extracting the network time protocol server acquisition time from the latest record as the target time.
  5. 5. The time synchronization method according to claim 2, wherein the content recorded in the baseboard management controller device record includes: The method comprises the steps of obtaining time by a network time protocol server, obtaining an internet protocol address of a baseboard management controller, a media access control address of the baseboard management controller, time of the baseboard management controller and a flag bit of whether the network time protocol server can be correctly connected; And taking the Internet protocol address of the baseboard management controller and the media access control address of the baseboard management controller as unique identifiers of single records in the database.
  6. 6. The time synchronization method according to any one of claims 1 to 5, further comprising: If the connection state flag bit of the network time protocol server is not queried in the database deployed in the database server, and the time of the baseboard management controller is consistent with the acquisition time of the network time protocol server, the network time protocol server is utilized to return prompt information of failure in time acquisition to the baseboard management controller.
  7. 7. The time synchronization method according to claim 1, wherein the flag bit assignment rule for whether the network time protocol server can be properly connected, comprises: when network time protocol server information is configured in a system, if a network time protocol server fails or the network time protocol server configuration information is updated to a non-configuration state, a flag bit of whether the network time protocol server can be correctly connected is assigned to 0; When the network time protocol server information is configured in the system, if the network time protocol server address is updated again and synchronous update of the network time protocol server record in the database is completed, or the network time protocol server can normally communicate, the flag bit of whether the network time protocol server can be correctly connected is assigned to be 1.
  8. 8. A time synchronization device, comprising: the first acquisition module is used for acquiring standard time from the network time protocol server when the baseboard management controller is normally connected with the network time protocol server; The second acquisition module is used for acquiring standard time from a database server when the baseboard management controller is not normally connected with the network time protocol server, wherein the database server is an intermediate scheduling and storage node for centrally storing time synchronization related data of the baseboard management controller; And the time synchronization module is used for updating the local time of the baseboard management controller according to the acquired standard time.
  9. 9. A time synchronization apparatus, comprising: A memory for storing a computer program; processor for implementing the time synchronization method according to any of claims 1 to 7 when executing said computer program.
  10. 10. A computer readable storage medium having stored therein computer executable instructions which when loaded and executed by a processor implement the time synchronization method of any of claims 1 to 7.

Description

Time synchronization method, device, equipment and computer readable storage medium Technical Field The present invention relates to the field of computer technologies, and in particular, to a time synchronization method, apparatus, device, and computer readable storage medium. Background The baseboard management controller (Baseboard management controller, BMC) needs to rely on external time sources to complete time synchronization because of no independent time sources and time keeping capability. Currently, the BMC mainly implements this synchronization process through a network time protocol (Network Time Protocol, NTP) server. However, when the NTP server network is not enabled or a connection is not established, the BMC can only synchronize time once through the BIOS (Basic Input Output System ) during the system startup phase, and if the operating system is not restarted under the scenario, the BMC cannot acquire any external time update. The synchronization method has obvious limitation, when NTP synchronization fails, BMC lacks an effective time update mechanism and cannot guarantee the continuous accuracy of self time, so that optimization of the time synchronization technology of BMC is needed to improve the reliability of time synchronization. Disclosure of Invention Accordingly, the present invention is directed to a time synchronization method, apparatus, device and computer readable storage medium, which solve the problem that the BMC lacks an effective time update mechanism when NTP synchronization fails in the prior art. In order to solve the technical problems, the present invention provides a time synchronization method, including: When the baseboard management controller is normally connected with the network time protocol server, standard time is acquired from the network time protocol server; When the baseboard management controller is not normally connected with the network time protocol server, standard time is acquired from a database server, wherein the database server is an intermediate scheduling and storage node for centrally storing time synchronization related data of the baseboard management controller; and updating the local time of the baseboard management controller according to the acquired standard time. In one aspect, when the baseboard management controller is not normally connected to the network time protocol server, the standard time is obtained from the database server, including: when the baseboard management controller is not normally connected with the network time protocol server, a query request is initiated to the database server by utilizing the baseboard management controller, and baseboard management controller equipment records with the connected state flag bit of the network time protocol server being 1 in a database are screened out, wherein the database is a database deployed in the database server; Determining a target baseboard management controller device record according to the baseboard management controller time recorded in the baseboard management controller device record and the network time protocol server acquisition time; and extracting a network time protocol server acquisition time from the target baseboard management controller device record as the target time. In one aspect, determining a target baseboard management controller device record according to baseboard management controller time and network time protocol server acquisition time recorded in the baseboard management controller device record includes: Acquiring the baseboard management controller time and the network time protocol server acquisition time from the baseboard management controller equipment record; And recording the time of the baseboard management controller and the acquisition time of the network time protocol server as the target baseboard management controller equipment record. In one aspect, extracting a network time protocol server acquisition time from the target baseboard management controller device record as the target time includes: if the target baseboard management controller equipment records are a plurality of records, selecting one record with the latest recording time from the plurality of target baseboard management controller equipment records; And extracting the network time protocol server acquisition time from the latest record as the target time. In one aspect, the baseboard management controller device records content recorded in the device, including: The method comprises the steps of obtaining time by a network time protocol server, obtaining an internet protocol address of a baseboard management controller, a media access control address of the baseboard management controller, time of the baseboard management controller and a flag bit of whether the network time protocol server can be correctly connected; And taking the Internet protocol address of the baseboard management controller and the media access control address of the baseboard ma