CN116318504A - Clock synchronization method, device, equipment and storage medium - Google Patents

Clock synchronization method, device, equipment and storage medium Download PDF

Info

Publication number
CN116318504A
CN116318504A CN202310096365.8A CN202310096365A CN116318504A CN 116318504 A CN116318504 A CN 116318504A CN 202310096365 A CN202310096365 A CN 202310096365A CN 116318504 A CN116318504 A CN 116318504A
Authority
CN
China
Prior art keywords
clock
server
servers
information
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310096365.8A
Other languages
Chinese (zh)
Inventor
王旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Financial Technology Co Ltd
Original Assignee
Bank of China Financial Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Financial Technology Co Ltd filed Critical Bank of China Financial Technology Co Ltd
Priority to CN202310096365.8A priority Critical patent/CN116318504A/en
Publication of CN116318504A publication Critical patent/CN116318504A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0676Mutual
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The invention provides a clock synchronization method, which comprises the following steps: obtaining clock difference of at least one target product needing to modify clock information, wherein the clock difference is obtained according to target clock information corresponding to the target product and current first clock information of the clock synchronization server; and accessing the first servers corresponding to the target products one by one, and modifying the clock of the first servers according to the second clock information of the clock synchronization server and the clock difference when the first servers are accessed.

Description

Clock synchronization method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computers, and in particular, to a clock synchronization method, apparatus, device, and storage medium.
Background
When in actual test, a plurality of test environments are established, each test environment can set different test dates according to test requirements, each test environment can contain a plurality of mutually independent products, all products in the same test environment need to keep clock synchronization, and each product also contains servers with different numbers, so that all servers in the same test environment need to keep the same clock. However, in the daily operation and maintenance operations such as restarting, upgrading and environment switching of the server, the clock can generate deviation, so that the clock is not synchronous with the clocks of other servers, and the normal operation of partial functions is affected.
Therefore, how to keep clocks synchronous for all servers in the same test environment under test environments with different test dates becomes a problem to be solved.
Disclosure of Invention
The invention provides a clock synchronization method, device, equipment and storage medium, which are used for solving the defects that clocks are deviated in daily operation and maintenance operations such as restarting, upgrading and environment switching of a server in the prior art, so that the clocks are not synchronous with clocks of other servers, and the normal operation of partial functions is affected, and realizing that all servers in the same test environment are kept in clock synchronization under test environments with different test dates.
The invention provides a clock synchronization method, which is applied to a clock synchronization server in a clock synchronization system, wherein the clock synchronization system further comprises at least one test environment, each test environment comprises at least one product, each product comprises a first server, and the first server is connected with the clock synchronization server, and the method comprises the following steps:
obtaining clock difference of at least one target product needing to modify clock information, wherein the clock difference is obtained according to target clock information corresponding to the target product and current first clock information of the clock synchronization server;
and accessing the first servers corresponding to the target products one by one, and modifying the clock of the first servers according to the second clock information of the clock synchronization server and the clock difference when the first servers are accessed.
According to the clock synchronization method provided by the invention, the clock difference of at least one target product needing to modify clock information is obtained, and the clock synchronization method comprises the following steps:
under the condition that a request for modifying the clock information of the test environment is received, determining that a product in the test environment corresponding to the request is a target product, and determining target clock information corresponding to the target product according to the request;
and determining a difference value between the target clock information and the first clock information to obtain a clock difference.
According to the clock synchronization method provided by the invention, after the clock difference of at least one target product needing to modify clock information is obtained, the clock synchronization method comprises the following steps:
updating a first relation table according to the clock difference;
the first relation table is used for representing the association relation between the identification information of the test environment and the clock difference.
According to the clock synchronization method provided by the invention, the clock difference of at least one target product needing to modify clock information is obtained, and the clock synchronization method comprises the following steps:
under the condition that a target product with a changed testing environment is detected, determining a target testing environment after the target product is changed;
and acquiring the clock difference of the target product according to the first relation table and the identification information of the target test environment.
According to the clock synchronization method provided by the invention, after the clock difference of at least one target product needing to modify clock information is obtained, the clock synchronization method comprises the following steps:
updating a second relation table according to the identification information of the target test environment and the identification information of the target product;
the second relation table is used for representing the association relation between the identification information and the server corresponding to the product, and the identification information comprises the identification information of the test environment, the identification information of the product and the association relation between the servers.
According to the clock synchronization method provided by the invention, the product further comprises at least one second server, the second server of the product is connected with the first server of the product, and the method further comprises:
accessing the second servers associated with the first servers one by one, restarting the second servers, so that the second servers acquire clock information with clock modification from the first servers to perform clock synchronization.
According to the clock synchronization method provided by the invention, the method further comprises the following steps:
acquiring clock differences corresponding to the first servers in the clock synchronization system according to the first relation table and the second relation table;
obtaining standard correction clock information corresponding to the first server according to the current third clock information of the clock synchronization server and the clock difference corresponding to the first server;
and carrying out clock monitoring on the first server according to the standard correction clock information and the current clock information of the first server.
The invention also provides a clock synchronization device, comprising:
the clock synchronization server comprises an acquisition module, a clock synchronization module and a clock synchronization module, wherein the acquisition module is used for acquiring the clock difference of at least one target product needing to modify clock information, and the clock difference is obtained according to the target clock information corresponding to the target product and the current first clock information of the clock synchronization server;
and the modifying module is used for accessing the first servers corresponding to the target products one by one, and carrying out clock modification on the first servers according to the second clock information of the clock synchronization server and the clock difference when the first servers are accessed.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the clock synchronization method as described in any of the above when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a clock synchronization method as described in any of the above.
The invention also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of a clock synchronization method as described in any one of the above.
The clock synchronization method, the clock synchronization device, the clock synchronization equipment and the storage medium provided by the invention are characterized in that clock differences of at least one target product needing to modify clock information are obtained according to the target clock information corresponding to the target product and the current first clock information of a clock synchronization server; the first servers corresponding to the products are accessed one by one, clock modification is carried out on the first servers according to second clock information and clock differences of the clock synchronization servers when the first servers are accessed, so that all servers in the same test environment under test environments with different test dates are met through the clock synchronization servers, operation and maintenance requirements of clock synchronization are maintained, and the clock synchronization servers further utilize the clock differences to realize clock management of a plurality of test environments by configuring clock sources of the test environments on clocks of the clock synchronization servers.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a clock synchronization system according to the present invention;
FIG. 2 is a flow chart of a clock synchronization method provided by the invention;
FIG. 3 is a flow chart of a clock synchronization method in a scenario where clock information of a test environment provided by the present invention needs to be modified;
FIG. 4 is a schematic flow chart of a clock synchronization method in a product switching test environment scenario provided by the invention;
FIG. 5 is a flowchart of a clock synchronization method in a clock scenario of a timing monitor server provided by the present invention;
FIG. 6 is a schematic diagram of a clock synchronization device according to the present invention;
fig. 7 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the invention, are within the scope of the invention in accordance with embodiments of the present invention.
It should be noted that, the clock synchronization method provided by the invention is applied to the clock synchronization server in the clock synchronization system, and in the embodiment of the invention, the clock synchronization server is used for meeting the operation and maintenance requirements of clock synchronization of all servers in the same test environment under the test environments with different test dates.
The clock synchronization server refers to a server provided with a clock synchronization tool, and the server sends out an instruction to initiate clock changing operation to a designated server.
Further, the clock synchronization system further includes at least one test environment, each test environment further includes at least one product, where the product may be a server, or may be other electronic devices, and NTP (Network Time Protocol ) service is installed and started in the server of each product in the embodiment of the present invention.
In the embodiment of the invention, under the condition that only one Server is included in a product, the Server is configured as a Server side, the NTP type of the Server is identified as '1' (namely, the Server is identified as a first Server), under the condition that one Server is not only included in the product, one Server in the product is configured as a Server side, the NTP type of the Server side Server is identified as '1' (namely, the Server is identified as the first Server), the other servers in the product are configured as Client sides, the NTP type of the Client side Server is identified as '0' (namely, the Server is identified as a second Server), an upper clock source points to the first Server, and a time synchronization command (ntpdate command) is added in a startup script of the second Server.
Referring to fig. 1, in one example, a clock synchronization system includes at least one test environment 102, each test environment 102 includes at least one product 1002, each product 1002 includes at least one first server 10021 and at least one second server 10022, the first server 10021 is connected to the clock synchronization server 101, and the second server 10022 is connected to the first server 10021.
Further, in the embodiment of the present invention, a clock is set in the clock synchronization server 101 for each test environment, so that a clock server manages a plurality of first servers 10021 to dynamically manage the server clocks.
Fig. 2 is a schematic flow chart of a clock synchronization method according to the present invention, as shown in fig. 1, the clock synchronization method according to the present invention includes: step 210 and step 220.
Step 210, obtaining clock differences of at least one target product needing to modify clock information, wherein the clock differences are obtained according to target clock information corresponding to the target product and current first clock information of the clock synchronization server;
the target clock information may be clock information specified by a user, or may be clock information determined according to a test requirement or an application requirement.
The clock difference represents the difference between the target clock information of the target product and the current first clock information of the clock synchronization server, and in this embodiment, a plurality of clock sources are configured according to the clock information of the clock synchronization server by using the clock difference, so as to realize clock management of multiple sets of test environments.
It should be noted that, the execution body of the embodiment of the present invention may be a clock synchronization server or a clock synchronization program or tool running on the clock synchronization server.
Optionally, a clock synchronization program or tool is deployed on the clock synchronization server, and the user can initiate a clock modification operation on the specified product through an instruction.
Optionally, the clock synchronization server obtains the target product needing to modify the clock information and the target clock information corresponding to the target product from the front end through the webpage interactive interface.
Step 220, accessing the first servers corresponding to the target products one by one, and modifying the clock of the first servers according to the second clock information of the clock synchronization server and the clock difference when accessing the first servers;
in the embodiment of the invention, the IP addresses of the first servers (namely, the servers with NTP type identifiers of '1') associated with each target product are accessed one by one, the second clock information of the synchronous servers when the IP addresses of the current first servers are accessed remotely is obtained, then the second clock information and clock differences are summed to obtain modified clock information, after the modified clock information is determined, the IP addresses of the current first servers are accessed remotely, and the clock information of the current first servers is modified into the modified clock information according to the modified clock information.
Further, in this embodiment, in order to avoid missing clock modification, an IP address list is configured, where IP addresses of all first servers of a target product that need to modify clock information are recorded in the IP address list, and after all IP addresses of the first servers in the IP address list have performed the above step of clock modification, access is terminated.
According to the clock synchronization method provided by the invention, clock differences of at least one target product needing to modify clock information are obtained, the first servers corresponding to the target products are accessed one by one, clock modification is carried out on the first servers according to the second clock information and the clock differences of the clock synchronization servers when the first servers are accessed, so that all servers in the same test environment can be met under test environments with different test dates through the clock synchronization servers, operation and maintenance requirements of clock synchronization are kept, and the clock synchronization server also utilizes the clock differences to realize clock management of a plurality of test environments by configuring clock sources of the test environments on clocks of the clock synchronization servers.
In some embodiments, referring to fig. 1, in the case that more than one server is included in the product, the clock synchronization method provided by the present invention further includes:
accessing the second servers associated with the first servers one by one, restarting the second servers, so that the second servers acquire clock information with clock modification from the first servers to perform clock synchronization.
In the embodiment of the invention, the IP addresses of the second servers (namely, the servers with NTP type marks of 0') associated with each first server for clock modification are accessed one by one, and the second server is restarted remotely.
In this embodiment, in the case that more than one server is included in the product, by dividing the plurality of servers of the product into a first server directly connected to the clock synchronization server and a plurality of second servers connected to the first server, and adding a time synchronization command (ntpdate command) in a startup script of the second server, the time synchronization server can restart the second server after remotely modifying the first server, so that the second server can automatically perform clock synchronization through the time synchronization command (ntpdate command).
In some embodiments, the obtaining the clock difference of at least one target product requiring modification of the clock information includes:
under the condition that a request for modifying the clock information of the test environment is received, determining that a product in the test environment corresponding to the request is a target product, and determining target clock information corresponding to the target product according to the request;
and determining a difference value between the target clock information and the first clock information to obtain a clock difference.
In this embodiment, in a scenario where clock information of a test environment needs to be modified, a product in the test environment corresponding to a request for modifying clock information of the test environment is taken as a target product, and clock information of a new test date specified in the request is taken as target clock information DATA1 corresponding to the target product.
The first clock information DATA2 of the clock synchronization server when receiving the request is obtained, and the clock difference DATA 3=data 1-DATA2 is obtained according to the difference value between the target clock information DATA1 and the first clock information DATA2.
In some embodiments, after the obtaining the clock difference of the at least one target product requiring the modification of the clock information, the obtaining includes:
updating a first relation table according to the clock difference;
the first relation table is used for representing the association relation between the identification information of the test environment and the clock difference.
In this embodiment, the identification information of the test environment may be an environment name.
It will be appreciated that, according to the first relationship table, a clock difference corresponding to at least one target product for which clock information needs to be modified may be determined.
The data structure of the first relationship table is shown in Table 1:
table 1: first relation table
Figure BDA0004071789210000091
In this embodiment, after obtaining the clock difference of the target product of the test environment that needs to modify the clock information, the clock difference associated with the environmental name is updated in the first relationship table according to the environmental name of the test environment.
In some embodiments, the obtaining the clock difference of at least one target product requiring modification of the clock information includes:
under the condition that a target product with a changed testing environment is detected, determining a target testing environment after the target product is changed;
and acquiring the clock difference of the target product according to the first relation table and the identification information of the target test environment.
In this embodiment, in a scenario where clock information of a product needs to be modified due to switching of a test environment by the product, a clock difference of a target test environment where a target product with a changed test environment is located is used as a clock difference of the target product.
Specifically, the first relation table is accessed according to the environment name of the target test environment, and the clock difference associated with the environment name of the target test environment recorded in the first relation table is obtained.
In some embodiments, after the obtaining the clock difference of the at least one target product requiring the modification of the clock information, the obtaining includes:
updating a second relation table according to the identification information of the target test environment and the identification information of the target product;
the second relation table is used for representing the association relation between the identification information and the server corresponding to the product, and the identification information comprises the identification information of the test environment, the identification information of the product and the association relation between the servers.
In this embodiment, the identification information of the product may be a product name, or may be an environment name of a test environment corresponding to the product.
It can be appreciated that, according to the second relationship table, the association relationship between each type of server and the test environment and the product can be determined.
The data structure of the second relationship table is shown in Table 2:
table 2: second relation table
Figure BDA0004071789210000101
In this embodiment, the second relationship table is accessed according to the product name and the source environment name (i.e., the environment name of the test environment before modification) of the target product, the IP of the server to be modified is determined, and the environment name associated with the IP of the server is further referred to as the target environment name in the second relationship table.
In some embodiments, after restarting the second server to enable the second server to acquire clock information after clock modification from the first server for clock synchronization, the method includes:
acquiring clock differences corresponding to the first servers in the clock synchronization system according to the first relation table and the second relation table;
obtaining standard correction clock information corresponding to the first server according to the current third clock information of the clock synchronization server and the clock difference corresponding to the first server;
and carrying out clock monitoring on the first server according to the standard correction clock information and the current clock information of the first server.
In this embodiment, a first relationship table is accessed to obtain clock differences of each test environment, then a second relationship table is accessed to obtain servers (first servers) with NTP type identifiers of '1' in the clock synchronization system, and clock differences DATA3 corresponding to the test environments are obtained according to environment names associated with the servers with NTP type identifiers of '1' in the second relationship table.
After the clock difference DATA3 of each first server is obtained, the standard correction clock information DATA 5=data3+data4 is determined according to the current third clock information DATA4 of the clock synchronization server and the clock difference of the first server.
And comparing the deviation value between the current clock information of the first server and the standard correction clock information, and if the deviation value is larger than a preset threshold value, indicating that the clock information of the first server is inaccurate, modifying the clock information of the first server into the standard correction clock information.
Further, after the clock information of the first server is modified into the standard modified clock information, the second server associated with the first server is restarted remotely, and because a time synchronization command (ntpdate command) is added in the startup script of the second server, when the second server is restarted remotely, the second server calls the time synchronization command (ntpdate command) when the startup script is operated, so that the clock information with the modified clock is automatically acquired from the first server associated with the second server to perform clock synchronization.
In this embodiment, when there are too many servers needing to modify the clock, a time difference is generated between the clock information of the modified servers and the clock information expected by the modified servers, so as to ensure clock synchronization of all servers in the same test environment, improve test performance, monitor the clocks of the first servers at regular time, that is, determine the standard correction clock information of each first server at regular time, and ensure clock synchronization of all servers in the same test environment by comparing the deviation value between the current clock information of the first server and the standard correction clock information.
Fig. 3 is a flow chart of a clock synchronization method in a situation that clock information of a test environment needs to be modified, and as shown in fig. 3, another embodiment of the present invention includes:
step 310, modifying the test date;
according to the new testing date of the appointed environment name, the clock synchronizes the current date of the server, the clock difference between the testing date and the current date of the server is obtained, and the testing environment date list (namely the first relation table) is updated.
Step 320, obtaining the product IP;
a product list (i.e., a second relationship table) is accessed and the IP of all servers involved in the change is obtained based on the environment name.
Step 330, modifying NTP SERVER end server clock;
the first server corresponding to the IP address with NTP type=1 is accessed one by one, the date difference obtained in the environment date list is tested according to the current date of the clock server, the date needing to be modified is obtained, and the clock of the first server is remotely modified.
Step 340, restarting the NTP CLIENT end server;
and accessing the second servers corresponding to the IP addresses with NTP type=0 one by one, restarting the second servers, and when restarting, the second servers automatically acquire new dates from the first server side to perform clock synchronization by calling an ntpdate command through a startup script.
Fig. 4 is a flow chart of a clock synchronization method in a product switching test environment scenario provided by the present invention, and as shown in fig. 4, another embodiment of the present invention includes:
step 410, obtaining a test date;
according to the target environment name, a test environment date list (namely a first relation table) is accessed, and a date difference of the new environment is obtained.
Step 420, obtaining the product IP and modifying the product list;
and accessing a product list (namely a second relation table) according to the switched product name and the source environment name, obtaining the IP of the server to be modified, updating the information in the product list, and modifying the recorded environment name as the target environment name.
Step 430, modifying NTP SERVER end server clock;
the first server corresponding to the IP address with NTP type=1 is accessed one by one, the date difference obtained in the environment date list is tested according to the current date of the clock server, the date needing to be modified is obtained, and the clock of the first server is remotely modified.
Step 440, restarting NTP CLIENT end server;
and accessing the second servers corresponding to the IP addresses with NTP type=0 one by one, restarting the second servers, and when restarting, the second servers automatically acquire new dates from the first server side to perform clock synchronization by calling an ntpdate command through a startup script.
Fig. 5 is a flow chart of a clock synchronization method in a clock scenario of a timing monitor server according to the present invention, and as shown in fig. 5, another embodiment of the present invention includes:
step 510, obtaining all test dates;
and accessing a test environment date list to obtain a date difference value of each environment.
Step 520, obtaining NTP SERVER IP of each product;
and accessing the product list, obtaining a first server corresponding to the IP address with the NTP type=1, and obtaining a date difference value corresponding to the environment according to the environment name.
In step 530, the NTP SERVER end server clock is monitored and modified.
According to the current date of the clock server, the date difference obtained in the test environment date list is used for obtaining the target test environment date, the IP addresses of NTP type=1 are accessed one by one to obtain the current date of the IP, and when the date difference (the target test environment date-the current date) is larger than a preset threshold value, the clock value of the IP is modified to be the target test environment date. The other NTP CLIENT end servers of the product will automatically update the clock with NTPD.
Fig. 6 is a schematic structural diagram of a clock synchronization device provided by the present invention, as shown in fig. 6, the clock synchronization device provided by the present invention includes:
an obtaining module 610, configured to obtain a clock difference of at least one target product that needs to modify clock information, where the clock difference is obtained according to target clock information corresponding to the target product and current first clock information of the clock synchronization server;
and a modifying module 620, configured to access the first servers corresponding to the target products one by one, and modify the clock of the first servers according to the second clock information of the clock synchronization server and the clock difference when accessing the first servers.
Further, the obtaining module 610 is further configured to determine, when a request for modifying clock information of a test environment is received, that a product in the test environment corresponding to the request is a target product, and determine, according to the request, target clock information corresponding to the target product; and determining a difference value between the target clock information and the first clock information to obtain a clock difference.
Further, the obtaining module 610 is further configured to update the first relationship table according to the clock difference; the first relation table is used for representing the association relation between the identification information of the test environment and the clock difference.
Further, the obtaining module 610 is further configured to determine, when a target product with a changed testing environment is detected, a target testing environment after the target product is changed; and acquiring the clock difference of the target product according to the first relation table and the identification information of the target test environment.
Further, the obtaining module 610 is further configured to update a second relationship table according to the identification information of the target test environment and the identification information of the target product; the second relation table is used for representing the association relation between the identification information and the server corresponding to the product, and the identification information comprises the identification information of the test environment, the identification information of the product and the association relation between the servers.
Further, the modification module 620 is further configured to access the second servers associated with each of the first servers one by one, and restart the second servers, so that the second servers acquire clock information after clock modification from the first servers to perform clock synchronization.
Further, the clock synchronization device further includes:
the monitoring module is used for acquiring clock differences corresponding to the first servers in the clock synchronization system according to the first relation table and the second relation table; obtaining standard correction clock information corresponding to the first server according to the current third clock information of the clock synchronization server and the clock difference corresponding to the first server; and carrying out clock monitoring on the first server according to the standard correction clock information and the current clock information of the first server.
It should be noted that, the clock synchronization device provided by the embodiment of the present invention can implement all the method steps implemented by the clock synchronization method embodiment, and can achieve the same technical effects, which are not described herein again.
The clock synchronization device provided by the invention obtains the clock difference of at least one target product needing to modify the clock information, wherein the clock difference is obtained according to the target clock information corresponding to the target product and the current second clock information of the clock synchronization server; accessing the first servers corresponding to the products one by one, and carrying out clock modification on the first servers according to third clock information and clock differences of the clock synchronization servers when accessing the first servers; therefore, under the test environments with different test dates, all servers in the same test environment can keep the operation and maintenance requirements of clock synchronization through the clock synchronization server, and the clock synchronization server can realize clock management of a plurality of test environments by configuring clock sources of the test environments on the clock of the clock synchronization server by utilizing clock difference.
Fig. 7 illustrates a physical schematic diagram of an electronic device, as shown in fig. 7, which may include: processor 710, communication interface (Communications Interface) 720, memory 730, and communication bus 740, wherein processor 710, communication interface 720, memory 730 communicate with each other via communication bus 740. Processor 710 may invoke logic instructions in memory 730 to perform a clock synchronization method comprising: obtaining clock difference of at least one target product needing to modify clock information, wherein the clock difference is obtained according to target clock information corresponding to the target product and current first clock information of the clock synchronization server; and accessing the first servers corresponding to the target products one by one, and modifying the clock of the first servers according to the second clock information of the clock synchronization server and the clock difference when the first servers are accessed.
Further, the logic instructions in the memory 730 described above may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand alone product. In light of this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program, the computer program being storable on a non-transitory computer readable storage medium, the computer program, when executed by a processor, being capable of performing the clock synchronization method provided by the methods described above, the method comprising: obtaining clock difference of at least one target product needing to modify clock information, wherein the clock difference is obtained according to target clock information corresponding to the target product and current first clock information of the clock synchronization server; and accessing the first servers corresponding to the target products one by one, and modifying the clock of the first servers according to the second clock information of the clock synchronization server and the clock difference when the first servers are accessed.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform a clock synchronization method provided by the above methods, the method comprising: obtaining clock difference of at least one target product needing to modify clock information, wherein the clock difference is obtained according to target clock information corresponding to the target product and current first clock information of the clock synchronization server; and accessing the first servers corresponding to the target products one by one, and modifying the clock of the first servers according to the second clock information of the clock synchronization server and the clock difference when the first servers are accessed.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. In light of this understanding, the foregoing technical solutions may be embodied essentially or in part in the form of a software product, which may be stored in a computer-readable storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the various embodiments or portions of the methods described herein.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A clock synchronization method for a clock synchronization server in a clock synchronization system, wherein the clock synchronization system further comprises at least one test environment, each test environment comprising at least one product, each product comprising a first server, the first server being connected to the clock synchronization server, the method comprising:
obtaining clock difference of at least one target product needing to modify clock information, wherein the clock difference is obtained according to target clock information corresponding to the target product and current first clock information of the clock synchronization server;
and accessing the first servers corresponding to the target products one by one, and modifying the clock of the first servers according to the second clock information of the clock synchronization server and the clock difference when the first servers are accessed.
2. The method of claim 1, wherein the obtaining the clock difference of the at least one target product requiring modification of the clock information comprises:
under the condition that a request for modifying the clock information of the test environment is received, determining that a product in the test environment corresponding to the request is a target product, and determining target clock information corresponding to the target product according to the request;
and determining a difference value between the target clock information and the first clock information to obtain a clock difference.
3. The clock synchronization method according to claim 2, wherein after obtaining the clock difference of at least one target product requiring modification of the clock information, comprising:
updating a first relation table according to the clock difference;
the first relation table is used for representing the association relation between the identification information of the test environment and the clock difference.
4. The method of claim 1, wherein the obtaining the clock difference of the at least one target product requiring modification of the clock information comprises:
under the condition that a target product with a changed testing environment is detected, determining a target testing environment after the target product is changed;
and acquiring the clock difference of the target product according to the first relation table and the identification information of the target test environment.
5. The method of claim 4, wherein the obtaining the clock difference of the at least one target product requiring clock information modification comprises:
updating a second relation table according to the identification information of the target test environment and the identification information of the target product;
the second relation table is used for representing the association relation between the identification information and the server corresponding to the product, and the identification information comprises the identification information of the test environment, the identification information of the product and the association relation between the servers.
6. The clock synchronization method of claim 1, wherein the product further comprises at least one second server, the second server of the product being connected to the first server of the product, the method further comprising:
accessing the second servers associated with the first servers one by one, restarting the second servers, so that the second servers acquire clock information with clock modification from the first servers to perform clock synchronization.
7. The clock synchronization method according to any one of claims 1 to 6, characterized in that the method further comprises:
acquiring clock differences corresponding to the first servers in the clock synchronization system according to the first relation table and the second relation table;
obtaining standard correction clock information corresponding to the first server according to the current third clock information of the clock synchronization server and the clock difference corresponding to the first server;
and carrying out clock monitoring on the first server according to the standard correction clock information and the current clock information of the first server.
8. A clock synchronization device, comprising:
the clock synchronization server comprises an acquisition module, a clock synchronization module and a clock synchronization module, wherein the acquisition module is used for acquiring the clock difference of at least one target product needing to modify clock information, and the clock difference is obtained according to the target clock information corresponding to the target product and the current first clock information of the clock synchronization server;
and the modifying module is used for accessing the first servers corresponding to the target products one by one, and carrying out clock modification on the first servers according to the second clock information of the clock synchronization server and the clock difference when the first servers are accessed.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the clock synchronization method of any one of claims 1 to 7 when the program is executed by the processor.
10. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the clock synchronization method according to any one of claims 1 to 7.
CN202310096365.8A 2023-02-07 2023-02-07 Clock synchronization method, device, equipment and storage medium Pending CN116318504A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310096365.8A CN116318504A (en) 2023-02-07 2023-02-07 Clock synchronization method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310096365.8A CN116318504A (en) 2023-02-07 2023-02-07 Clock synchronization method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116318504A true CN116318504A (en) 2023-06-23

Family

ID=86795070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310096365.8A Pending CN116318504A (en) 2023-02-07 2023-02-07 Clock synchronization method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116318504A (en)

Similar Documents

Publication Publication Date Title
CN106302596B (en) A kind of method and apparatus of service discovery
US8719386B2 (en) System and method for providing configuration synchronicity
CN109542529B (en) Function name-based point burying method and device, computer equipment and storage medium
CN107193607B (en) Method and apparatus for updating code file, storage medium, processor, and terminal
US20180077232A1 (en) Method and Device for Establishing Communication Connection
EP3544330B1 (en) System and method for validating correctness of changes to network device configurations
CN111090452A (en) Service environment switching method and computer-readable storage medium
CN112506702A (en) Data center disaster tolerance method, device, equipment and storage medium
CN111352995A (en) Server service method, system, device and storage medium based on database Neo4j
CN112527397A (en) Method and device for modifying basic input output system options and computer equipment
CN104954482A (en) Configuration management system and method
CN109274734B (en) Service process calling method and device based on Internet of things cloud platform
CN112769517B (en) T-BOX time synchronization method and device
CN116450353A (en) Processor core matching method and device, electronic equipment and storage medium
CN116318504A (en) Clock synchronization method, device, equipment and storage medium
CN114610446B (en) Method, device and system for automatically injecting probe
CN113655846B (en) OpenPOWER server time synchronization method and system
CN110691263A (en) Method, medium, electronic device and system for synchronizing local time and server time
CN112804313B (en) Data synchronization method, device, equipment and medium based on cross-domain edge node
CN114650211A (en) Fault repairing method, device, electronic equipment and computer readable storage medium
CN114285779A (en) Method, device and system for processing test request
CN113297263A (en) Data processing method, device, system, electronic equipment and storage medium
CN108491448B (en) Data pushing method and device
CN111090648A (en) Relational database data synchronization conflict resolution method
CN115858101B (en) Method and device for isolating container resource view and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination