CN106603729A - Distributed-file-system multi-client synchronization method and system thereof - Google Patents
Distributed-file-system multi-client synchronization method and system thereof Download PDFInfo
- Publication number
- CN106603729A CN106603729A CN201710100064.2A CN201710100064A CN106603729A CN 106603729 A CN106603729 A CN 106603729A CN 201710100064 A CN201710100064 A CN 201710100064A CN 106603729 A CN106603729 A CN 106603729A
- Authority
- CN
- China
- Prior art keywords
- client
- permission
- write
- file
- clients
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/30—Authentication, i.e. establishing the identity or authorisation of security principals
- G06F21/44—Program or device authentication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本发明公开了一种分布式文件系统多客户端同步方法,包括:判断客户端的数量是否为1,若是,则给予上述客户端独占权限,若否,则按写权限的申请顺序,向相应的客户端分配上述写权限;具有上述写权限的客户端对文件完成写入,则更新相应的元数据;判断是否有其他具有读写权限的客户端操作上述文件,若否,则结束操作,若是,则将更新后的元数据发送至相应的客户端。可见,本发明对客户端的读写权限进行顺序管理;同时对小文件采取延迟同步,聚合后覆盖之前元数据,聚合文件落盘后采用普通的同步策略进行管理,提高了多客户端的管理效率。本发明还公开了一种分布式文件系统多客户端同步系统,具有与上述方法相同的技术效果。
The invention discloses a multi-client synchronization method of a distributed file system, which includes: judging whether the number of clients is 1, and if so, granting exclusive rights to the above-mentioned clients; The client assigns the above-mentioned write permission; the client with the above-mentioned write permission completes writing to the file, and then updates the corresponding metadata; judges whether there are other clients with read-write permission to operate the above-mentioned file, if not, end the operation, if so , the updated metadata is sent to the corresponding client. It can be seen that the present invention manages the read and write permissions of clients sequentially; at the same time, delay synchronization is adopted for small files, and the previous metadata is overwritten after aggregation, and common synchronization strategies are used for management after aggregated files are placed on the disk, which improves the management efficiency of multiple clients. The invention also discloses a distributed file system multi-client synchronization system, which has the same technical effect as the above method.
Description
技术领域technical field
本发明涉及,特别涉及一种分布式文件系统多客户端同步方法及系统。The present invention relates, in particular, to a multi-client synchronization method and system of a distributed file system.
背景技术Background technique
对于分布式文件系统而言,由于其客户端分布在不同的物理机器上,因此不同的客户端对于文件系统元数据和数据的操作是相互不可见的。于是就存在一个客户端对于文件系统的修改对另一个客户端不可见的问题,也就是多客户端之间存在缓存一致性的问题。现有技术中,数据同步采取两种方法:一、各客户端均可在线操作文件,但由于存在不同客户端同时操作的情况,数据同步时会有多个数据同时覆盖,此时,同步的结果为只有最后覆盖的文件生效、或者系统报错错误;二、客户端离线操作文件后同步至服务器,此时,相同文件会同步多个结果,其他用户再访问时,无法确定哪个文件是最新文件。For a distributed file system, since its clients are distributed on different physical machines, the operations of different clients on file system metadata and data are mutually invisible. So there is a problem that one client's modification of the file system is not visible to another client, that is, there is a problem of cache consistency among multiple clients. In the prior art, two methods are adopted for data synchronization: 1. Each client can operate files online, but due to the simultaneous operation of different clients, multiple data will be overwritten at the same time during data synchronization. At this time, the synchronized The result is that only the last overwritten file takes effect, or the system reports an error; 2. The client operates the file offline and then synchronizes to the server. At this time, the same file will synchronize multiple results. When other users access it again, it is impossible to determine which file is the latest file. .
综上所述,如何提高多客户端同步的管理效率是本领域技术人员目前需要解决的技术问题。To sum up, how to improve the management efficiency of multi-client synchronization is a technical problem to be solved by those skilled in the art.
发明内容Contents of the invention
有鉴于此,本发明的目的在于提供一种分布式文件系统多客户端同步方法及系统,可以显著提高多客户端同步的管理效率。其具体方案如下:In view of this, the object of the present invention is to provide a distributed file system multi-client synchronization method and system, which can significantly improve the management efficiency of multi-client synchronization. The specific plan is as follows:
一种分布式文件系统多客户端同步方法,包括:A distributed file system multi-client synchronization method, comprising:
步骤S1:判断客户端的数量是否为1,若是,则给予所述客户端独占权限,若否,则进行步骤S2;Step S1: determine whether the number of clients is 1, if so, give the client an exclusive right, if not, proceed to step S2;
步骤S2:按写权限的申请顺序,向相应的客户端分配所述写权限;Step S2: according to the application sequence of write permission, assign the write permission to the corresponding client;
步骤S3:具有所述写权限的客户端对文件完成写入,则更新相应的元数据;Step S3: The client with the write permission finishes writing the file, and then updates the corresponding metadata;
步骤S4:判断是否有其他具有读写权限的客户端操作所述文件,若否,则结束操作,若是,则将更新后的元数据发送至相应的客户端。Step S4: Determine whether there are other clients with read and write permissions to operate the file, if not, end the operation, and if so, send the updated metadata to the corresponding client.
优选的,给予所述客户端所述独占权限包括:Preferably, giving the client the exclusive authority includes:
获取所述客户端发送的操作权限请求;Obtain the operation permission request sent by the client;
回复所述客户端的操作权限请求,以向所述客户端分配相应的操作权限;Reply to the operation authority request of the client, so as to assign the corresponding operation authority to the client;
获取所述客户端发送的释放权限请求;Obtaining the permission release request sent by the client;
向所述客户端的回复释放权限结果。The reply to the client releases the permission result.
优选的,所述操作权限包括读权限、写权限和客户端本地缓存权限。Preferably, the operation permissions include read permissions, write permissions and client local cache permissions.
优选的,按所述写权限的申请顺序,向相应的客户端分配所述写权限还包括:Preferably, according to the application sequence of the write permission, assigning the write permission to the corresponding client further includes:
按读权限的申请顺序,向相应的客户端分配所述读权限。According to the application sequence of the read permission, the read permission is assigned to the corresponding client.
优选的,按所述写权限的申请顺序,向相应的客户端分配所述写权限还包括:Preferably, according to the application sequence of the write permission, assigning the write permission to the corresponding client further includes:
去除具有所述写权限的客户端的本地缓存权限。Remove the local cache permission of the client with the write permission.
优选的,具有所述写权限的客户端对文件完成写入,则更新相应的元数据包括:Preferably, the client with the write permission finishes writing the file, then updating the corresponding metadata includes:
判断客户端申请写入的文件的大小是否小于预设值,若是,则采用聚合模式写入,Determine whether the size of the file requested by the client is smaller than the preset value, if so, use the aggregation mode to write,
其中,所述聚合模式为将具有写权限的客户端编辑的数据写入到本地缓存,若判断所述本地缓存的大小大于或等于阈值,则更新相应的元数据。Wherein, the aggregation mode is to write data edited by a client with write permission to a local cache, and if it is determined that the size of the local cache is greater than or equal to a threshold, then update corresponding metadata.
本发明还公开了一种分布式文件系统多客户端同步系统,包括:The invention also discloses a distributed file system multi-client synchronization system, including:
客户端数量判断模块,用于判断客户端的数量是否为1;The client quantity judging module is used to judge whether the client quantity is 1;
单客户端权限分配模块,用当判定所述客户端数量为1,则给予所述客户端独占权限;The single-client authority allocation module is used to determine that the number of clients is 1, and then give the client exclusive authority;
多客户端权限分配模块,用当判定所述客户端数量不为1,则按写权限的申请顺序,向相应的客户端分配所述写权限;The multi-client authority allocation module is used to assign the write authority to the corresponding client according to the order of application of the write authority when it is determined that the number of clients is not 1;
元数据更新模块,用于当具有所述写权限的客户端对文件完成写入,则更新相应的元数据;A metadata update module, configured to update the corresponding metadata when the client with the write permission finishes writing the file;
客户端数据更新模块,用于判断是否有其他具有读写权限的客户端操作所述文件,若否,则结束操作,若是,则将更新后的元数据发送至相应的客户端。The client data update module is used to judge whether there are other clients with read and write permissions to operate the file, if not, end the operation, and if so, send the updated metadata to the corresponding client.
本发明公开恶劣一种分布式文件系统多客户端同步方法,包括:步骤S1:判断客户端的数量是否为1,若是,则给予所述客户端独占权限,若否,则进行步骤S2;步骤S2:按写权限的申请顺序,向相应的客户端分配所述写权限;步骤S3:具有所述写权限的客户端对文件完成写入,则更新相应的元数据;步骤S4:判断是否有其他具有读写权限的客户端操作所述文件,若否,则结束操作,若是,则将更新后的元数据发送至相应的客户端。可见,本发明采对客户端缓存同一管理,按申请顺序依次分配读写权限,保证数据一致,实现多客户端并发读写;同时针对小文件聚合的场景,本方案采取延迟同步,聚合最后一次数据落盘后覆盖之前元数据,聚合文件落盘后采用普通的同步策略进行管理。本方法逻辑简单易于实现,同时实现分布式文件系统的并发操作,其次针对聚合文件,在保证聚合效率的基础上实现多客户端同步,从而提高了多客户端同步的管理效率。The present invention discloses a multi-client synchronization method of a distributed file system, including: step S1: judging whether the number of clients is 1, if so, giving the client an exclusive right, if not, proceeding to step S2; step S2 : According to the application sequence of write permission, assign the write permission to the corresponding client; step S3: the client with the write permission finishes writing the file, then update the corresponding metadata; step S4: judge whether there are other A client with read and write permissions operates the file, if not, the operation ends, and if yes, the updated metadata is sent to the corresponding client. It can be seen that the present invention adopts the unified management of the client cache, assigns read and write permissions in sequence according to the application order, ensures data consistency, and realizes concurrent reading and writing of multiple clients; at the same time, for the scenario of small file aggregation, this solution adopts delayed synchronization, and the last time of aggregation is After the data is placed on the disk, the previous metadata will be overwritten. After the aggregation file is placed on the disk, the normal synchronization strategy will be used for management. The logic of the method is simple and easy to implement, and at the same time realizes the concurrent operation of the distributed file system. Secondly, for the aggregated files, the multi-client synchronization is realized on the basis of ensuring the aggregation efficiency, thereby improving the management efficiency of the multi-client synchronization.
本发明还公开了一种分布式文件系统多客户端同步系统,具有与上述方法相同的技术效果,在此不再赘述。The present invention also discloses a distributed file system multi-client synchronization system, which has the same technical effect as the above-mentioned method and will not be repeated here.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.
图1为本发明还公开的一种分布式文件系统多客户端同步方法的流程示意图;Fig. 1 is a schematic flow diagram of a distributed file system multi-client synchronization method also disclosed by the present invention;
图2为本发明还公开的一种具体的分布式文件系统多客户端同步系统的结构示意图。FIG. 2 is a schematic structural diagram of a specific distributed file system multi-client synchronization system also disclosed in the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明实施例公开了一种分布式文件系统多客户端同步方法,参见图1所示,包括:The embodiment of the present invention discloses a distributed file system multi-client synchronization method, as shown in Figure 1, including:
步骤S1:判断客户端的数量是否为1,若是,则给予上述客户端独占权限,若否,则进行步骤S2。Step S1: Determine whether the number of clients is 1, if yes, give the client an exclusive right, if not, proceed to step S2.
当客户端数量为1,即分布式系统只存在单客户端,因此不存在其他客户端数据同步延迟问题,可对该客户端给予独占权限。When the number of clients is 1, that is, there is only a single client in the distributed system, so there is no data synchronization delay problem of other clients, and exclusive rights can be given to this client.
当客户端数量不为1,客户端数量大于或等于1,即该分布式系统为多客户端系统,此时,存在多个客户端访问的数据同步延迟问题,需要进行相应的操作。When the number of clients is not 1, but the number of clients is greater than or equal to 1, that is, the distributed system is a multi-client system. At this time, there is a problem of data synchronization delays accessed by multiple clients, and corresponding operations need to be performed.
在一种具体的实施方案中,给予单客户端独占权限包括:获取该单客户端发送的操作权限请求;回复该单客户端的操作权限请求,以向该单客户端分配相应的操作权限;在该单客户端对相应的文件编辑完成后,获取该单客户端发送的释放权限请求;向该单客户端的回复释放权限结果。In a specific embodiment, granting the exclusive authority to the single client includes: obtaining the operation authority request sent by the single client; replying to the operation authority request of the single client, so as to assign the corresponding operation authority to the single client; After the single client completes the editing of the corresponding file, obtain the permission release request sent by the single client; reply the permission release result to the single client.
需要说明的是,操作权限通常包括读权限、对待编辑文件的写权限和客户端本地缓存权限。客户端对待编辑文件进行读取,需要获取该待编辑文件的读权限,客户端对待编辑文件进行编辑,对待编辑文件的写权限,当然,由于本发明的发明点在于对分布式系统元数据在线同步更新,当分布式系统只存在单客户端,不存在其他客户端数据同步延迟问题,因此可给予该单客户端本地缓存权限。It should be noted that the operation permission usually includes read permission, write permission of the file to be edited, and local cache permission of the client. The client reads the file to be edited, and needs to obtain the read permission of the file to be edited, the client edits the file to be edited, and the write permission of the file to be edited, of course, because the invention of the present invention lies in the online Synchronous update, when there is only a single client in the distributed system, there is no data synchronization delay problem for other clients, so the single client can be given local cache permissions.
需要进一步说明的是,本发明同样适用于一些现有系统中的写权限包括读权限的情况。It should be further explained that the present invention is also applicable to situations where the write permission in some existing systems includes the read permission.
步骤S2:按写权限的申请顺序,向相应的客户端分配上述写权限。Step S2: Assign the above-mentioned write permission to the corresponding client according to the application sequence of the write permission.
由于客户端获取的读权限,仅仅为相应文件的查询读取权限,不具有对该文件进行编辑的权限,不会改变该文件的内容,因此,可以为同一个文件向超过多个客户端分配读权限,即同一文件支持在同一时间被多个客户端进行访问,即同一文件在同一时间段内可以被超过一个客户端继续访问。Since the read permission obtained by the client is only for the query and read permission of the corresponding file, it does not have the permission to edit the file and will not change the content of the file. Therefore, it is possible to assign more than one client to the same file. Read permission, that is, the same file supports being accessed by multiple clients at the same time, that is, the same file can be continuously accessed by more than one client within the same period of time.
当然,为了更好地管理各客户端的,使同一文件在同一时间只有一个客户端进行访问编辑,还可以按读权限的申请顺序,向相应的客户端分配上述读权限。Of course, in order to better manage each client, so that only one client can access and edit the same file at the same time, the above-mentioned read permission can also be assigned to the corresponding client according to the order of application for read permission.
在一种具体的实施方案中,分布式系统中的元数据服务器获取到客户端A申请的写权限,确认客户端A为合法客户端后,向客户端A分配相应文件的写权限及cache权限,客户端A则对该文件进行编辑。此时,元数据服务器又获取到客户端B申请的读写权限,则元数据服务器在收回客户端A的写权限后,才向客户端B分配读写权限。当然,元数据服务器也可在收回客户端A的写权限前,向客户端B分配读权限。In a specific implementation scheme, the metadata server in the distributed system obtains the write permission applied by client A, and after confirming that client A is a legal client, assigns the write permission and cache permission of the corresponding file to client A , and client A edits the file. At this time, the metadata server obtains the read and write permission requested by client B, and the metadata server assigns the read and write permission to client B after withdrawing the write permission from client A. Of course, the metadata server can also assign the read permission to the client B before withdrawing the write permission from the client A.
由于本发明的发明点在于对分布式系统元数据在线同步更新,当分布式系统包括多客户端,即超过1个客户端,则存在多个客户端数据同步延迟问题,因此,为了使相应数据在分布式系统上实时更新,则去除具有上述写权限的客户端的本地缓存权限。Since the inventive point of the present invention is to update the distributed system metadata online synchronously, when the distributed system includes multiple clients, that is, more than 1 client, there will be a problem of data synchronization delay for multiple clients. Therefore, in order to make the corresponding data If it is updated in real time on a distributed system, the local cache permission of the client with the above-mentioned write permission will be removed.
步骤S3:具有上述写权限的客户端对文件完成写入,则更新相应的元数据。Step S3: The client with the above-mentioned write permission completes writing to the file, and then updates the corresponding metadata.
为了提高小文件的处理效率,本发明针对小文件采用聚合模式。此处的小文件需要与分布式系统中元数据服务器中预设值进行比较,若小于该预设值,则可判定该文件为小文件,相应采用聚合模式。In order to improve the processing efficiency of small files, the present invention adopts an aggregation mode for small files. The small file here needs to be compared with the preset value in the metadata server in the distributed system. If it is smaller than the preset value, it can be determined that the file is a small file, and the aggregation mode is adopted accordingly.
具体的实现方式为判断客户端申请写入的文件的大小是否小于预设值,若是,则采用聚合模式写入,其中,上述聚合模式为将具有写权限的客户端编辑的数据写入到本地缓存,若判断上述本地缓存的大小大于或等于阈值,则更新相应的元数据。The specific implementation method is to judge whether the size of the file written by the client application is smaller than the preset value, and if so, write it in the aggregation mode. The above aggregation mode is to write the data edited by the client with write permission to the local Cache, if it is judged that the size of the local cache is greater than or equal to the threshold, update the corresponding metadata.
如果数据未下盘,客户端会一直把数据写入聚合缓存中,直到聚合缓存中的数据量大于或等于阈值,则将聚合缓存中的数据更新至元数据服务器中。If the data is not off the disk, the client will keep writing the data into the aggregation cache until the amount of data in the aggregation cache is greater than or equal to the threshold, then update the data in the aggregation cache to the metadata server.
需要说明的是,聚合缓存包括本地缓存和特定的网络缓存,当局和缓存为特定的网络缓存时,该网络缓存的存储处理速度应优于分布式系统的处理速度。It should be noted that the aggregation cache includes a local cache and a specific network cache. When the authority and the cache are specific network caches, the storage and processing speed of the network cache should be faster than that of the distributed system.
步骤S4:判断是否有其他具有读写权限的客户端操作上述文件,若否,则结束操作,若是,则将更新后的元数据发送至相应的客户端。Step S4: Determine whether there are other clients with read and write permissions to operate the above file, if not, end the operation, and if so, send the updated metadata to the corresponding client.
若无其他客户端对更新后的文件进行访问编辑,则保存该文件,并覆盖之前的文件,当然,也可按修订先后顺序对该文件的历史编进内容进行保存。If no other client accesses and edits the updated file, the file will be saved and the previous file will be overwritten. Of course, the historical compilation content of the file can also be saved in the order of revision.
若有其他客户端对其访问,即存在具有读权限的其他客户端,则将更新后的文件发送至该具有读权限的其他客户端,并更新相应客户端的本地元数据。If there are other clients accessing it, that is, there are other clients with read permission, the updated file is sent to the other client with read permission, and the local metadata of the corresponding client is updated.
本发明还公开了一种分布式文件系统多客户端同步系统,参见图2所示,包括客户端数量判断模块11、单客户端权限分配模块12、多客户端权限分配模块13、元数据更新模块14和客户端数据更新模块15,其中:The present invention also discloses a multi-client synchronization system of a distributed file system, as shown in FIG. Module 14 and client data updating module 15, wherein:
客户端数量判断模块11,用于判断客户端的数量是否为1。The client quantity judging module 11 is used to judge whether the client quantity is 1.
当客户端数量为1,即分布式系统只存在单客户端,因此不存在其他客户端数据同步延迟问题,可通过单客户端权限分配模块12对该客户端给予独占权限。When the number of clients is 1, that is, there is only a single client in the distributed system, so there is no data synchronization delay problem of other clients, and the client can be given exclusive authority by the single-client authority allocation module 12 .
当客户端数量不为1,客户端数量大于或等于1,即该分布式系统为多客户端系统,此时,存在多个客户端访问的数据同步延迟问题,需要多客户端权限分配模块13进行相应的操作。When the number of clients is not 1, and the number of clients is greater than or equal to 1, that is, the distributed system is a multi-client system. At this time, there is a problem of data synchronization delay for multiple clients to access, and a multi-client authority allocation module 13 is required. Do the corresponding operation.
需要进一步说明的是,本发明同样适用于一些现有系统中的写权限包括读权限的情况。It should be further explained that the present invention is also applicable to situations where the write permission in some existing systems includes the read permission.
单客户端权限分配模块12,用当判定上述客户端数量为1,则给予上述客户端独占权限。The single-client authority allocation module 12 is used to grant exclusive authority to the above-mentioned client when it is determined that the number of the above-mentioned clients is 1.
在一种具体的实施方案中,给予单客户端独占权限包括:获取该单客户端发送的操作权限请求;回复该单客户端的操作权限请求,以向该单客户端分配相应的操作权限;在该单客户端对相应的文件编辑完成后,获取该单客户端发送的释放权限请求;向该单客户端的回复释放权限结果。In a specific embodiment, granting the exclusive authority to the single client includes: obtaining the operation authority request sent by the single client; replying to the operation authority request of the single client, so as to assign the corresponding operation authority to the single client; After the single client completes the editing of the corresponding file, obtain the permission release request sent by the single client; reply the permission release result to the single client.
需要说明的是,操作权限通常包括读权限、对待编辑文件的写权限和客户端本地缓存权限。客户端对待编辑文件进行读取,需要获取该待编辑文件的读权限,客户端对待编辑文件进行编辑,对待编辑文件的写权限,当然,由于本发明的发明点在于对分布式系统元数据在线同步更新,当分布式系统只存在单客户端,不存在其他客户端数据同步延迟问题,因此可给予该单客户端本地缓存权限。It should be noted that the operation permission usually includes read permission, write permission of the file to be edited, and local cache permission of the client. The client reads the file to be edited, and needs to obtain the read permission of the file to be edited, the client edits the file to be edited, and the write permission of the file to be edited, of course, because the invention of the present invention lies in the online Synchronous update, when there is only a single client in the distributed system, there is no data synchronization delay problem for other clients, so the single client can be given local cache permissions.
多客户端权限分配模块13,用当判定上述客户端数量不为1,则按写权限的申请顺序,向相应的客户端分配上述写权限。The multi-client authority allocation module 13 is used to allocate the above-mentioned write authority to the corresponding clients according to the order of application for write authority when it is determined that the number of the above-mentioned clients is not 1.
由于客户端获取的读权限,仅仅为相应文件的查询读取权限,不具有对该文件进行编辑的权限,不会改变该文件的内容,因此,可以为同一个文件向超过多个客户端分配读权限,即同一文件支持在同一时间被多个客户端进行访问,即同一文件在同一时间段内可以被超过一个客户端继续访问。Since the read permission obtained by the client is only for the query and read permission of the corresponding file, it does not have the permission to edit the file and will not change the content of the file. Therefore, it is possible to assign more than one client to the same file. Read permission, that is, the same file supports being accessed by multiple clients at the same time, that is, the same file can be continuously accessed by more than one client within the same period of time.
当然,为了更好地管理各客户端的,使同一文件在同一时间只有一个客户端进行访问编辑,还可以按读权限的申请顺序,向相应的客户端分配上述读权限。Of course, in order to better manage each client, so that only one client can access and edit the same file at the same time, the above-mentioned read permission can also be assigned to the corresponding client according to the order of application for read permission.
在一种具体的实施方案中,分布式系统中的元数据服务器获取到客户端A申请的写权限,确认客户端A为合法客户端后,向客户端A分配相应文件的写权限及cache权限,客户端A则对该文件进行编辑。此时,元数据服务器又获取到客户端B申请的读写权限,则元数据服务器在收回客户端A的写权限后,才向客户端B分配读写权限。当然,元数据服务器也可在收回客户端A的写权限前,向客户端B分配读权限。In a specific implementation scheme, the metadata server in the distributed system obtains the write permission applied by client A, and after confirming that client A is a legal client, assigns the write permission and cache permission of the corresponding file to client A , and client A edits the file. At this time, the metadata server obtains the read and write permission requested by client B, and the metadata server assigns the read and write permission to client B after withdrawing the write permission from client A. Of course, the metadata server can also assign the read permission to the client B before withdrawing the write permission from the client A.
由于本发明的发明点在于对分布式系统元数据在线同步更新,当分布式系统包括多客户端,即超过1个客户端,则存在多个客户端数据同步延迟问题,因此,为了使相应数据在分布式系统上实时更新,则去除具有上述写权限的客户端的本地缓存权限。Since the inventive point of the present invention is to update the distributed system metadata online synchronously, when the distributed system includes multiple clients, that is, more than 1 client, there will be a problem of data synchronization delay for multiple clients. Therefore, in order to make the corresponding data If it is updated in real time on a distributed system, the local cache permission of the client with the above-mentioned write permission will be removed.
元数据更新模块14,用于当具有上述写权限的客户端对文件完成写入,则更新相应的元数据。The metadata update module 14 is configured to update the corresponding metadata when the client with the above-mentioned write permission completes writing to the file.
为了提高小文件的处理效率,本发明针对小文件采用聚合模式。此处的小文件需要与分布式系统中元数据服务器中预设值进行比较,若小于该预设值,则可判定该文件为小文件,相应采用聚合模式。In order to improve the processing efficiency of small files, the present invention adopts an aggregation mode for small files. The small file here needs to be compared with the preset value in the metadata server in the distributed system. If it is smaller than the preset value, it can be determined that the file is a small file, and the aggregation mode is adopted accordingly.
具体的实现方式为判断客户端申请写入的文件的大小是否小于预设值,若是,则采用聚合模式写入,其中,上述聚合模式为将具有写权限的客户端编辑的数据写入到本地缓存,若判断上述本地缓存的大小大于或等于阈值,则更新相应的元数据。The specific implementation method is to judge whether the size of the file written by the client application is smaller than the preset value, and if so, write it in the aggregation mode. The above aggregation mode is to write the data edited by the client with write permission to the local Cache, if it is judged that the size of the local cache is greater than or equal to the threshold, update the corresponding metadata.
如果数据未下盘,客户端会一直把数据写入聚合缓存中,直到聚合缓存中的数据量大于或等于阈值,则将聚合缓存中的数据更新至元数据服务器中。If the data is not off the disk, the client will keep writing the data into the aggregation cache until the amount of data in the aggregation cache is greater than or equal to the threshold, then update the data in the aggregation cache to the metadata server.
需要说明的是,聚合缓存包括本地缓存和特定的网络缓存,当局和缓存为特定的网络缓存时,该网络缓存的存储处理速度应优于分布式系统的处理速度。It should be noted that the aggregation cache includes a local cache and a specific network cache. When the authority and the cache are specific network caches, the storage and processing speed of the network cache should be faster than that of the distributed system.
客户端数据更新模块15,用于判断是否有其他具有读写权限的客户端操作上述文件,若否,则结束操作,若是,则将更新后的元数据发送至相应的客户端。The client data update module 15 is used to judge whether there are other clients with read and write permissions to operate the above-mentioned files, if not, then end the operation, and if so, send the updated metadata to the corresponding client.
若无其他客户端对更新后的文件进行访问编辑,则保存该文件,并覆盖之前的文件,当然,也可按修订先后顺序对该文件的历史编进内容进行保存。If no other client accesses and edits the updated file, the file will be saved and the previous file will be overwritten. Of course, the historical compilation content of the file can also be saved in the order of revision.
若有其他客户端对其访问,即存在具有读权限的其他客户端,则将更新后的文件发送至该具有读权限的其他客户端,并更新相应客户端的本地元数据。If there are other clients accessing it, that is, there are other clients with read permission, the updated file is sent to the other client with read permission, and the local metadata of the corresponding client is updated.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
以上对本发明所提供的一种分布式文件系统多客户端同步方法及系统进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。A kind of distributed file system multi-client synchronization method and system provided by the present invention has been introduced in detail above. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for To help understand the method of the present invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, the content of this specification It should not be construed as limiting the invention.
Claims (7)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710100064.2A CN106603729A (en) | 2017-02-23 | 2017-02-23 | Distributed-file-system multi-client synchronization method and system thereof |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710100064.2A CN106603729A (en) | 2017-02-23 | 2017-02-23 | Distributed-file-system multi-client synchronization method and system thereof |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN106603729A true CN106603729A (en) | 2017-04-26 |
Family
ID=58587818
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710100064.2A Pending CN106603729A (en) | 2017-02-23 | 2017-02-23 | Distributed-file-system multi-client synchronization method and system thereof |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106603729A (en) |
Cited By (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107016130A (en) * | 2017-05-18 | 2017-08-04 | 郑州云海信息技术有限公司 | A kind of method and device of file storage |
| CN107172152A (en) * | 2017-05-19 | 2017-09-15 | 郑州云海信息技术有限公司 | One kind counts quota system and method based on CEPH cluster CAP mechanism |
| CN107704596A (en) * | 2017-10-13 | 2018-02-16 | 郑州云海信息技术有限公司 | A kind of method, apparatus and equipment for reading file |
| CN108021647A (en) * | 2017-11-30 | 2018-05-11 | 郑州云海信息技术有限公司 | A kind of file migration method, system, medium and equipment |
| CN109284274A (en) * | 2018-11-29 | 2019-01-29 | 郑州云海信息技术有限公司 | A realization method of configuration asynchronous pre-allocation based on distributed file system |
| CN111858541A (en) * | 2020-06-29 | 2020-10-30 | 广东浪潮大数据研究有限公司 | Data migration control method and related device of distributed file system |
| CN113127437A (en) * | 2019-12-31 | 2021-07-16 | 阿里巴巴集团控股有限公司 | File system management method, cloud system, device, electronic equipment and storage medium |
| CN113568881A (en) * | 2021-06-11 | 2021-10-29 | 济南浪潮数据技术有限公司 | Method, system, equipment and medium for realizing read-write sharing |
| CN115914655A (en) * | 2023-02-17 | 2023-04-04 | 成都华栖云科技有限公司 | Cross-platform and universal tool convergence media service interaction method and system |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030028695A1 (en) * | 2001-05-07 | 2003-02-06 | International Business Machines Corporation | Producer/consumer locking system for efficient replication of file data |
| CN1794207A (en) * | 2004-12-20 | 2006-06-28 | 国际商业机器公司 | Method and system for implenmenting buffer store uniformaty |
| CN102307221A (en) * | 2011-03-25 | 2012-01-04 | 国云科技股份有限公司 | Cloud storage system and implementation method thereof |
| CN102541983A (en) * | 2011-10-25 | 2012-07-04 | 无锡城市云计算中心有限公司 | Method for synchronously caching by multiple clients in distributed file system |
| CN103179185A (en) * | 2012-12-25 | 2013-06-26 | 中国科学院计算技术研究所 | Method and system for creating files in client cache of distributed file system |
| CN103327124A (en) * | 2013-07-12 | 2013-09-25 | 北京金山云网络技术有限公司 | Method, device, client, server and equipment for file synchronization |
| CN104133882A (en) * | 2014-07-28 | 2014-11-05 | 四川大学 | HDFS (Hadoop Distributed File System)-based old file processing method |
| CN104636088A (en) * | 2015-02-17 | 2015-05-20 | 华为技术有限公司 | Method for writing data into data servers and storage system |
-
2017
- 2017-02-23 CN CN201710100064.2A patent/CN106603729A/en active Pending
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030028695A1 (en) * | 2001-05-07 | 2003-02-06 | International Business Machines Corporation | Producer/consumer locking system for efficient replication of file data |
| CN1794207A (en) * | 2004-12-20 | 2006-06-28 | 国际商业机器公司 | Method and system for implenmenting buffer store uniformaty |
| CN102307221A (en) * | 2011-03-25 | 2012-01-04 | 国云科技股份有限公司 | Cloud storage system and implementation method thereof |
| CN102541983A (en) * | 2011-10-25 | 2012-07-04 | 无锡城市云计算中心有限公司 | Method for synchronously caching by multiple clients in distributed file system |
| CN103179185A (en) * | 2012-12-25 | 2013-06-26 | 中国科学院计算技术研究所 | Method and system for creating files in client cache of distributed file system |
| CN103327124A (en) * | 2013-07-12 | 2013-09-25 | 北京金山云网络技术有限公司 | Method, device, client, server and equipment for file synchronization |
| CN104133882A (en) * | 2014-07-28 | 2014-11-05 | 四川大学 | HDFS (Hadoop Distributed File System)-based old file processing method |
| CN104636088A (en) * | 2015-02-17 | 2015-05-20 | 华为技术有限公司 | Method for writing data into data servers and storage system |
Cited By (13)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107016130A (en) * | 2017-05-18 | 2017-08-04 | 郑州云海信息技术有限公司 | A kind of method and device of file storage |
| CN107172152B (en) * | 2017-05-19 | 2020-10-23 | 苏州浪潮智能科技有限公司 | A system and method for statistical quota based on CEPH cluster CAP mechanism |
| CN107172152A (en) * | 2017-05-19 | 2017-09-15 | 郑州云海信息技术有限公司 | One kind counts quota system and method based on CEPH cluster CAP mechanism |
| CN107704596A (en) * | 2017-10-13 | 2018-02-16 | 郑州云海信息技术有限公司 | A kind of method, apparatus and equipment for reading file |
| CN108021647A (en) * | 2017-11-30 | 2018-05-11 | 郑州云海信息技术有限公司 | A kind of file migration method, system, medium and equipment |
| CN108021647B (en) * | 2017-11-30 | 2020-10-16 | 苏州浪潮智能科技有限公司 | File migration method, system, medium and equipment |
| CN109284274A (en) * | 2018-11-29 | 2019-01-29 | 郑州云海信息技术有限公司 | A realization method of configuration asynchronous pre-allocation based on distributed file system |
| CN109284274B (en) * | 2018-11-29 | 2021-09-28 | 郑州云海信息技术有限公司 | Configuration asynchronous pre-allocation implementation method based on distributed file system |
| CN113127437A (en) * | 2019-12-31 | 2021-07-16 | 阿里巴巴集团控股有限公司 | File system management method, cloud system, device, electronic equipment and storage medium |
| CN113127437B (en) * | 2019-12-31 | 2023-12-22 | 阿里巴巴集团控股有限公司 | File system management method, cloud system, device, electronic equipment and storage medium |
| CN111858541A (en) * | 2020-06-29 | 2020-10-30 | 广东浪潮大数据研究有限公司 | Data migration control method and related device of distributed file system |
| CN113568881A (en) * | 2021-06-11 | 2021-10-29 | 济南浪潮数据技术有限公司 | Method, system, equipment and medium for realizing read-write sharing |
| CN115914655A (en) * | 2023-02-17 | 2023-04-04 | 成都华栖云科技有限公司 | Cross-platform and universal tool convergence media service interaction method and system |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN106603729A (en) | Distributed-file-system multi-client synchronization method and system thereof | |
| JP5787878B2 (en) | Fast merge support for legacy documents | |
| CN103179185B (en) | Method and system for creating files in cache of distributed file system client | |
| US10417186B2 (en) | File migration method and apparatus, and storage device | |
| CN103518364B (en) | The data-updating method of distributed memory system and server | |
| US8341118B2 (en) | Method and system for dynamically replicating data within a distributed storage system | |
| CN105224255B (en) | A kind of storage file management method and device | |
| US11561930B2 (en) | Independent evictions from datastore accelerator fleet nodes | |
| CN105183400B (en) | A method and system for object storage based on content addressing | |
| CN101013381A (en) | Distributed lock based on object memory system | |
| KR20130107280A (en) | Directory leasing | |
| JP2017515212A (en) | Scalable file storage service | |
| CN106326229B (en) | File storage method and device for embedded system | |
| WO2018157602A1 (en) | Method and device for synchronizing active transaction lists | |
| CN107679420B (en) | Permission setting method and system based on distributed file system | |
| CN106934048A (en) | Online data moving method, agent node | |
| CN110402441A (en) | Referencing access control lists | |
| US10152493B1 (en) | Dynamic ephemeral point-in-time snapshots for consistent reads to HDFS clients | |
| CN105446794A (en) | Disc operation method, apparatus and system based on virtual machine | |
| CN109582658A (en) | A kind of distributed file system realizes the method and device of data consistency | |
| CN104102725A (en) | Method and system for dynamically creating duplicates of hotspot data files in HDFS (Hadoop distributed file system) | |
| KR102595120B1 (en) | Systems and methods for continuously available network file system (NFS) state data | |
| JP4327869B2 (en) | Distributed file system, distributed file system server, and access method to distributed file system | |
| WO2021212784A1 (en) | Distributed storage-based live migration system and migration method therefor | |
| US20210132801A1 (en) | Optimized access to high-speed storage device |
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 | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170426 |
|
| RJ01 | Rejection of invention patent application after publication |