CN106487852B - Method, device, terminal equipment and system for realizing client file synchronization - Google Patents

Method, device, terminal equipment and system for realizing client file synchronization Download PDF

Info

Publication number
CN106487852B
CN106487852B CN201510548972.9A CN201510548972A CN106487852B CN 106487852 B CN106487852 B CN 106487852B CN 201510548972 A CN201510548972 A CN 201510548972A CN 106487852 B CN106487852 B CN 106487852B
Authority
CN
China
Prior art keywords
file
client
information
changed
files
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.)
Active
Application number
CN201510548972.9A
Other languages
Chinese (zh)
Other versions
CN106487852A (en
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510548972.9A priority Critical patent/CN106487852B/en
Publication of CN106487852A publication Critical patent/CN106487852A/en
Application granted granted Critical
Publication of CN106487852B publication Critical patent/CN106487852B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application provides a method for realizing client file synchronization through a server, which comprises the steps of firstly receiving use file information sent by a client and acquiring file change information of a file generation system; then, searching out a client using the changed file according to the file change information and the file using information; and finally, sending file change push information to the client using the changed file. Compared with the existing method for synchronizing all files, the method collects the used file information of each client, generates the file change push information in real time and selectively pushes the file change push information to the corresponding client when the file production system changes the files, then the client searches the local files with the same name needing to be updated according to the file change push information and updates the local files, and the local files are selectively synchronized in real time, so that the synchronization speed is improved, the system pressure is reduced, the resource waste is reduced, and the real-time update of the files is ensured.

Description

Method, device, terminal equipment and system for realizing client file synchronization
Technical Field
The application relates to the technical field of electronics, in particular to a method for achieving client file synchronization through a server, a device for achieving client file synchronization through the server, a terminal device for achieving client file synchronization through the server, a method for achieving client file synchronization, a device for achieving client file synchronization, a terminal device for achieving client file synchronization and a file synchronization system.
Background
Applications have a need to use files produced by a file generation system (TMS) at run-time, which use these files by reading local disks. When a file generated by the file generation system changes, the changed file needs to be synchronized to a terminal where an application using the file is located. In general, files on a file generation system are all small files of the kilobit (Kb) level, the total amount of which is about one hundred thousand, and about several ten thousand changes are made each day; the files generated by the file generation system used by each application are several to hundreds of different files.
Because each terminal and the file generation system are configured with the synchronization rule, the synchronization rule is abnormal and complex and is difficult to implement, and the prior art uses the same synchronization rule to periodically and completely synchronize all the files generated by the file generation system to each terminal, so that the problems exist: firstly, because the file generating system generates a large amount of files and each terminal uses a small amount of files, the method for synchronizing all the files to each terminal each time is not flexible enough, which causes the problems of low synchronizing speed, large system pressure and resource waste; secondly, due to frequent file change and random occurrence, the problem of untimely file synchronization can be caused by adopting a periodic synchronization scheme; thirdly, with the increase of the number of applications and the number of terminals, the number of required file synchronization servers is also increased continuously, which causes the problems of high cost and large maintenance workload; and fourthly, monitoring of synchronization results is lacked, and in an actual production environment, the network, the synchronization server and the target terminal can be unavailable at any time, so that the latest files cannot be synchronized, and the business is influenced when files of individual terminals cannot be synchronized in time because a business party cannot acquire the file synchronization results. Fifthly, when the service capacity of the application cannot be met, capacity expansion is needed, files needing to be used need to be manually synchronized for a capacity expansion terminal, capacity expansion cost is increased, and if manual synchronization is forgotten during capacity expansion, the service is affected, so that the problems of high cost, high risk and low efficiency exist due to manual participation.
Disclosure of Invention
The application provides a method for realizing client file synchronization through a server, a device for realizing client file synchronization through the server, a terminal device for realizing client file synchronization through the server, a method for realizing client file synchronization, a device for realizing client file synchronization, a terminal device for realizing client file synchronization and a file synchronization system.
The technical scheme adopted by the application is as follows:
the application provides a method for realizing client file synchronization through a server, which comprises the following steps:
receiving use file information sent by a client, wherein the use file information comprises a file name of a use file used by an application, and acquiring file change information of a file generation system, the file change information comprises a file name of a changed file and a check code of the changed file, the changed file refers to the changed file, the check code is a unique identification code of the file, and the check code of the changed file is changed after the file is modified;
searching out a client using the changed file according to the file change information and the file using information;
and sending file change push information to the client using the changed file, wherein the file change push information comprises file names of all used files of the client and the latest check codes of all the used files, and the latest check codes of the used files are the check codes of the changed files.
Optionally, the obtaining of the file change information of the file generation system includes:
and receiving file change information which is sent by a file generation system in real time when the file is changed.
Optionally, the step of retrieving the client using the changed file according to the file change information and the file using information includes:
summarizing the use file information received from each client to generate a file-client corresponding relation list;
and inquiring the client using the changed file in the file-client corresponding relation list according to the file name of the changed file in the file change information.
Optionally, the file change push information further includes: change record ID, and/or timestamp pushed.
Optionally, the file change push information is sent through a message push service.
Optionally, the method for implementing file synchronization of the client through the server further includes:
receiving heartbeat information sent by a client, judging whether the client returns a file updating report within preset time or not according to the heartbeat information, and if not, sending out reminding information.
The present application further provides a device for implementing file synchronization at a client through a server, including:
the file generation system comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for receiving use file information sent by a client, the use file information comprises a file name of a use file used by an application and file change information of a file generation system, the file change information comprises a file name of a changed file and a check code of the changed file, the changed file is a changed file, the check code is a unique identification code of the file, and the check code of the changed file is changed after the file is modified;
a retrieval unit configured to retrieve a client using the changed file based on the file change information and the usage file information;
and the pushing unit is used for sending file change pushing information to the client using the changed files, wherein the file change pushing information comprises the file names and the latest check codes of all the files used by the client.
Optionally, the obtaining unit includes a receiving subunit, configured to receive file change information sent by the file generating system in real time when a file is changed.
Optionally, the retrieving unit includes:
the list generating subunit is used for summarizing the use file information received from each client to generate a file-client corresponding relation list;
and the query subunit is used for querying the client using the changed file in the file-client corresponding relationship list according to the file name of the changed file in the file change information.
The application also provides a method for synchronizing the files of the client, which comprises the following steps:
collecting use file information used by an application, and sending the use file information to a server, wherein the use file information comprises a file name of a use file used by the application;
receiving file change push information sent by the server, wherein the file change push information comprises file names of all used files of a client and latest check codes of all the used files, the latest check codes of the used files are the check codes of the changed files, the changed files refer to changed files generated by a file generation system, the check codes are unique identification codes of the files, and the check codes of the changed files are changed after the files are modified;
searching a local file needing to be updated according to the file change push information;
and reading a changed file corresponding to the local file needing to be updated through a file reading service, and writing the changed file to a local disk to cover the local file.
Optionally, the finding out the local file to be updated according to the file change push information specifically includes:
analyzing the file change pushing information to obtain file names of all used files of the client and the latest check codes of all the used files;
searching local files with the same name according to the file names of the used files;
and sequentially comparing whether the check code of the local file is consistent with the latest check code of the used file, wherein the inconsistent local file is the local file needing to be updated.
Optionally, the method for synchronizing the client file further includes:
if reading of the changed file by the file reading service fails, retrying to read for a predetermined number of times;
and when the retry times exceed the preset times, sending out a reminding message of file updating failure.
The present application further provides a device for synchronizing a client file, including:
the server comprises a collecting unit, a sending unit and a receiving unit, wherein the collecting unit is used for collecting use file information used by an application and sending the use file information to a server, and the use file information comprises a file name of a use file used by the application;
the system comprises a pushed information receiving unit, a pushed information receiving unit and a file change pushing unit, wherein the pushed information receiving unit is used for receiving file change pushed information sent by the server, the file change pushed information comprises file names of all used files of a client and latest check codes of all the used files, the latest check codes of the used files are the check codes of the changed files, the changed files refer to changed files generated by a file generation system, the check codes are unique identification codes of the files, and the check codes of the changed files are changed after the files are modified;
the local file searching unit is used for searching a local file needing to be updated according to the file change pushing information;
and the updating unit is used for reading a changed file corresponding to the local file needing to be updated through a file reading service and writing the changed file to a local disk to cover the local file.
Optionally, the local file searching unit includes:
the analysis subunit is used for analyzing the file change pushing information to obtain file names of all the used files of the client and the latest check codes of all the used files;
the local file searching subunit is used for searching local files with the same name according to the file names of the used files; and the comparison subunit is used for sequentially comparing whether the check code of the local file is consistent with the latest check code of the used file, wherein the inconsistent local file is the local file needing to be updated.
Optionally, the device for synchronizing the client file further includes:
a retry unit configured to retry reading a predetermined number of times if reading of the changed file by the file reading service fails;
and the reminding unit is used for sending out reminding information of file updating failure when the retry times exceed the preset times.
The present application further provides a terminal device for implementing client file synchronization through a server, including:
a central processing unit;
an input/output unit;
a memory; the storage is stored with a computer program of the method for realizing the client file synchronization through the server side; and after start-up can be operated according to the method described above.
The present application further provides a client file synchronization terminal device, including:
a central processing unit;
an input/output unit;
a memory; the memory is stored with a computer program of the client file synchronization method provided by the application; and after start-up can be operated according to the method described above.
The application also provides a file synchronization system, which comprises a server and a client, wherein the server uses the device for realizing the file synchronization of the client through the server, and the client uses the device for realizing the file synchronization of the client.
Compared with the prior art, the method has the following advantages:
the method for achieving client file synchronization through the server side includes the steps that firstly, using file information sent by a client side is received, the using file information comprises a file name of a using file used by an application, file change information of a file generation system is obtained, the file change information comprises the file name of a changed file and a check code of the changed file, the changed file refers to the changed file, the check code is a unique identification code of the file, and the check code of the changed file changes after the file is modified; then, searching out a client using the changed file according to the file change information and the file using information; and finally, sending file change push information to the client side using the changed file, wherein the file change push information comprises file names of all the used files of the client side and the latest check codes of all the used files, and the latest check codes of the used files are the check codes of the changed files. Compared with the existing method for synchronizing all files, the method can generate the file change pushing information in real time according to the file change information sent by the file generation system by collecting the using file information of each client and selectively push the file change pushing information to the corresponding client when the file production system changes the files, and the client can find and update the local files with the same name needing to be updated according to the file change pushing information after receiving the file change pushing information because the file change pushing information comprises the file name of the changed file and the check code of the changed file, so that the method can realize real-time and selective synchronization, thereby improving the synchronization speed, reducing the system pressure, reducing the resource waste, ensuring the real-time update of the files, and simultaneously reducing the number of required file synchronization servers due to the great reduction of the synchronization workload, the synchronization cost and the workload of maintenance are reduced.
The method for synchronizing the files of the client comprises the steps of firstly collecting information of using files used by an application, and sending the information of using files to a server, wherein the information of using files comprises file names of using files used by the application; then receiving file change push information sent by the server, wherein the file change push information comprises file names of all used files of the client and latest check codes of all the used files, the latest check codes of the used files are the check codes of the changed files, the changed files are changed files generated by a file generation system, the check codes are unique identification codes of the files, and the check codes of the changed files are changed after the files are modified; searching a local file needing to be updated according to the file change push information; and finally, reading a changed file corresponding to the local file to be updated through a file reading service, and writing the changed file to a local disk to cover the local file. According to the method, the used file information used by each application is collected and reported to the server, so that the file change push information selectively sent by the server in real time can be received, the local file needing to be updated is found out according to the file change push information, then the file reading service is called to read the changed file and write the changed file into the local disk, the files are updated in real time, pertinence and selectivity, all files do not need to be synchronized any more, the synchronous workload is greatly reduced, the synchronization speed is improved, the system pressure is reduced, the resource waste is reduced, the real-time update of the files is guaranteed, when the terminal needs to expand the capacity, the missing files can be automatically judged by adopting the method, the files are automatically synchronized, manual participation is not needed, the capacity expansion cost and the capacity expansion risk are reduced, and the capacity expansion efficiency is improved.
The method for achieving the client file synchronization through the server takes the server as an execution main body, the method for achieving the client file synchronization takes the client as the execution main body, the two methods are combined for use, a set of complete file synchronization method can be formed, then the step of file updating result reporting is added, the synchronization result can be monitored, the server and the client can be guaranteed to know the file synchronization result, and the influence on the service due to file synchronization abnormity is avoided.
Drawings
FIG. 1 is a flowchart of an embodiment of a method for implementing client file synchronization by a server according to the present application;
FIG. 2 is a schematic diagram of an embodiment of an apparatus for implementing client file synchronization by a server according to the present application;
FIG. 3 is a flowchart of an embodiment of a method for client file synchronization provided by the present application;
fig. 4 is a schematic diagram of an embodiment of an apparatus for client file synchronization provided in the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The application provides a method for realizing client file synchronization through a server, a device for realizing client file synchronization through the server, a terminal device for realizing client file synchronization through the server, a method for realizing client file synchronization, a device for realizing client file synchronization, a terminal device for realizing client file synchronization and a file synchronization system, and the following describes embodiments of the application in detail with reference to the attached drawings in sequence.
Please refer to fig. 1, which is a flowchart illustrating an embodiment of a method for implementing file synchronization of a client through a server according to the present application, where an execution subject of the embodiment of the method is the server, and the method for implementing file synchronization of the client through the server includes the following steps:
s101, receiving using file information sent by a client, wherein the using file information comprises a file name of a using file used by an application, and acquiring file change information of a file generation system, the file change information comprises a file name of a changed file and a check code of the changed file, the changed file is a changed file, the check code is a unique identification code of the file, and the check code of the changed file is changed after the file is modified.
In this step, a server receives information of a used file sent by a client and obtains file change information of a file generation system, where the information of the used file includes a file name of the used file used by an application, the application is an application program, at least one application program is provided at a lower level of the client, the application sends the information of the used file to the client or the client collects information of the used file used by the lower level application, the client summarizes the file names of all files used by the lower level application to form information of the used file and sends the information of the used file to the server, and the server receives the information of the used file sent by the client, so that the file name of the used file corresponding to each application of the client can be known.
The method for realizing client file synchronization through the server is applied between a file generation system and a file using system, and is used for synchronizing files generated by the file generation system to the file using system, the file using system comprises an application of files generated by using the file generation system, the file generation system frequently generates new files or changes existing files, therefore, the new files and the changed files need to be synchronized to a server of the file using system for the file using system to use, and the new files and the changed files are also one of file changes, so for the convenience of description, in the embodiment, the new files and the changed files are collectively called changed files, in the embodiment of the method, the client is arranged on the server of the file using system, therefore, the change file may be synchronized to the client.
The file generation system generates file change information after generating a change file, wherein the file change information at least comprises a file name of the change file and a check code of the change file, the check code is a unique identification code of the file, and the check code of the file also changes after the file is modified; the check code may be any one of the following: a HASH value, a SHA value, an MD5 value, an MD2 value, an MD3 value, an MD4 value; in a preferred embodiment of the present application, the check code uses MD5 value. Besides the check code, there are also identification codes capable of identifying uniqueness of the file in various forms, which are not described herein again, and which can also be used for the purpose of completing the present application, and are also within the scope of the present application.
After the file generation system generates the file change information, the file change information can be sent to the server, and the server can obtain the file change information of the file generation system.
In a preferred embodiment of the present application, since the file change in the file generation system is more and frequent, in order to implement real-time file synchronization to avoid the influence of the file change on the application service and avoid network pressure caused by periodic batch synchronization, the file change information is sent in real time, and therefore, the obtaining of the file change information of the file generation system includes: and receiving file change information which is sent by a file generation system in real time when the file is changed.
The above method of transmitting the file change information in real time is a preferred embodiment of the present application, and is not limited to the scope of the present application, and a method of transmitting the file change information periodically by time or transmitting the file change information in a number and a batch manner is also within the scope of the present application.
S102, searching out the client using the changed file according to the file change information and the using file information.
In view of the fact that the application uses part of the files generated by the file generation system and the files used by different applications are not completely consistent in general, the traditional method of synchronizing all the files to all the clients inevitably wastes system resources and increases network pressure, in the embodiment of the method, the changed files are selectively synchronized to the clients using the changed files, and the clients not using the changed files do not need to push. Therefore, when the file generation system generates the changed file, only the client using the changed file needs to be inquired, and then the changed file is synchronized to the client.
Through the step S101, the user file information corresponding to each client is already known by receiving the user file information sent by the client, and at the same time, the file change information of the file generation system is also obtained to know which files are changed; in this case, the client using the changed file can be searched based on the file change information and the use file information.
In a specific embodiment provided by the present application, the step of retrieving the client using the changed file according to the file change information and the file using information specifically includes:
summarizing the use file information received from each client to generate a file-client corresponding relation list;
and inquiring the client using the changed file in the file-client corresponding relation list according to the file name of the changed file in the file change information.
S103, sending file change push information to the client side using the changed file, wherein the file change push information comprises file names of all used files of the client side and latest check codes of all the used files, and the latest check codes of the used files are the check codes of the changed file.
Through step S102, a client using the changed file is retrieved according to the file change information and the file using information, and then file change push information is sent to the client using the changed file, where the file change push information includes file names of all files used by the client and the latest check codes of all files used, and the latest check codes of the files used for the changed file are the check codes of the changed file.
In an embodiment provided by the present application, the file change push information is sent through a message push service, the message push service is a general service, and can ensure that a message is pushed to a target machine within a second level, and with the help of the message push service, the file change information can be ensured to arrive at the client quickly, so that the file synchronization speed can be completed within the second level, and the problem of slow file synchronization speed of periodic file synchronization is solved. In a preferred embodiment provided by the present application, the message push service may specifically be a distributed configuration management service.
In order to monitor the synchronization result, the file change push information may further include a change record ID or a pushed timestamp, or may also include the change record ID and the pushed timestamp, so that the client may generate a file update report according to the change record ID or the pushed timestamp and feed back the file update report to the server after receiving the file change push information, and the server may determine whether all the file change push information has been processed, whether the corresponding file synchronization is completed, whether the file change push information is correct, and the like according to the change record ID or the pushed timestamp in the file update report.
After receiving the file change push information, the client can read the changed file from the file generation system or the storage server according to the file name and the check code of the changed file in the file change push information, so as to realize the synchronization of the changed file.
It should be noted that, in this step, the filenames of all the files used by the client and the latest check codes of all the files used by the client are all sent to the client, which has the beneficial effect that the client can determine whether the file change push information is correct or whether a missing packet exists by checking whether the filenames of all the files used are consistent with the local file of the client, so as to avoid the occurrence of abnormal client file and further service error caused by file synchronization according to the wrong or incomplete file change push information.
So far, the method flow for implementing client file synchronization through the server provided by the present application is completed through steps S101 to S103, it should be noted that in the embodiment of the method, the server is taken as an execution main body, and the step of finally reading the changed file and completing synchronization is not executed by the server.
Considering that when the server sends the file change push information, a certain client does not receive the file change push information due to machine problems, network problems or other problems, or a certain client completes file synchronization, but file update reports cannot be fed back to the server due to machine problems, network problems or other problems, so that file synchronization cannot be completed in time or a file synchronization result cannot be monitored, in order to obtain connection conditions of the server and all clients, the clients need to periodically send heartbeat information to the server, the server receives heartbeat information sent by the client, determines the connection conditions of the clients according to the heartbeat information, and can determine connection faults between the server and the client when the client does not send the heartbeat information within a preset time, at the moment, the user can be informed to troubleshoot the fault reason and then troubleshoot the fault, and service loss caused by connection faults is avoided.
As mentioned above, in order to monitor the synchronization result, the client needs to generate a file update report and feed the file update report back to the server after completing file synchronization, and the server monitors the file synchronization result to complete a closed loop, so that in an embodiment provided in the present application, the method for implementing client file synchronization by the server further includes:
receiving a file updating report sent by the client;
and summarizing the file updating reports sent by the clients to generate an updating result report.
At this time, with the help of the heartbeat information, it can also be determined whether the file synchronization is completed within a predetermined time, so as to ensure real-time performance of the file synchronization, and the implementation manner may be: and the server receives heartbeat information sent by the client, judges whether the client returns a file updating report within a preset time according to the heartbeat information, and if not, sends out reminding information to inform a user of finding a reason and timely solves the problem. The real-time property, the monitorability, the stability and the safety of file synchronization are further ensured.
In the foregoing embodiment, a method for implementing client file synchronization through a server is provided, and correspondingly, the present application also provides a device for implementing client file synchronization through a server. Please refer to fig. 2, which is a schematic diagram illustrating an embodiment of an apparatus for implementing file synchronization of a client through a server according to the present disclosure. Since the apparatus embodiments are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for relevant points. The device embodiments described below are merely illustrative.
In an embodiment of an apparatus for implementing client file synchronization through a server, the apparatus for implementing client file synchronization through a server includes:
an obtaining unit 101, configured to receive usage file information sent by a client, where the usage file information includes a file name of a usage file used by an application, and obtain file change information of a file generation system, where the file change information includes a file name of a changed file and a check code of the changed file, the changed file is a changed file, the check code is a unique identifier of the file, and the check code changes after the file is modified;
a retrieving unit 102, configured to retrieve a client using the changed file according to the file change information and the used file information;
a pushing unit 103, configured to send file change pushing information to the client that uses the changed file, where the file change pushing information includes file names of all used files of the client and a latest check code of all the used files, and for a changed file, the latest check code of the used file is the check code of the changed file. In an embodiment provided by the present application, the obtaining unit 101 includes a receiving subunit, configured to receive file change information sent by a file generation system in real time when a file change occurs.
In one embodiment provided by the present application, the retrieving unit 102 includes:
the list generating subunit is used for summarizing the use file information received from each client to generate a file-client corresponding relation list;
and the query subunit is used for querying the client using the changed file in the file-client corresponding relationship list according to the file name of the changed file in the file change information.
In one embodiment provided herein, the check code includes at least one of: HASH values, SHA values, MD5 values, MD2 values, MD3 values, MD4 values.
In an embodiment provided by the present application, the file change push information further includes: change record ID, and/or timestamp pushed.
In an embodiment provided by the present application, the pushing unit 103 sends the file change pushing information through a message pushing service.
In one embodiment provided herein, the message push service refers to a distributed configuration management service.
In an embodiment provided by the present application, the apparatus for implementing client file synchronization by a server further includes: and the connection state judging unit is used for receiving the heartbeat information sent by the client and judging the connection state of the client according to the heartbeat information.
In an embodiment provided by the present application, the apparatus for implementing client file synchronization by a server further includes:
an update report receiving unit, configured to receive a file update report sent by the client;
and the update report summarizing unit is used for summarizing the file update reports sent by the clients and generating update result reports.
In an embodiment provided by the present application, the apparatus for implementing client file synchronization by a server further includes: and the update report judging unit is used for receiving heartbeat information sent by the client, judging whether the client returns a file update report within preset time according to the heartbeat information, and if not, sending out reminding information.
The foregoing provides an embodiment of an apparatus for implementing file synchronization at a client through a server.
Please refer to fig. 3, which is a flowchart illustrating an embodiment of a method for synchronizing a client file according to the present application, wherein the embodiment of the method corresponds to the embodiment of the method for synchronizing a client file through a server, an execution main body of the embodiment is a client, and the method for synchronizing a client file includes the following steps:
s201, collecting the information of the use files used by the application, and sending the information of the use files to the server, wherein the information of the use files comprises the file names of the use files used by the application.
In this step, the client collects information of the files used by the application, where the information of the files used by the application includes a file name of the files used by the application, the application is an application program, at least one application program is provided at a lower position of the client, and the information of the files used by the application collected by the client may be the information of the files used by the application sent to the client by the application or the information of the files used by the application collected by the client.
And after collecting the use file information of all the lower applications, the client collects the use file information and sends the use file information to the server, so that the server can retrieve the client using the changed file according to the file change information and the use file information.
S202, receiving file change push information sent by the server, wherein the file change push information comprises file names of all used files of the client and latest check codes of all the used files, the latest check codes of the used files are the check codes of the changed files, the changed files are changed files generated by a file generation system, the check codes are unique identification codes of the files, and the check codes of the changed files are changed after the files are modified.
Receiving file change push information sent by the server, wherein the file change push information comprises file names of all used files of the client and latest check codes of all the used files, the latest check codes of the used files are the check codes of the changed files, the changed files are changed files generated by a file generation system, the check codes are unique identification codes of the files, and the check codes of the changed files are changed after the files are modified; the check code may be any one of the following: a HASH value, a SHA value, an MD5 value, an MD2 value, an MD3 value, an MD4 value; in a preferred embodiment of the present application, the check code uses MD5 value. Besides the check code, there are also identification codes capable of identifying uniqueness of the file in various forms, which are not described herein again, and which can also be used for the purpose of completing the present application, and are also within the scope of the present application.
In order to monitor the synchronization result, the file change push information may further include a change record ID or a pushed timestamp, or may also include the change record ID and the pushed timestamp, so that the client may generate a file update report according to the change record ID or the pushed timestamp and feed back the file update report to the server after receiving the file change push information, and the server may determine whether all the file change push information has been processed, whether the corresponding file synchronization is completed, whether the file change push information is correct, and the like according to the change record ID or the pushed timestamp in the file update report.
S203, searching a local file needing to be updated according to the file change push information.
Through step S202, the file change push information sent by the server is received, and since the file change push information includes the file names of all the used files of the client and the latest check codes of all the used files, the specific implementation manner of this step may be: firstly, analyzing the file change pushing information to obtain the file names of all the used files of the client and the latest check codes of all the used files; then searching local files with the same name according to the file names of the used files; and sequentially comparing whether the check code of the local file is consistent with the latest check code of the used file, wherein the inconsistent local file is the local file needing to be updated.
And S204, reading a changed file corresponding to the local file needing to be updated through a file reading service, and writing the changed file to a local disk to cover the local file.
In step S203, the local file to be updated is found according to the file change push information, and then, the changed file corresponding to the local file to be updated is read through the file reading service and written to the local disk to cover the local file.
The reading of the modified file by the file reading service may be from a file generation system, or may be from a file storage server, which are all within the protection scope of the present application.
In a specific embodiment, a tool API (application programming interface) for reading files used by an application is provided for the client, the API first determines whether read changed files exist in a local disk, and if so, the read changed files are directly read; and if the changed file does not exist, reading the changed file through a file reading service, and then writing the changed file into the local disk. And after the file is read, recording the file name and the check code in the memory.
So far, the method flow of client file synchronization provided by the present application is completed through steps S201 to S204, it should be noted that the embodiment of the method is executed by taking a client as an execution subject and cooperating with the above-mentioned embodiment of the method for implementing client file synchronization through a server with a server as an execution subject, and the method for client file synchronization provided by the present application is a partial step in file synchronization executed by the client.
Considering that when the server sends the file change push information, a certain client does not receive the file change push information due to machine problems, network problems or other problems, or a certain client completes file synchronization, but file update reports cannot be fed back to the server due to machine problems, network problems or other problems, so that file synchronization cannot be completed in time or a file synchronization result cannot be monitored, in order to obtain connection conditions of the server and all clients, the clients need to periodically send heartbeat information to the server, the server receives heartbeat information sent by the client, determines the connection conditions of the clients according to the heartbeat information, and can determine connection faults between the server and the client when the client does not send the heartbeat information within a preset time, at the moment, the user can be informed to troubleshoot the fault reason and then troubleshoot the fault, and service loss caused by connection faults is avoided.
In order to monitor the synchronization result, the client needs to generate a file update report and feed the file update report back to the server after completing file synchronization, and the server monitors the file synchronization result to complete closed loop. The file update report includes: changing the record ID, changing the file name and updating result of the file; the change record ID is one of the constituent contents of the file change push information generated by the server.
In view of the situation that if reading of the modified file by the file reading service fails due to a machine failure, a network failure, or other failures, so as to cause untimely file synchronization, in an embodiment provided in the present application, the method for client file synchronization further includes:
if reading of the changed file by the file reading service fails, retrying to read for a predetermined number of times;
and when the retry times exceed the preset times, sending out a reminding message of file updating failure.
The foregoing provides an embodiment of a method for synchronizing a file at a client.
In the foregoing embodiment, a method for synchronizing a client file is provided, and correspondingly, the present application further provides a device for synchronizing a client file. Please refer to fig. 4, which is a schematic diagram illustrating an embodiment of a device for client file synchronization according to the present disclosure. Since the apparatus embodiments are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for relevant points. The device embodiments described below are merely illustrative.
In an embodiment of a device for synchronizing a client file, the device for synchronizing a client file includes:
a collecting unit 201, configured to collect usage file information used by an application, and send the usage file information to a server, where the usage file information includes a file name of a usage file used by the application;
a push information receiving unit 202, configured to receive file change push information sent by the server;
a local file searching unit 203, configured to search for a local file to be updated according to the file change push information;
an updating unit 204, configured to read, by a file reading service, a changed file corresponding to the local file to be updated, and write the changed file to a local disk to cover the local file.
In an embodiment provided by the present application, the local file searching unit 203 includes:
the analysis subunit is used for analyzing the file change pushing information to obtain file names of all the used files of the client and the latest check codes of all the used files;
the local file searching subunit is used for searching local files with the same name according to the file names of the used files;
and the comparison subunit is used for sequentially comparing whether the check code of the local file is consistent with the latest check code of the used file, wherein the inconsistent local file is the local file needing to be updated. In one embodiment provided herein, the check code includes at least one of: HASH values, SHA values, MD5 values, MD2 values, MD3 values, MD4 values.
In an embodiment provided by the present application, the apparatus for synchronizing a file at a client further includes: and the heartbeat information sending unit is used for sending heartbeat information to the server.
In an embodiment provided by the present application, the apparatus for synchronizing a file at a client further includes: and the update report sending unit is used for sending a file update report to the server.
In an embodiment provided by the present application, the apparatus for synchronizing a file at a client further includes:
a retry unit configured to retry reading a predetermined number of times if reading of the changed file by the file reading service fails;
and the reminding unit is used for sending out reminding information of file updating failure when the retry times exceed the preset times.
The foregoing is an embodiment of a device for synchronizing a client file according to the present application.
The present application further provides a terminal device for implementing file synchronization at a client through a server, as a server for file synchronization, including:
a central processing unit;
an input/output unit;
a memory; the storage is stored with a computer program of the method for realizing the client file synchronization through the server side; and after start-up can be operated according to the method described above.
Because the terminal device uses the method for implementing client file synchronization through the server, reference is made to the description of the embodiment of the method for implementing client file synchronization through the server for relevant points, and details are not repeated here.
The present application further provides a terminal device for synchronizing a file at a client, as a client for synchronizing a file, including:
a central processing unit;
an input/output unit;
a memory; the memory is stored with a computer program of the client file synchronization method provided by the application; and after start-up can be operated according to the method described above.
For the terminal device using the method for synchronizing client files, please refer to the description of the embodiment of the method for synchronizing client files, which is not repeated herein.
The application also provides a file synchronization system, which comprises a server and a client, wherein the server uses the device for realizing the file synchronization of the client through the server, and the client uses the device for realizing the file synchronization of the client.
The server of the system uses the device for realizing the client file synchronization through the server, and the client of the system uses the device for realizing the client file synchronization; for the related points, please refer to the above description of the embodiment of the apparatus for implementing client file synchronization by the server and the embodiment of the apparatus for implementing client file synchronization, which are not described herein again.
In a specific embodiment, the file synchronization system is a file synchronization system filesync, which mainly comprises two parts: a server (filesync-server), a client (filesync-client),
the server is used for collecting information of the client, overall control, monitoring the client and other functions, and mainly comprises the following units:
the device comprises an acquisition unit, a retrieval unit, a pushing unit, a connection condition judgment unit, an update report receiving unit, an update report summarizing unit and an update report judgment unit.
The client is deployed on an application using the filesync, is used for completing related work of filesyc, and mainly comprises the following units:
the device comprises a collection unit, a push information receiving unit, a local file searching unit, an updating unit, a heartbeat information sending unit, an updating report sending unit, a retry unit and a reminding unit.
The file synchronization system filesync runs as follows:
1. the client collects the information of the used files: the collecting unit of the client collects the information of the use files used by the application and sends the information of the use files to the acquiring unit of the server.
2. The server receives the information of the used file and obtains the file change information: and the acquisition unit of the server receives the information of the used files sent by the collection unit of the client and acquires the file change information sent by the file generation system.
3. The server side searches the client side needing synchronization: and the retrieval unit of the server side retrieves the client side using the changed file according to the file change information and the using file information.
4. The server side pushes the file change push information: and the pushing unit of the server side sends the file change pushing information to the client side using the change file.
5. The client receives file change push information: and a push information receiving unit of the client receives the file change push information sent by the server.
6. The client judges whether the file needs to be updated: and a local file searching unit of the client searches out the local file to be updated according to the file change pushing information.
7. Updating a client file: and after receiving the information of the local file to be updated, which is sent by the local file searching unit, the updating unit of the client reads the changed file through the file reading service and writes the changed file into the local disk.
8. The client sends an update report: and an update report sending unit of the client sends a file update report to the server.
9. And the server side monitors the updating result: an update report receiving unit of a server receives a file update report sent by the client; and then an update report summarizing unit of the server side summarizes the file update reports sent by the client sides to generate an update result report.
10. And (4) judging the update result abnormity: and an update report judgment unit of the server receives heartbeat information sent by the client, judges whether the client returns a file update report within a preset time according to the heartbeat information, and sends out reminding information if the client does not return the file update report within the preset time.
11. Retry and reminding of client updating failure: a retry unit of the client initiates retry reading for a preset number of times when the updating unit fails to read the changed file; and the reminding unit of the client sends out reminding information of file updating failure when the number of times of file updating failure read by the updating unit exceeds the preset number of times.
12. And (3) judging the connection state: the method comprises the steps that a heartbeat information sending unit of a client sends heartbeat information to a server, a connection condition judging unit of the server receives the heartbeat information sent by the heartbeat information sending unit of the client, and the connection condition of the client is judged according to the heartbeat information, and the step runs through the whole operation process. Although the present application has been described with reference to the preferred embodiments, it is not intended to limit the present application, and those skilled in the art can make variations and modifications without departing from the spirit and scope of the present application, therefore, the scope of the present application should be determined by the claims that follow.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
1. Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
2. As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.

Claims (18)

1. A method for realizing client file synchronization through a server is characterized by comprising the following steps:
receiving use file information sent by a client, wherein the use file information comprises a file name of a use file used by an application, and acquiring file change information of a file generation system, the file change information comprises a file name of a changed file and a check code of the changed file, the changed file refers to the changed file, the check code is a unique identification code of the file, and the check code of the changed file is changed after the file is modified;
searching out a client using the changed file according to the file change information and the file using information;
and sending file change push information to the client side using the changed file, wherein the file change push information comprises file names of all used files of the client side and the latest check codes of all the used files, the file names of all the used files of the client side are used for judging whether the file change push information is correct or whether a packet is missed, and the latest check codes of the used files are the check codes of the changed files.
2. The method for realizing client file synchronization through the server according to claim 1, wherein the obtaining of the file change information of the file generation system comprises:
and receiving file change information which is sent by a file generation system in real time when the file is changed.
3. The method of claim 1, wherein the step of retrieving the client using the changed file according to the file change information and the file using information comprises:
summarizing the use file information received from each client to generate a file-client corresponding relation list;
and inquiring the client using the changed file in the file-client corresponding relation list according to the file name of the changed file in the file change information.
4. The method for realizing client file synchronization through the server according to claim 1, wherein the file change push information further includes: change record ID, and/or timestamp pushed.
5. The method for client file synchronization through the server according to claim 1, wherein the file change push information is sent through a message push service.
6. The method for realizing client file synchronization through the server side according to claim 1, further comprising:
receiving heartbeat information sent by a client, judging whether the client returns a file updating report within preset time or not according to the heartbeat information, and if not, sending out reminding information.
7. An apparatus for implementing client file synchronization through a server, comprising:
the file generation system comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for receiving use file information sent by a client, the use file information comprises a file name of a use file used by an application and file change information of a file generation system, the file change information comprises a file name of a changed file and a check code of the changed file, the changed file is a changed file, the check code is a unique identification code of the file, and the check code of the changed file is changed after the file is modified;
a retrieval unit configured to retrieve a client using the changed file based on the file change information and the usage file information;
and the pushing unit is used for sending file change pushing information to the client using the changed files, wherein the file change pushing information comprises file names of all files used by the client and latest check codes of the file names, and the file names of all files used by the client are used for judging whether the file change pushing information is correct or not or whether a packet is missed or not.
8. The apparatus for implementing client file synchronization through a server according to claim 7, wherein the obtaining unit includes a receiving subunit, configured to receive file change information sent by the file generation system in real time when a file change occurs.
9. The apparatus for implementing client file synchronization through a server according to claim 7, wherein the retrieving unit includes:
the list generating subunit is used for summarizing the use file information received from each client to generate a file-client corresponding relation list;
and the query subunit is used for querying the client using the changed file in the file-client corresponding relationship list according to the file name of the changed file in the file change information.
10. A method for synchronizing files at a client, comprising:
collecting use file information used by an application, and sending the use file information to a server, wherein the use file information comprises a file name of a use file used by the application;
receiving file change push information sent by the server, wherein the file change push information comprises file names of all used files of a client and latest check codes of all the used files, the file names of all the used files of the client are used for judging whether the file change push information is correct or whether a packet is missed, for a changed file, the latest check code of the used file is the check code of the changed file, the changed file is a changed file generated by a file generation system, the check codes are unique identification codes of the file, and the check codes of the changed file are changed after the file is modified;
searching a local file needing to be updated according to the file change push information;
and reading a changed file corresponding to the local file needing to be updated through a file reading service, and writing the changed file to a local disk to cover the local file.
11. The method for client file synchronization according to claim 10, wherein the finding out the local file that needs to be updated according to the file change push information specifically includes:
analyzing the file change pushing information to obtain file names of all used files of the client and the latest check codes of all the used files;
searching local files with the same name according to the file names of the used files;
and sequentially comparing whether the check code of the local file is consistent with the latest check code of the used file, wherein the inconsistent local file is the local file needing to be updated.
12. The method for client file synchronization according to claim 10, further comprising:
if reading of the changed file by the file reading service fails, retrying to read for a predetermined number of times;
and when the retry times exceed the preset times, sending out a reminding message of file updating failure.
13. An apparatus for client file synchronization, comprising:
the server comprises a collecting unit, a sending unit and a receiving unit, wherein the collecting unit is used for collecting use file information used by an application and sending the use file information to a server, and the use file information comprises a file name of a use file used by the application;
the system comprises a pushed information receiving unit, a pushed information receiving unit and a file change pushing unit, wherein the pushed information receiving unit is used for receiving file change pushed information sent by the server, the file change pushed information comprises file names of all used files of a client and latest check codes of all the used files, the file names of all the used files of the client are used for judging whether the file change pushed information is correct or whether a packet is missed, for a changed file, the latest check code of the used file is the check code of the changed file, the changed file is a changed file generated by a file generation system, the check code is a unique identification code of the file, and the check code of the changed file is changed after the file is modified;
the local file searching unit is used for searching a local file needing to be updated according to the file change pushing information;
and the updating unit is used for reading a changed file corresponding to the local file needing to be updated through a file reading service and writing the changed file to a local disk to cover the local file.
14. The apparatus for client file synchronization according to claim 13, wherein the local file lookup unit comprises:
the analysis subunit is used for analyzing the file change pushing information to obtain file names of all the used files of the client and the latest check codes of all the used files;
the local file searching subunit is used for searching local files with the same name according to the file names of the used files; and the comparison subunit is used for sequentially comparing whether the check code of the local file is consistent with the latest check code of the used file, wherein the inconsistent local file is the local file needing to be updated.
15. The apparatus for client file synchronization according to claim 13, further comprising:
a retry unit configured to retry reading a predetermined number of times if reading of the changed file by the file reading service fails;
and the reminding unit is used for sending out reminding information of file updating failure when the retry times exceed the preset times.
16. A terminal device for realizing client file synchronization through a server side is characterized by comprising:
a central processing unit;
an input/output unit;
a memory; the memory stores a computer program of the method for realizing client file synchronization through the server side according to any one of claims 1 to 6; and after start-up can be operated according to the method described above.
17. A terminal device for client file synchronization, comprising:
a central processing unit;
an input/output unit;
a memory; a computer program of the method for client file synchronization according to any one of claims 10 to 12 is stored in the memory; and after start-up can be operated according to the method described above.
18. A file synchronization system, comprising a server and a client, wherein the server uses the apparatus for implementing client file synchronization through the server in claims 7 to 9, and the client uses the apparatus for client file synchronization in claims 13 to 15.
CN201510548972.9A 2015-08-31 2015-08-31 Method, device, terminal equipment and system for realizing client file synchronization Active CN106487852B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510548972.9A CN106487852B (en) 2015-08-31 2015-08-31 Method, device, terminal equipment and system for realizing client file synchronization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510548972.9A CN106487852B (en) 2015-08-31 2015-08-31 Method, device, terminal equipment and system for realizing client file synchronization

Publications (2)

Publication Number Publication Date
CN106487852A CN106487852A (en) 2017-03-08
CN106487852B true CN106487852B (en) 2020-02-18

Family

ID=58235434

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510548972.9A Active CN106487852B (en) 2015-08-31 2015-08-31 Method, device, terminal equipment and system for realizing client file synchronization

Country Status (1)

Country Link
CN (1) CN106487852B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110309203B (en) * 2019-07-02 2021-08-10 成都数之联科技有限公司 Interactive and user-defined data modeling system based on big data
CN111723062A (en) * 2020-06-28 2020-09-29 天津联想协同科技有限公司 File synchronization method, device and storage medium
CN112254284A (en) * 2020-09-02 2021-01-22 海信(山东)空调有限公司 Air conditioner and remote upgrading method thereof
CN112596956B (en) * 2020-12-28 2024-02-13 北京浪潮数据技术有限公司 File system management method, device and related components

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7139780B2 (en) * 2002-10-04 2006-11-21 Hong Fu Jin Precision Industry (Shenzhen) Co., Ltd. System and method for synchronizing files in multiple nodes
CN104283975A (en) * 2014-11-06 2015-01-14 福建合诚信息科技有限公司 File distribution method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103259672B (en) * 2012-02-17 2016-09-28 阿里巴巴集团控股有限公司 Method for upgrading software and system
CN103402194B (en) * 2013-08-02 2016-08-31 浙江每日互动网络科技股份有限公司 A kind of method recommending software when software upgrading and realize the system of the method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7139780B2 (en) * 2002-10-04 2006-11-21 Hong Fu Jin Precision Industry (Shenzhen) Co., Ltd. System and method for synchronizing files in multiple nodes
CN104283975A (en) * 2014-11-06 2015-01-14 福建合诚信息科技有限公司 File distribution method and device

Also Published As

Publication number Publication date
CN106487852A (en) 2017-03-08

Similar Documents

Publication Publication Date Title
CN110661659B (en) Alarm method, device and system and electronic equipment
CN109522287B (en) Monitoring method, system, equipment and medium for distributed file storage cluster
CN108241555B (en) Backup and recovery method and device of distributed database and server
CN107832196B (en) Monitoring device and monitoring method for abnormal content of real-time log
CN106487852B (en) Method, device, terminal equipment and system for realizing client file synchronization
CN110825420A (en) Configuration parameter updating method, device, equipment and storage medium for distributed cluster
CN105550229A (en) Method and device for repairing data of distributed storage system
CN105391772A (en) Service request processing method, log processing method and service request processing device
CN109522316A (en) Log processing method, device, equipment and storage medium
CN109039724B (en) Log uploading method and device
CN111061498A (en) Configuration information management system
CN109947730B (en) Metadata recovery method, device, distributed file system and readable storage medium
CN110858168B (en) Cluster node fault processing method and device and cluster node
CN105550230A (en) Method and device for detecting failure of node of distributed storage system
CN115314361B (en) Server cluster management method and related components thereof
CN111162938A (en) Data processing system and method
CN112202895B (en) Method and system for collecting monitoring index data, electronic equipment and storage medium
US11745036B2 (en) Fire protection system
CN110830281B (en) Hot standby method and system based on mesh network structure
CN107463484B (en) Method and system for collecting monitoring records
CN113419885A (en) Data integrity processing method and device and electronic equipment
CN114546276B (en) High-availability data storage read-write method, system, device and equipment
CN113609199B (en) Database system, server, and storage medium
CN112637293B (en) Data recovery system, method, device, electronic equipment and storage medium
CN117421337B (en) Data acquisition method, device, equipment and computer readable medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant