[go: up one dir, main page]

CN103559319A - Cache synchronization method and equipment for distributed cluster file system - Google Patents

Cache synchronization method and equipment for distributed cluster file system Download PDF

Info

Publication number
CN103559319A
CN103559319A CN201310596276.6A CN201310596276A CN103559319A CN 103559319 A CN103559319 A CN 103559319A CN 201310596276 A CN201310596276 A CN 201310596276A CN 103559319 A CN103559319 A CN 103559319A
Authority
CN
China
Prior art keywords
node
file destination
lock
section point
data
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.)
Granted
Application number
CN201310596276.6A
Other languages
Chinese (zh)
Other versions
CN103559319B (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201310596276.6A priority Critical patent/CN103559319B/en
Publication of CN103559319A publication Critical patent/CN103559319A/en
Application granted granted Critical
Publication of CN103559319B publication Critical patent/CN103559319B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • 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)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明实施例提供一种分布式集群文件系统的缓存同步方法和设备,通过为目标文件定义一个全局缓存表,全局缓存表中包含有各节点对目标文件的修改记录,当第一节点对目标文件进行写访问时,根据写锁中包含对目标文件进行过最新修改的第二节点的信息获取到最新全局缓存表,根据最新全局缓存表中第二节点对目标文件的最新修改记录获取到第二节点对目标文件的修改数据,当两个节点同时交互写目标文件的不同数据时各自缓存中的数据都是有效的,后续的读可以直接从缓存中获取,当两个节点交互写相同数据时,需要从另一个节点获取修改数据,数据在网络间的传递比一次写盘和读盘效率高很多,所以集群文件系统性相较现有方式有较大提升。

Figure 201310596276

Embodiments of the present invention provide a cache synchronization method and device for a distributed cluster file system. By defining a global cache table for the target file, the global cache table contains the modification records of each node to the target file. When the first node updates the target file When the file is written and accessed, the latest global cache table is obtained according to the information of the second node that has recently modified the target file in the write lock, and the second node is obtained according to the latest modification record of the target file by the second node in the latest global cache table. The modification data of the target file by the two nodes, when the two nodes write different data of the target file interactively at the same time, the data in their respective caches are valid, and subsequent reads can be obtained directly from the cache, when the two nodes write the same data interactively When the modified data needs to be obtained from another node, the transfer of data between networks is much more efficient than writing and reading disks once, so the cluster file system is greatly improved compared with the existing methods.

Figure 201310596276

Description

分布式集群文件系统的缓存同步方法和设备Cache synchronization method and device for distributed cluster file system

技术领域technical field

本发明实施例涉及数据通讯技术,尤其涉及一种分布式集群文件系统的缓存同步方法和设备。Embodiments of the present invention relate to data communication technology, and in particular to a cache synchronization method and device for a distributed cluster file system.

背景技术Background technique

分布式集群文件系统能够解决海量数据存储的问题,在集群中,多台设备联合起来对外提供服务,用多个节点(服务器)来代替一个节点完成任务,既提高了处理能力,还能够保证高可靠性。对称分布式的集群文件系统具有全局统一的命名空间,存储空间对于各个节点都是可见并且相同的,元数据和数据可以分布到集群的任何节点上,当然,从任意节点也可以访问到系统中存储的所有数据。The distributed cluster file system can solve the problem of massive data storage. In the cluster, multiple devices are combined to provide external services, and multiple nodes (servers) are used to replace one node to complete the task. This not only improves the processing capacity, but also ensures high reliability. The symmetrically distributed cluster file system has a globally unified namespace. The storage space is visible and identical to each node. Metadata and data can be distributed to any node in the cluster. Of course, the system can also be accessed from any node. All data stored.

当前的存储系统都至少分为2级存储:存储物理介质和从主存中开辟出的缓存。为了提升分布式集群文件系统的访问性能,在各个节点会有数据的高速缓存,当客户端读访问某部分数据时,接收此请求的节点首先查询数据是否存储在本节点的高速缓存中,若是,直接返回,若否,向磁盘发送I/O请求,将数据从磁盘读取到缓存中并暂时保存起来,以备下次访问时不需要从磁盘读取,从缓存中直接读取,以提升读性能。同样,当客户端写访问某部分数据时,接收此请求的节点先将数据写入缓存,而不是直接写盘,当节点中或者整个系统的缓存中积累了一定量的写数据时再一起将数据写入磁盘,以提升写性能。当系统中多个节点交互对同一文件进行读写访问时,如何高效地保证数据的一致性是系统需要重点解决的问题。Current storage systems are divided into at least two levels of storage: storage physical media and caches created from main memory. In order to improve the access performance of the distributed cluster file system, there will be data caches in each node. When the client reads and accesses some data, the node receiving the request first checks whether the data is stored in the cache of the node. If so , return directly, if not, send an I/O request to the disk, read the data from the disk into the cache and save it temporarily, in case the next access does not need to read from the disk, read directly from the cache, to Improve read performance. Similarly, when a client writes and accesses some data, the node receiving the request first writes the data into the cache instead of writing it directly to the disk. Data is written to disk to improve write performance. When multiple nodes in the system interact to read and write access to the same file, how to efficiently ensure data consistency is a key problem that the system needs to solve.

现有技术中,对于分布式集群文件系统来说,为了保证数据的一致性必须要用到分布式锁,访问数据之前,首先需要申请此数据对应的分布式锁。分布式锁有读锁和写锁,读锁可以并发,写锁为独占,即多个节点可以并发读同一部分数据,但若某个节点正在修改此部分数据,其他节点必须等到修改完成之后才能访问,访问到的数据包括最新修改的数据。以下将通过一个具体例子来说明,图1为现有技术中文件的读写流程示意图,如图1所示,节点1首先修改了文件1的第0数据块,由于之前没有任何节点来申请过文件1对应的写锁,锁处于初始化状态,锁管理装置直接授权给节点1,节点1获得写锁之后,修改第0数据块,修改后的数据保存在缓存中。之后节点2对文件1写访问,需要修改文件1的第4数据块,分布式锁发现节点1申请过写锁,于是向节点1回收文件1的写锁,节点1接收到写锁回收的命令之后,首先将文件1的缓存数据下盘,由于节点2申请的是写锁,意味着节点2要修改文件1的数据,所以节点1上与文件1相关的缓存数据可能不会是最新的了,需要将其无效,之后将锁权限交还给锁管理装置,锁管理装置将锁权限授权给节点2,节点2获得写锁之后修改相应的数据到缓存,修改之后节点1又来读访问文件1的第0数据块,与之前一样锁管理装置到节点2回收写锁,回收过程中将节点2的数据写盘,由于节点1申请的是读锁,读不会修改数据,所以节点2的缓存还是有效的,即不用无效相应的缓存,之后锁管理装置将读锁授权给节点1,节点1从缓存中找到相应的数据,但是发现此数据是无效的,说明此数据可能不是最新的,从磁盘读取。In the prior art, for a distributed cluster file system, distributed locks must be used to ensure data consistency. Before accessing data, it is first necessary to apply for a distributed lock corresponding to the data. Distributed locks include read locks and write locks. Read locks can be concurrent, and write locks are exclusive. That is, multiple nodes can read the same part of data concurrently. However, if a node is modifying this part of data, other nodes must wait until the modification is completed. Access, the accessed data includes the latest modified data. A specific example will be used to illustrate the following. Figure 1 is a schematic diagram of the file reading and writing process in the prior art. As shown in Figure 1, node 1 first modifies the 0th data block of file 1, because no node has applied for it before. The write lock corresponding to file 1 is in the initialization state, and the lock management device is directly authorized to node 1. After obtaining the write lock, node 1 modifies the 0th data block, and the modified data is stored in the cache. After node 2 writes access to file 1, it needs to modify the fourth data block of file 1. Distributed lock finds that node 1 has applied for a write lock, so it reclaims the write lock of file 1 from node 1, and node 1 receives the command to reclaim the write lock After that, the cached data of file 1 is first downloaded to the disk. Since node 2 applies for a write lock, it means that node 2 wants to modify the data of file 1, so the cached data related to file 1 on node 1 may not be the latest , it needs to be invalidated, and then return the lock authority to the lock management device. The lock management device authorizes the lock authority to node 2. After node 2 obtains the write lock, it modifies the corresponding data to the cache. After the modification, node 1 reads and accesses file 1 The 0th data block of , as before, the lock management device reclaims the write lock from node 2. During the recovery process, the data of node 2 is written to the disk. Since node 1 applies for a read lock, reading will not modify the data, so the cache of node 2 It is still valid, that is, there is no need to invalidate the corresponding cache, and then the lock management device authorizes the read lock to node 1, and node 1 finds the corresponding data from the cache, but finds that the data is invalid, indicating that the data may not be up-to-date. disk read.

通过上述的例子可以看出,通过将最新数据写盘来保证各个节点访问到的数据的一致性,会存在如下诸多缺点:若集群中各节点交互对同一个文件进行读写操作,会造成此文件的数据频繁读盘写盘,缓存没有任何加速作用,反而增加系统的复杂度,而且频繁的读盘、写盘将造成系统的延迟增大,将极大地影响性能。From the above example, we can see that by writing the latest data to the disk to ensure the consistency of the data accessed by each node, there will be many disadvantages as follows: If the nodes in the cluster read and write the same file interactively, this will cause File data is frequently read and written to the disk, and the cache does not have any acceleration effect, but increases the complexity of the system, and frequent disk reading and writing will increase the delay of the system, which will greatly affect performance.

发明内容Contents of the invention

本发明实施例提供一种分布式集群文件系统的缓存同步方法和设备,能够避免频繁的读盘、写盘将造成系统的延迟增大,提高系统性能。Embodiments of the present invention provide a cache synchronization method and device for a distributed cluster file system, which can avoid increased system delay caused by frequent disk reading and writing, and improve system performance.

本发明第一发明提供一种分布式集群文件系统的缓存同步方法,包括:The first invention of the present invention provides a cache synchronization method for a distributed cluster file system, including:

当客户端对第一节点上的目标文件进行写访问时,所述第一节点向锁管理装置申请所述目标文件对应的写锁,所述写锁中包括对所述目标文件进行过最新修改的第二节点的信息;When the client performs write access to the target file on the first node, the first node applies to the lock management device for the write lock corresponding to the target file, and the write lock includes the latest modification of the target file The information of the second node;

所述第一节点根据所述第二节点的信息获取所述目标文件对应的最新全局缓存表,所述最新全局缓存表中保存有所述第二节点对所述目标文件的最新修改记录;The first node obtains the latest global cache table corresponding to the target file according to the information of the second node, and the latest modification record of the target file by the second node is stored in the latest global cache table;

所述第一节点根据所述第二节点对所述目标文件的最新修改记录对所述目标文件进行修改,将修改后的数据保存在所述第一节点的缓存中,并将所述第一节点对所述目标文件的修改记录更新到所述最新全局缓存表。The first node modifies the target file according to the latest modification record of the second node to the target file, saves the modified data in the cache of the first node, and stores the first The modification record of the target file by the node is updated to the latest global cache table.

在本发明第一方面的第一种可能的实现方式中,所述第一节点根据所述第二节点对所述目标文件的最新修改记录对所述目标文件进行修改,包括:In a first possible implementation manner of the first aspect of the present invention, the first node modifies the target file according to the latest modification record of the second node to the target file, including:

所述第一节点根据所述第二节点对所述目标文件的最新修改记录确定是否获取所述第二节点对所述目标文件的修改数据;The first node determines whether to acquire the modification data of the target file by the second node according to the latest modification record of the target file by the second node;

若是,则所述第一节点获取所述第二节点对所述目标文件的修改数据,将获取到的所述目标文件的修改数据存储在所述第一节点的缓存中,使得所述第一节点和所述第二节点上存储的所述目标文件的数据保持一致,从所述第一节点的缓存中读取所述数据,对所述目标文件进行修改;If so, the first node obtains the modification data of the target file by the second node, and stores the obtained modification data of the target file in the cache of the first node, so that the first node The data of the target file stored on the node and the second node are consistent, the data is read from the cache of the first node, and the target file is modified;

若否,则所述第一节点从所述第一节点的缓存中读取数据,对所述目标文件进行修改。If not, the first node reads data from the cache of the first node, and modifies the target file.

在本发明第一方面的第二种可能的实现方式中,所述目标文件包括至少两个数据块,所述第二节点对所述目标文件的最新修改记录中包括:所述第二节点对所述目标文件进行过最新修改的数据块的信息;In a second possible implementation manner of the first aspect of the present invention, the target file includes at least two data blocks, and the latest modification record of the target file by the second node includes: the second node pair Information about the latest modified data block of the target file;

所述第一节点根据所述第二节点对所述目标文件的最新修改记录确定是否获取所述第二节点对所述目标文件的修改数据,包括:The first node determines whether to acquire the modification data of the target file by the second node according to the latest modification record of the second node to the target file, including:

所述第一节点根据所述第二节点对所述目标文件进行过最新修改的数据块的信息,确定所述第一节点对所述目标文件进行写访问的数据块与所述第二节点对所述目标文件进行过最新修改的数据块是否为同一个数据块;The first node determines that the data block that the first node performs write access to the target file is identical to the second node's Whether the latest modified data block of the target file is the same data block;

若是,则所述第一节点获取所述第二节点对所述目标文件的修改数据。If yes, the first node obtains the modification data of the target file by the second node.

在本发明第一方面的第三种可能的实现方式中,所述第一节点根据所述第二节点的信息获取最新全局缓存表,包括:In a third possible implementation manner of the first aspect of the present invention, the first node obtains the latest global cache table according to the information of the second node, including:

所述第一节点向所述第二节点发送全局缓存表同步请求消息;The first node sends a global cache table synchronization request message to the second node;

所述第一节点接收所述第二节点发送的全局缓存表同步响应消息,所述全局缓存表同步响应消息中包含所述最新全局缓存表,所述最新全局缓存表中保存有所述第二节点对所述目标文件的最新修改记录。The first node receives the global cache table synchronization response message sent by the second node, the global cache table synchronization response message includes the latest global cache table, and the latest global cache table stores the second The latest modification record of the target file by the node.

在本发明第一方面的第四种可能的实现方式中,所述第一节点根据所述第二节点对所述目标文件的最新修改记录获取所述第二节点对所述目标文件的修改数据,包括:In a fourth possible implementation manner of the first aspect of the present invention, the first node obtains the modification data of the target file by the second node according to the latest modification record of the target file by the second node ,include:

所述第一节点根据所述最新全局缓存表中所述第二节点对所述目标文件的最新修改记录,向所述第二节点发送数据同步请求消息;The first node sends a data synchronization request message to the second node according to the latest modification record of the target file by the second node in the latest global cache table;

所述第一节点接收所述第二节点发送的数据同步响应消息,所述数据同步响应消息中包含所述第二节点对所述目标文件的修改数据。The first node receives the data synchronization response message sent by the second node, and the data synchronization response message includes the modification data of the target file by the second node.

在本发明第一方面的第五种可能的实现方式中,所述第一节点对所述目标文件进行写操作,将修改后的数据保存在所述第一节点的缓存中,并将所述第一节点对所述目标文件的修改记录更新到所述最新全局缓存表之后,还包括:In a fifth possible implementation manner of the first aspect of the present invention, the first node performs a write operation on the target file, saves the modified data in the cache of the first node, and stores the After the first node updates the modification record of the target file to the latest global cache table, it also includes:

当所述第一节点对所述目标文件进行读访问时,向所述锁管理装置申请所述目标文件对应的读锁,所述读锁中包含对所述目标文件进行过最新修改的所述第一节点的信息;When the first node performs read access to the target file, it applies to the lock management device for a read lock corresponding to the target file, and the read lock includes the latest modification of the target file. information of the first node;

所述第一节点从所述第一节点的缓存中读取所述目标文件。The first node reads the target file from the cache of the first node.

在本发明第一方面的第六种可能的实现方式中,所述第一节点所述目标文件进行写操作,将修改后的数据保存在所述第一节点的缓存中,并将所述第一节点对所述目标文件的修改记录更新到所述最新全局缓存表之后,还包括:In a sixth possible implementation manner of the first aspect of the present invention, the first node performs a write operation on the target file, saves the modified data in the cache of the first node, and stores the After a node updates the modification record of the target file to the latest global cache table, it also includes:

所述第一节点接收所述第二节点发送的全局缓存表同步请求消息,所述全局缓存表同步请求消息为所述第二节点需要对所述目标文件进行读访问或写访问时向所述第一节点发送的;The first node receives the global cache table synchronization request message sent by the second node, and the global cache table synchronization request message is sent to the second node when the second node needs to perform read or write access to the target file. sent by the first node;

所述第一节点根据所述全局缓存表同步请求消息,向所述第二节点返回全局缓存表同步响应消息,所述全局缓存表同步响应消息中包含所述更新后的最新全局缓存表。The first node returns a global cache table synchronization response message to the second node according to the global cache table synchronization request message, and the global cache table synchronization response message includes the updated latest global cache table.

在本发明第一方面的第七种可能的实现方式中,所述第一节点根据所述全局缓存表同步请求消息,向所述第二节点或所述第三节点返回全局缓存表同步响应消息之后,还包括:In a seventh possible implementation manner of the first aspect of the present invention, the first node returns a global cache table synchronization response message to the second node or the third node according to the global cache table synchronization request message After that, also include:

所述第一节点接收所述第二节点发送的数据同步请求,所述数据同步请求消息为所述第二节点根据所述更新后的最新全局缓存表中所述第一节点对所述目标文件的修改记录发送的;The first node receives the data synchronization request sent by the second node, and the data synchronization request message is that the second node updates the target file by the first node according to the updated latest global cache table. sent by the modification record;

所述第一节点向所述第二节点发送数据同步响应,所述数据同步响应中包括所述第一节点对所述目标文件的修改数据,以使所述第二节点将所述第一节点对所述目标文件的修改数据保存在所述第二节点的缓存中,当所述第二节点对所述数据进行读访问或写访问时可以从所述第二节点的缓存中读取所述目标文件。The first node sends a data synchronization response to the second node, and the data synchronization response includes the modification data of the target file by the first node, so that the second node converts the first node The modified data of the target file is stored in the cache of the second node, and the data can be read from the cache of the second node when the second node performs read access or write access to the data. Target file.

在本发明第一方面的第八种可能的实现方式中,所述第一节点向锁管理装置申请所述目标文件对应的写锁,包括:In an eighth possible implementation manner of the first aspect of the present invention, the first node applies to a lock management device for a write lock corresponding to the target file, including:

所述第一节点向所述锁管理装置发送所述目标文件对应的写锁申请请求,以使所述锁管理装置向所述第二节点回收所述写锁;The first node sends a write lock application request corresponding to the target file to the lock management device, so that the lock management device reclaims the write lock to the second node;

所述第一节点接收所述锁管理装置发送的写锁授权响应。The first node receives the write lock authorization response sent by the lock management device.

本发明第二方面提供一种分布式集群目标文件系统的缓存同步方法,包括:The second aspect of the present invention provides a cache synchronization method of a distributed cluster target file system, including:

锁管理装置接收所述第一节点发送的目标文件对应的写锁申请请求,所述写锁申请请求是客户端对所述目标文件进行写访问时,所述第一节点向所述锁管理装置发送的;The lock management device receives the write lock application request corresponding to the target file sent by the first node, and the write lock application request is that when the client performs write access to the target file, the first node sends to the lock management device sent;

所述锁管理装置确定第二节点申请过所述目标文件对应的写锁,对所述目标文件进行过最新修改,则所述锁管理装置向所述第二节点发送所述目标文件对应的写锁回收命令,向所述第二节点回收所述目标文件对应的写锁,所述锁管理装置在向所述第二节点回收所述目标文件对应的写锁时,并不对所述第二节点的缓存中的所述目标文件的数据写盘和无效;The lock management device determines that the second node has applied for the write lock corresponding to the target file, and the target file has been newly modified, then the lock management device sends the write lock corresponding to the target file to the second node. A lock reclaim command, reclaiming the write lock corresponding to the target file from the second node, and the lock management device does not reclaim the write lock corresponding to the target file from the second node The data of the target file in the cache is written to disk and invalidated;

所述锁管理装置向所述第一节点发送写锁授权响应,所述写锁中包括所述第二节点的信息。The lock management apparatus sends a write lock authorization response to the first node, and the write lock includes information of the second node.

在本发明第二方面的第一种可能的实现方式中,所述锁管理装置向所述第一节点发送写锁授权响应,所述写锁中包括所述第二节点的信息之后,还包括:In a first possible implementation manner of the second aspect of the present invention, the lock management device sends a write lock authorization response to the first node, and after the write lock includes the information of the second node, it also includes :

所述锁管理装置接收所述第一节点发送的所述目标文件对应的读锁申请请求;The lock management device receives a read lock application request corresponding to the target file sent by the first node;

所述锁管理装置确定所述第一节点申请过所述目标文件对应的写锁,对所述目标文件进行过最新修改,则所述锁管理装置向所述第一节点发送所述目标文件对应的写锁回收命令,向所述第一节点回收所述目标文件对应的写锁,所述锁管理装置在向所述第一节点回收所述目标文件对应的写锁时,并不对所述第一节点的缓存中的所述目标文件的数据写盘和无效;The lock management device determines that the first node has applied for the write lock corresponding to the target file, and the target file has been newly modified, then the lock management device sends the target file corresponding to the first node to the first node. The write lock recovery command of the first node recovers the write lock corresponding to the target file from the first node. When the lock management device recovers the write lock corresponding to the target file from the first node, it does not The data of the target file in the cache of a node is written to disk and invalidated;

所述锁管理装置向所述第一节点发送读锁授权响应,所述读锁中包括所述第一节点的信息,以使所述第一节点从所述第一节点的缓存中读取所述目标文件。The lock management device sends a read lock authorization response to the first node, and the read lock includes information of the first node, so that the first node reads the Describe the target file.

在本发明第二方面的第二种可能的实现方式中,所述锁管理装置向所述第一节点发送写锁授权响应,所述写锁中包括所述第二节点的信息之后,还包括:In a second possible implementation manner of the second aspect of the present invention, the lock management device sends a write lock authorization response to the first node, and after the write lock includes the information of the second node, it also includes :

所述锁管理装置接收所述第二节点发送的所述目标文件对应的读锁或写锁申请请求;The lock management device receives a read lock or write lock application request corresponding to the target file sent by the second node;

所述锁管理装置确定所述第一节点申请过所述目标文件对应的写锁,对所述目标文件进行过最新修改,则所述锁管理装置向所述第一节点发送所述目标文件对应的写锁回收命令,向所述第一节点回收所述目标文件对应的写锁,所述锁管理装置在向所述第一节点回收所述目标文件对应的写锁时,并不对所述第一节点的缓存中的所述目标文件的数据写盘和无效;The lock management device determines that the first node has applied for the write lock corresponding to the target file, and the target file has been newly modified, then the lock management device sends the target file corresponding to the first node to the first node. The write lock recovery command of the first node recovers the write lock corresponding to the target file from the first node. When the lock management device recovers the write lock corresponding to the target file from the first node, it does not The data of the target file in the cache of a node is written to disk and invalidated;

所述锁管理装置向所述第二节点发送读锁或写锁授权响应,所述读锁或写锁中包括所述第一节点的信息,以使所述第二节点根据所述第一节点的信息获取最新全局缓存表。The lock management device sends a read lock or write lock authorization response to the second node, and the read lock or write lock includes the information of the first node, so that the second node according to the first node information to get the latest global cache table.

本发明第三方面提供一种分布式集群目标文件系统的缓存同步方法,包括:The third aspect of the present invention provides a cache synchronization method of a distributed cluster target file system, including:

所述第二节点接收所述第一节点发送的全局缓存表同步请求消息;The second node receives the global cache table synchronization request message sent by the first node;

所述第二节点根据所述全局缓存表同步请求消息,向所述第一节点返回全局缓存表同步响应消息,所述全局缓存表同步响应消息中包含所述最新全局缓存表,所述最新全局缓存表中保存有所述第二节点对所述目标文件的最新修改记录。The second node returns a global cache table synchronization response message to the first node according to the global cache table synchronization request message, the global cache table synchronization response message includes the latest global cache table, and the latest global The latest modification record of the target file by the second node is saved in the cache table.

在本发明第三方面的第一种可能的实现方式中,所述第二节点根据所述全局缓存表同步请求消息,向所述第一节点返回全局缓存表同步响应消息之后,还包括:In the first possible implementation manner of the third aspect of the present invention, after the second node returns a global cache table synchronization response message to the first node according to the global cache table synchronization request message, it further includes:

所述第二节点接收所述第一节点发送的数据同步请求消息,所述数据同步请求消息为所述第一节点根据所述最新全局缓存表中所述第二节点对所述目标文件的最新修改记录发送的;The second node receives the data synchronization request message sent by the first node, and the data synchronization request message is the latest update of the target file by the second node in the latest global cache table by the first node. Amended records sent;

所述第二节点根据所述数据同步请求消息,向所述第一节点返回数据同步响应消息,所述数据同步响应消息中包含所述第二节点对所述目标文件的修改数据。The second node returns a data synchronization response message to the first node according to the data synchronization request message, and the data synchronization response message includes modification data of the target file by the second node.

本发明第四方面提供一种节点,所述节点为第一节点,包括:A fourth aspect of the present invention provides a node, where the node is a first node, including:

锁申请模块,用于当客户端对第一节点上的目标文件进行写访问时,向锁管理装置申请所述目标文件对应的写锁,所述写锁中包括对所述目标文件进行过最新修改的第二节点的信息;A lock application module, configured to apply to the lock management device for a write lock corresponding to the target file when the client performs write access to the target file on the first node, and the write lock includes the update of the target file. Modified information of the second node;

缓存表获取模块,用于根据所述第二节点的信息获取所述目标文件对应的最新全局缓存表,所述最新全局缓存表中保存有所述第二节点对所述目标文件的最新修改记录;A cache table acquisition module, configured to acquire the latest global cache table corresponding to the target file according to the information of the second node, where the latest modification record of the second node to the target file is stored in the latest global cache table ;

文件修改模块,用于根据所述第二节点对所述目标文件的最新修改记录对所述目标文件进行修改,将修改后的数据保存在所述第一节点的缓存中,并将所述第一节点对所述目标文件的修改记录更新到所述最新全局缓存表。A file modification module, configured to modify the target file according to the latest modification record of the second node to the target file, save the modified data in the cache of the first node, and save the modified data in the cache of the first node A node updates the modification record of the target file to the latest global cache table.

在本发明第四方面的第一种可能的实现方式中,所述文件修改模块包括判断单元、数据获取单元和文件修改单元;In a first possible implementation manner of the fourth aspect of the present invention, the file modification module includes a judgment unit, a data acquisition unit, and a file modification unit;

所述判断单元,用于根据所述第二节点对所述目标文件的最新修改记录确定是否获取所述第二节点对所述目标文件的修改数据;The judging unit is configured to determine whether to acquire modification data of the target file by the second node according to the latest modification record of the target file by the second node;

若是,则所述获取单元获取所述第二节点对所述目标文件的修改数据,将获取到的所述目标文件的修改数据存储在所述第一节点的缓存中,使得所述第一节点和所述第二节点上存储的所述目标文件的数据保持一致,所述文件修改单元从所述第一节点的缓存中读取所述数据,对所述目标文件进行修改;If so, the obtaining unit obtains the modification data of the target file by the second node, and stores the obtained modification data of the target file in the cache of the first node, so that the first node Keeping consistent with the data of the target file stored on the second node, the file modification unit reads the data from the cache of the first node, and modifies the target file;

若否,则所述文件修改单元从所述第一节点的缓存中读取数据,对所述目标文件进行修改。If not, the file modifying unit reads data from the cache of the first node, and modifies the target file.

在本发明第四方面的第二种可能的实现方式中,所述目标文件包括至少两个数据块,所述第二节点对所述目标文件的最新修改记录中包括:所述第二节点对所述目标文件进行过最新修改的数据块的信息;In a second possible implementation manner of the fourth aspect of the present invention, the target file includes at least two data blocks, and the latest modification record of the target file by the second node includes: the second node pair Information about the latest modified data block of the target file;

所述判断单元具体用于:The judging unit is specifically used for:

根据所述第二节点对所述目标文件进行过最新修改的数据块的信息,确定所述第一节点对所述目标文件进行写访问的数据块与所述第二节点对所述目标文件进行过最新修改的数据块是否为同一个数据块;According to the information of the data block that the second node has recently modified the target file, determine that the data block that the first node performs write access to the target file is the same as the data block that the second node performs write access to the target file Whether the latest modified data block is the same data block;

若是,则所述数据获取单元获取所述第二节点对所述目标文件的修改数据。If yes, the data acquisition unit acquires modification data of the target file by the second node.

在本发明第四方面的第三种可能的实现方式中,所述缓存表获取模块具体用于:In a third possible implementation manner of the fourth aspect of the present invention, the cache table obtaining module is specifically configured to:

向所述第二节点发送全局缓存表同步请求消息;sending a global cache table synchronization request message to the second node;

接收所述第二节点发送的全局缓存表同步响应消息,所述全局缓存表同步响应消息中包含所述最新全局缓存表,所述最新全局缓存表中保存有所述第二节点对所述目标文件的最新修改记录。Receive a global cache table synchronization response message sent by the second node, the global cache table synchronization response message includes the latest global cache table, and the latest global cache table stores the A record of the last modification of the file.

在本发明第四方面的第四种可能的实现方式中,所述数据获取单元具体用于:In a fourth possible implementation manner of the fourth aspect of the present invention, the data acquisition unit is specifically configured to:

根据所述最新全局缓存表中所述第二节点对所述目标文件的最新修改记录,向所述第二节点发送数据同步请求消息;Sending a data synchronization request message to the second node according to the latest modification record of the target file by the second node in the latest global cache table;

接收所述第二节点发送的数据同步响应消息,所述数据同步响应消息中包含所述第二节点对所述目标文件的修改数据。Receive a data synchronization response message sent by the second node, where the data synchronization response message includes modification data of the target file by the second node.

在本发明第四方面的第五种可能的实现方式中,还包括:文件读取模块;In a fifth possible implementation manner of the fourth aspect of the present invention, it further includes: a file reading module;

所述锁申请模块还用于:当所述第一节点对所述目标文件进行读访问时,向所述锁管理装置申请所述目标文件对应的读锁,所述读锁中包含对所述目标文件进行过最新修改的所述第一节点的信息;The lock application module is further configured to: when the first node performs read access to the target file, apply to the lock management device for a read lock corresponding to the target file, and the read lock includes the Information about the first node whose target file has been newly modified;

所述文件读取模块,用于从所述第一节点的缓存中读取所述目标文件。The file reading module is configured to read the target file from the cache of the first node.

在本发明第四方面的第六种可能的实现方式中,还包括:In a sixth possible implementation manner of the fourth aspect of the present invention, it also includes:

接收模块,用于接收所述第二节点发送的全局缓存表同步请求消息,所述全局缓存表同步请求消息为所述第二节点需要对所述目标文件进行读访问或写访问时向所述第一节点发送的;The receiving module is configured to receive the global cache table synchronization request message sent by the second node, the global cache table synchronization request message is sent to the second node when the second node needs to perform read access or write access to the target file sent by the first node;

发送模块,用于根据所述全局缓存表同步请求消息,向所述第二节点返回全局缓存表同步响应消息,所述全局缓存表同步响应消息中包含所述更新后的最新全局缓存表。A sending module, configured to return a global cache table synchronization response message to the second node according to the global cache table synchronization request message, where the global cache table synchronization response message includes the updated latest global cache table.

在本发明第四方面的第七种可能的实现方式中,所述接收模块还用于:In a seventh possible implementation manner of the fourth aspect of the present invention, the receiving module is further configured to:

接收所述第二节点发送的数据同步请求,所述数据同步请求消息为所述第二节点根据所述更新后的最新全局缓存表中所述第一节点对所述目标文件的修改记录发送的;receiving a data synchronization request sent by the second node, where the data synchronization request message is sent by the second node according to the modification record of the target file by the first node in the updated latest global cache table ;

所述发送模块还用于:向所述第二节点发送数据同步响应,所述数据同步响应中包括所述第一节点对所述目标文件的修改数据,以使所述第二节点将所述第一节点对所述目标文件的修改数据保存在所述第二节点的缓存中,当所述第二节点对所述数据进行读访问或写访问时可以从所述第二节点的缓存中读取所述目标文件。The sending module is further configured to: send a data synchronization response to the second node, the data synchronization response includes the modification data of the target file by the first node, so that the second node will The modified data of the target file by the first node is stored in the cache of the second node, and can be read from the cache of the second node when the second node performs read access or write access to the data Get the target file.

在本发明第四方面的第八种可能的实现方式中,所述锁申请模块具体用于:In an eighth possible implementation manner of the fourth aspect of the present invention, the lock application module is specifically configured to:

向所述锁管理装置发送所述目标文件对应的写锁申请请求,以使所述锁管理装置向所述第二节点回收所述写锁;sending a write lock application request corresponding to the target file to the lock management device, so that the lock management device reclaims the write lock to the second node;

接收所述锁管理装置发送的写锁授权响应。Receive the write lock authorization response sent by the lock management device.

本发明第五方面一种锁管理装置,包括:A fifth aspect of the present invention is a lock management device, comprising:

接收模块,用于接收所述第一节点发送的目标文件对应的写锁申请请求,所述写锁申请请求是客户端对所述目标文件进行写访问时,所述第一节点向所述锁管理装置发送的;The receiving module is configured to receive the write lock application request corresponding to the target file sent by the first node, the write lock application request is when the client performs write access to the target file, the first node sends to the lock sent by the management device;

确定模块,用于确定第二节点申请过所述目标文件对应的写锁,所述第二节点对所述目标文件进行过最新修改;A determining module, configured to determine that the second node has applied for a write lock corresponding to the target file, and that the second node has made the latest modification to the target file;

发送模块,用于向所述第二节点发送所述目标文件对应的写锁回收命令,向所述第二节点回收所述目标文件对应的写锁,所述锁管理装置在向所述第二节点回收所述目标文件对应的写锁时,并不对所述第二节点的缓存中的所述目标文件的数据写盘和无效;a sending module, configured to send a write lock recovery command corresponding to the target file to the second node, and recover the write lock corresponding to the target file from the second node; When the node reclaims the write lock corresponding to the target file, it does not write and invalidate the data of the target file in the cache of the second node;

所述发送模块还用于:向所述第一节点发送写锁授权响应,所述写锁中包括所述第二节点的信息。The sending module is further configured to: send a write lock authorization response to the first node, where the write lock includes information of the second node.

在本发明第五方面的第一种可能的实现方式中,所述接收模块还用于:In a first possible implementation manner of the fifth aspect of the present invention, the receiving module is further configured to:

接收所述第一节点发送的所述目标文件对应的读锁申请请求;receiving a read lock application request corresponding to the target file sent by the first node;

所述确定模块还用于:确定所述第一节点申请过所述目标文件对应的写锁,所述第一节点对所述目标文件进行过最新修改;The determining module is further configured to: determine that the first node has applied for a write lock corresponding to the target file, and the first node has made the latest modification to the target file;

所述发送模块还用于:向所述第一节点发送所述目标文件对应的写锁回收命令,向所述第一节点回收所述目标文件对应的写锁,所述锁管理装置在向所述第一节点回收所述目标文件对应的写锁时,并不对所述第一节点的缓存中的所述目标文件的数据写盘和无效;The sending module is further configured to: send a write lock recovery command corresponding to the target file to the first node, and recover the write lock corresponding to the target file from the first node, and the lock management device sends the command to the first node. When the first node reclaims the write lock corresponding to the target file, it does not write and invalidate the data of the target file in the cache of the first node;

所述发送模块还用于:向所述第一节点发送读锁授权响应,所述读锁中包括所述第一节点的信息,以使所述第一节点从所述第一节点的缓存中读取所述目标文件。The sending module is further configured to: send a read lock authorization response to the first node, where the read lock includes information of the first node, so that the first node retrieves the first node from the cache of the first node Read the object file.

在本发明第五方面的第二种可能的实现方式中,所述接收模块还用于:In a second possible implementation manner of the fifth aspect of the present invention, the receiving module is further configured to:

接收所述第二节点发送的所述目标文件对应的读锁或写锁申请请求;receiving a read lock or write lock application request corresponding to the target file sent by the second node;

所述确定模块还用于:确定所述第一节点申请过所述目标文件对应的写锁,所述第一节点对所述目标文件进行过最新修改;The determining module is further configured to: determine that the first node has applied for a write lock corresponding to the target file, and the first node has made the latest modification to the target file;

所述发送模块还用于:向所述第一节点发送所述目标文件对应的写锁回收命令,向所述第一节点回收所述目标文件对应的写锁,所述锁管理装置在向所述第一节点回收所述目标文件对应的写锁时,并不对所述第一节点的缓存中的所述目标文件的数据写盘和无效;The sending module is further configured to: send a write lock recovery command corresponding to the target file to the first node, and recover the write lock corresponding to the target file from the first node, and the lock management device sends the command to the first node. When the first node reclaims the write lock corresponding to the target file, it does not write and invalidate the data of the target file in the cache of the first node;

所述发送模块还用于:向所述第二节点发送读锁或写锁授权响应,所述读锁或写锁中包括所述第一节点的信息,以使所述第二节点根据所述第一节点的信息获取最新全局缓存表。The sending module is further configured to: send a read lock or write lock authorization response to the second node, and the read lock or write lock includes the information of the first node, so that the second node according to the The information of the first node is obtained from the latest global cache table.

本发明第六方面提供一种节点,所述节点为第二节点,包括:A sixth aspect of the present invention provides a node, where the node is a second node, including:

接收模块,用于接收所述第一节点发送的全局缓存表同步请求消息;a receiving module, configured to receive the global cache table synchronization request message sent by the first node;

发送模块,用于根据所述全局缓存表同步请求消息,向所述第一节点返回全局缓存表同步响应消息,所述全局缓存表同步响应消息中包含所述最新全局缓存表,所述最新全局缓存表中保存有所述第二节点对所述目标文件的最新修改记录。A sending module, configured to return a global cache table synchronization response message to the first node according to the global cache table synchronization request message, where the global cache table synchronization response message includes the latest global cache table, and the latest global cache table The latest modification record of the target file by the second node is saved in the cache table.

在本发明第六方面的第一种可能的实现方式中,所述接收模块还用于:In a first possible implementation manner of the sixth aspect of the present invention, the receiving module is further configured to:

接收所述第一节点发送的数据同步请求消息,所述数据同步请求消息为所述第一节点根据所述最新全局缓存表中所述第二节点对所述目标文件的最新修改记录发送的;receiving a data synchronization request message sent by the first node, where the data synchronization request message is sent by the first node according to the latest modification record of the target file by the second node in the latest global cache table;

所述发送模块还用于:根据所述数据同步请求消息,向所述第一节点返回数据同步响应消息,所述数据同步响应消息中包含所述第二节点对所述目标文件的修改数据。The sending module is further configured to: return a data synchronization response message to the first node according to the data synchronization request message, and the data synchronization response message includes modification data of the target file by the second node.

本发明实施例提供一种分布式集群文件系统的缓存同步方法和设备,通过为目标文件定义一个全局缓存表,全局缓存表中包含有各节点对目标文件的修改记录,当第一节点对目标文件进行写访问时,根据写锁中包含对目标文件进行过最新修改的第二节点的信息获取到最新全局缓存表,根据最新全局缓存表中第二节点对目标文件的最新修改记录获取到第二节点对目标文件的修改数据,当两个节点同时交互写目标文件的不同数据的情况下各自缓存中的数据都是有效的,后续的读可以直接从缓存中获取,当两个节点交互写相同数据的情况下,需要从另一个节点获取修改数据,数据在网络间的传递比一次写盘和读盘效率高很多,所以不管是交叉修改相同数据还是不同数据,集群文件系统性能相较现有方式都有较大提升。Embodiments of the present invention provide a cache synchronization method and device for a distributed cluster file system. By defining a global cache table for the target file, the global cache table contains the modification records of each node to the target file. When the first node updates the target file When the file is written and accessed, the latest global cache table is obtained according to the information of the second node that has carried out the latest modification to the target file in the write lock, and the second node is obtained according to the latest modification record of the target file by the second node in the latest global cache table. The modification data of the target file by the two nodes, when two nodes write different data of the target file interactively at the same time, the data in the respective caches are valid, and subsequent reads can be obtained directly from the cache, when the two nodes write interactively In the case of the same data, the modified data needs to be obtained from another node. The transmission of data between networks is much more efficient than writing and reading disks once. Therefore, whether the same data or different data is cross-modified, the performance of the cluster file system is better than that of the current one. There are major improvements in both ways.

附图说明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 These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为现有技术中文件的读写流程示意图;Fig. 1 is a schematic diagram of the process of reading and writing files in the prior art;

图2为分布式集群文件系统的物理架构示意图;Figure 2 is a schematic diagram of the physical architecture of the distributed cluster file system;

图3为本发明分布式集群文件系统的缓存同步方法实施例一的流程图;3 is a flow chart of Embodiment 1 of the cache synchronization method of the distributed cluster file system of the present invention;

图4为本发明分布式集群文件系统的缓存同步方法实施例二的流程图;4 is a flow chart of Embodiment 2 of the cache synchronization method of the distributed cluster file system of the present invention;

图5为本发明分布式集群文件系统的缓存同步方法实施例三的流程图;5 is a flow chart of Embodiment 3 of the cache synchronization method of the distributed cluster file system of the present invention;

图6为本发明分布式集群文件系统的缓存同步方法实施例四的流程图;6 is a flow chart of Embodiment 4 of the cache synchronization method of the distributed cluster file system of the present invention;

图7为本发明第一节点的结构示意图;Fig. 7 is a schematic structural diagram of the first node of the present invention;

图8为本发明第一节点的实施例二的结构示意图;FIG. 8 is a schematic structural diagram of Embodiment 2 of the first node of the present invention;

图9为本发明锁管理装置的实施例一的结构示意图;9 is a schematic structural diagram of Embodiment 1 of the lock management device of the present invention;

图10为本发明第二节点实施例一的结构示意图;FIG. 10 is a schematic structural diagram of Embodiment 1 of the second node of the present invention;

图11为本发明第一节点实施例三的结构示意图;Fig. 11 is a schematic structural diagram of Embodiment 3 of the first node of the present invention;

图12为本发明锁管理装置实施例二的结构示意图;Fig. 12 is a schematic structural diagram of Embodiment 2 of the lock management device of the present invention;

图13为本发明第二节点实施例二的结构示意图。FIG. 13 is a schematic structural diagram of Embodiment 2 of the second node of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

在介绍本发明各实施例之前,先简单介绍一下分布式集群文件系统,图2为分布式集群文件系统的物理架构示意图,如图2所示,分布式集群文件系统有六个服务器,分别为节点1、节点2、节点3、存储节点1、存储节点2、存储节点3,节点1、节点2和节点3主要用来处理客户端发送的数据读请求和写请求等操作,存储节点1、存储节点2、存储节点3主要用来存储数据,节点1、节点2、节点3存储的数据都可以存储在存储节点1、存储节点2、存储节点3上,图2所示的本分布式集群文件系统的物理架构只是用来举例说明,实际的应用过程中,还可以有更多的节点,而且本发明各实施例提供的方法适用于所有的分布式集群文件系统,并不受分布式集群文件系统的硬件结构的影响。Before introducing the various embodiments of the present invention, first briefly introduce the distributed cluster file system. Figure 2 is a schematic diagram of the physical architecture of the distributed cluster file system. As shown in Figure 2, the distributed cluster file system has six servers, respectively Node 1, Node 2, Node 3, Storage Node 1, Storage Node 2, Storage Node 3, Node 1, Node 2, and Node 3 are mainly used to process data read requests and write requests sent by clients, and Storage Node 1, Storage node 2 and storage node 3 are mainly used to store data. The data stored by node 1, node 2 and node 3 can all be stored on storage node 1, storage node 2 and storage node 3. The distributed cluster shown in Figure 2 The physical structure of the file system is only used as an example. In the actual application process, there may be more nodes, and the methods provided by the embodiments of the present invention are applicable to all distributed cluster file systems and are not affected by the distributed cluster file system. The impact of the hardware structure of the file system.

分布式集群文件系统具有全局统一的命名空间,存储空间对于各个节点都是可见并且相同的,元数据和数据可以分布到集群中任何节点上,当然,从任意节点也可以访问到系统中存储的所有数据,以图2为例,存储节点1、存储节点2、存储节点3共同构成了存储空间,节点1、节点2、节点3都可以访问这三个存储节点上的所有数据。对于分布式集群文件系统来说,要保证数据的一致性必须要用到分布式锁,分布式锁以下简称锁,访问数据之前,节点首先需要向锁管理装置申请此数据对应的文件的锁,锁管理装置用于管理系统中所有文件的对应锁,负责为各节点分配锁,以及向各节点回收锁。每个文件都有一个读锁和写锁,实际上一个文件的读锁和写锁可以认为是一个锁,锁管理装置在向节点授权锁的时候,在锁中设置有级别,写锁的级别高于读锁的级别,如果节点申请的是写锁,则将锁的级别设置为写锁对应的级别,锁中还包括锁授权的对象,如果锁要授权给第一节点,则锁管理装置在锁中授权对象中写入第一节点的信息。其中,读锁可以并发,写锁为独占,即多个节点可以并发读同一部分数据,但若某个节点正在修改该部分数据,其他节点必须等到修改完成之后才能访问该部分数据。The distributed cluster file system has a globally unified namespace. The storage space is visible and the same to each node. Metadata and data can be distributed to any node in the cluster. Of course, any node can also access the system stored in the system. For all data, take Figure 2 as an example, storage node 1, storage node 2, and storage node 3 together constitute a storage space, and nodes 1, 2, and 3 can access all data on these three storage nodes. For distributed cluster file systems, distributed locks must be used to ensure data consistency. Distributed locks are hereinafter referred to as locks. Before accessing data, nodes first need to apply to the lock management device for the lock of the file corresponding to the data. The lock management device is used to manage the corresponding locks of all files in the system, and is responsible for allocating locks to each node and reclaiming locks to each node. Each file has a read lock and a write lock. In fact, the read lock and write lock of a file can be regarded as a lock. When the lock management device authorizes the lock to the node, it sets a level in the lock, and the level of the write lock It is higher than the level of read lock. If the node applies for a write lock, set the lock level to the level corresponding to the write lock. The lock also includes the object authorized by the lock. If the lock is to be authorized to the first node, the lock management device Write the information of the first node in the authorization object in the lock. Among them, the read lock can be concurrent, and the write lock is exclusive, that is, multiple nodes can read the same part of the data concurrently, but if a node is modifying the part of the data, other nodes must wait until the modification is completed before they can access the part of the data.

图3为本发明分布式集群文件系统的缓存同步方法实施例一的流程图,如图3所示,本实施例提供的方法可以包括以下步骤:FIG. 3 is a flow chart of Embodiment 1 of the cache synchronization method for a distributed cluster file system according to the present invention. As shown in FIG. 3 , the method provided in this embodiment may include the following steps:

步骤101、当客户端对第一节点上的目标文件进行写访问时,第一节点向锁管理装置申请目标文件对应的写锁。Step 101. When the client performs write access to the target file on the first node, the first node applies to the lock management device for a write lock corresponding to the target file.

当客户端对第一节点上的目标文件进行写访问时,第一节点首先向锁管理装置申请目标文件对应的写锁,本实施例中,锁管理装置在向第一节点授权该写锁时,在该写锁中包含对目标文件进行过最新修改的第二节点的信息。When the client performs write access to the target file on the first node, the first node first applies to the lock management device for the write lock corresponding to the target file. In this embodiment, when the lock management device authorizes the write lock to the first node , the write lock includes the information of the second node that has made the latest modification to the target file.

其中,第一节点向锁管理装置申请目标文件对应的写锁,具体为:第一节点向锁管理装置发送目标文件对应的写锁申请请求,以使锁管理装置向第二节点回收该目标文件的写锁。锁管理装置接收第一节点发送的目标文件对应的写锁申请请求后,确定是否有其他节点申请过目标文件对应的写锁,锁管理装置发现第二节点申请过目标文件对应的写锁,第二节点对目标文件进行过最新修改,则锁管理装置向第二节点发送目标文件对应的写锁回收命令,第二节点在接收到锁管理装置发送的写锁回收命令后,准备锁归还,和现有技术不同的是,第二节点在进行锁归还时,并不将第二节点的缓存中的数据下盘和无效,第二节点缓存中的数据仍是有效的。第二节点将写锁归还给锁管理装置,锁管理装置向第一节点发送写锁授权响应,写锁中包括第二节点的信息,第一节点接收锁管理装置发送的写锁授权响应。Wherein, the first node applies to the lock management device for a write lock corresponding to the target file, specifically: the first node sends a write lock application request corresponding to the target file to the lock management device, so that the lock management device reclaims the target file from the second node The write lock. After the lock management device receives the write lock application request corresponding to the target file sent by the first node, it determines whether other nodes have applied for the write lock corresponding to the target file, and the lock management device finds that the second node has applied for the write lock corresponding to the target file. The second node has made the latest modification to the target file, and the lock management device sends a write lock recovery command corresponding to the target file to the second node, and the second node prepares to return the lock after receiving the write lock recovery command sent by the lock management device, and The difference in the prior art is that when the second node returns the lock, it does not offload and invalidate the data in the cache of the second node, and the data in the cache of the second node is still valid. The second node returns the write lock to the lock management device, the lock management device sends a write lock authorization response to the first node, the write lock includes the information of the second node, and the first node receives the write lock authorization response sent by the lock management device.

步骤102、第一节点根据第二节点的信息获取目标文件对应的最新全局缓存表。Step 102, the first node obtains the latest global cache table corresponding to the target file according to the information of the second node.

首先,介绍一下全局缓存表,本发明各实施例通过在集群中为每个文件建立一个全局缓存表(Global Cache Table,简称GCT),即最新数据在集群中的缓存分布表,此表记录该文件在集群中的修改情况,随着读锁和写锁更新到各个节点上,当某一节点对文件进行了修改,则将该节点对文件的修改记录更新到全局缓存表中,后续当其他节点访问该文件时,首先获取该文件对应最新的全局缓存表,该最新全局缓存表保存在对文件进行过最新修改的节点上。本实施例中,目标文件指客户端当前要访问的文件,第一节点根据第二节点的信息地获取目标文件对应的最新全局缓存表,该全局缓存表中记录有第二节点对目标文件的最新修改记录,例如第二节点对目标文件中的哪个数据块进行过修改。First, introduce the global cache table. Each embodiment of the present invention establishes a global cache table (Global Cache Table, GCT for short) for each file in the cluster, that is, the cache distribution table of the latest data in the cluster. This table records the The modification of the file in the cluster is updated to each node with the read lock and write lock. When a node modifies the file, the modification record of the node to the file is updated to the global cache table, and other When a node accesses the file, it first obtains the latest global cache table corresponding to the file, and the latest global cache table is stored on the node that has recently modified the file. In this embodiment, the target file refers to the file currently to be accessed by the client, and the first node obtains the latest global cache table corresponding to the target file according to the information of the second node. The latest modification record, for example, which data block in the target file has been modified by the second node.

第一节点根据第二节点的信息获取最新全局缓存表,具体为:第一节点向第二节点发送全局缓存表同步请求消息,第二节点接收到第一节点发送的全局缓存表同步请求消息后,向第一节点返回全局表表同步请求响应,第一节点接收第二节点发送的全局缓存表同步响应消息,全局缓存表同步响应消息中包含最新全局缓存表,最新全局缓存表中保存有第二节点对目标文件的最新修改记录。The first node obtains the latest global cache table according to the information of the second node, specifically: the first node sends a global cache table synchronization request message to the second node, and after the second node receives the global cache table synchronization request message sent by the first node , return the global table table synchronization request response to the first node, the first node receives the global cache table synchronization response message sent by the second node, the global cache table synchronization response message contains the latest global cache table, and the latest global cache table stores the first The latest modification record of the target file by the second node.

步骤103、第一节点根据第二节点对目标文件的最新修改记录对目标文件进行修改,将修改后的数据保存在第一节点的缓存中,并将第一节点对目标文件的修改记录更新到最新全局缓存表。Step 103, the first node modifies the target file according to the latest modification record of the second node to the target file, saves the modified data in the buffer memory of the first node, and updates the modification record of the target file by the first node to The latest global cache table.

第一节点获取到最新全局缓存表后,根据该最新全局缓存表中记录的第二节点对目标文件的最新修改记录对目标文件进行修改,具体为,第一节点根据第二节点对目标文件的最新修改记录确定是否获取第二节点对目标文件的修改数据,若是,即第一节点确定出需要获取第二节点对目标文件的修改数据,则第一节点获取第二节点对目标文件的修改数据,将获取到的目标文件的修改数据存储在第一节点的缓存中,使得第一节点和第二节点上存储的目标文件的数据保持一致,然后,第一节点从第一节点的缓存中读取数据,对目标文件进行修改。若否,即第一节点和第二节点的上存储的目标文件的数据一致,则第一节点直接从第一节点的缓存中读取数据,对目标文件进行修改。After the first node obtains the latest global cache table, it modifies the target file according to the latest modification record of the target file recorded by the second node in the latest global cache table, specifically, the first node modifies the target file according to the second node's The latest modification record determines whether to obtain the modification data of the target file by the second node. If so, that is, the first node determines that it needs to obtain the modification data of the target file by the second node, then the first node obtains the modification data of the target file by the second node , store the modified data of the obtained target file in the cache of the first node, so that the data of the target file stored on the first node and the second node are consistent, and then, the first node reads from the cache of the first node Get the data and modify the target file. If not, that is, the data of the target file stored on the first node and the second node are consistent, the first node directly reads the data from the cache of the first node, and modifies the target file.

一般情况下,目标文件包括至少两个数据块,第一节点和第二节点交替对目标文件进行修改时,可能是对目标文件中的同一数据块进行修改,也可能是对不同的数据块进行修改,如果是对同一数据块进行修改,当第二节点修改后,第一节点再次修改时,第一节点上此时保存的该同一数据块的数据不是最新的,最新的数据保存在第二节点上,这种情况下,第一节点需要从第二节点上获取第二节点对该同一数据块的修改数据,得到该同一数据块的最新修改数据;如果第一节点要修改的数据和第二节点要修改的数据不是同一个数据块,则不需要从第二节点处获取第二节点对目标文件的修改数据。Generally, the target file includes at least two data blocks. When the first node and the second node modify the target file alternately, it may be to modify the same data block in the target file, or to modify different data blocks. Modification, if the same data block is modified, when the second node is modified and the first node is modified again, the data of the same data block saved on the first node at this time is not the latest, and the latest data is saved in the second In this case, the first node needs to obtain the modification data of the same data block from the second node to obtain the latest modification data of the same data block; if the data to be modified by the first node and the The data to be modified by the second node is not the same data block, so it is not necessary to obtain the modification data of the target file by the second node from the second node.

本实施例中,第二节点对目标文件的最新修改记录中可以包括:第二节点对目标文件进行过最新修改的数据块的信息。第一节点根据第二节点对目标文件的最新修改记录确定是否获取第二节点对目标文件的修改数据,具体为:第一节点根据第二节点对目标文件进行过最新修改的数据块的信息,确定第一节点对目标文件进行写访问的数据块与第二节点对目标文件进行过最新修改的数据块是否为同一个数据块;若是,即第一节点对目标文件进行写访问的数据块与第二节点对目标文件进行过最新修改的数据块是同一个数据块,则第一节点获取第二节点对目标文件的修改数据。如果第一节点对目标文件进行写访问的数据块与第二节点对目标文件进行过最新修改的数据块不是同一个数据块,则第一节点不需要获取第二节点对目标文件的修改数据,直接从第一节点的缓存中读取数据进行修改。通过该方法使得节点间的数据交互是根据需要来进行传递的,如果对不同的数据块进行写或读操作,节点间仅仅交互最新全局缓存表就可以了,避免了不必要的数据传输,占用的网络开销少。In this embodiment, the latest modification record of the target file by the second node may include: information of the data block that the second node has recently modified for the target file. The first node determines whether to obtain the modification data of the target file by the second node according to the latest modification record of the second node to the target file, specifically: the first node performs the latest modification of the target file according to the information of the second node, Determine whether the data block that the first node performs write access to the target file is the same data block as the second node that has recently modified the target file; if so, the data block that the first node performs write access to the target file is the same as The data block that the second node has recently modified on the target file is the same data block, and the first node obtains the modification data on the target file by the second node. If the data block that the first node performs write access to the target file is not the same data block as the data block that the second node has recently modified the target file, then the first node does not need to obtain the modification data of the second node to the target file, Read data directly from the cache of the first node for modification. Through this method, the data interaction between nodes is transmitted according to the needs. If different data blocks are written or read, only the latest global cache table can be exchanged between nodes, which avoids unnecessary data transmission and occupies The network overhead is low.

本实施例中,第一节点根据第二节点对目标文件的最新修改记录获取第二节点对目标文件的修改数据,具体为:第一节点根据最新全局缓存表中第二节点对目标文件的最新修改记录,向第二节点发送数据同步请求消息,第二节点接收到数据同步请求消息后,向第一节点返回数据同步响应消息,第一节点接收第二节点发送的数据同步响应消息,数据同步响应消息中包含第二节点对目标文件的修改数据。这里,数据同步请求消息用于向第二节点获取第二节点对目标文件修改后的数据,一种方式中,第一节点可以只获取第二节点对目标文件修改的数据,如第二节点只修改了目标文件的第一数据块中的数据,则第一节点只获取第一数块对应修改后的数据即可,不需要获取目标文件的所有数据,这样可以减少第一节点和第二节点之间数据的传输。当然,也可以获取第二节点上存储的整个目标文件的数据,本发明并不以此为限。第一节点通过从第二节点上获取第二节点对第一数据块的修改数据,使得第一节点上的缓存中存储的目标文件的数据为最新的数据,从而使得第一节点和第二节点之间的数据能够同步,保证各节点上存储的该目标文件的数据都一致。In this embodiment, the first node obtains the modification data of the target file by the second node according to the latest modification record of the second node to the target file, specifically: the first node obtains the latest modification data of the target file by the second node in the latest global cache table Modify the record and send a data synchronization request message to the second node. After receiving the data synchronization request message, the second node returns a data synchronization response message to the first node. The first node receives the data synchronization response message sent by the second node, and the data synchronization The response message includes modification data of the target file by the second node. Here, the data synchronization request message is used to obtain the data modified by the second node to the target file from the second node. In one mode, the first node can only obtain the data modified by the second node to the target file, such as the second node only If the data in the first data block of the target file is modified, the first node only needs to obtain the modified data corresponding to the first block, and does not need to obtain all the data of the target file, which can reduce the number of the first node and the second node transfer of data between them. Certainly, the data of the entire target file stored on the second node may also be acquired, and the present invention is not limited thereto. The first node obtains the modification data of the first data block by the second node from the second node, so that the data of the target file stored in the cache on the first node is the latest data, so that the first node and the second node The data between them can be synchronized to ensure that the data of the target file stored on each node is consistent.

步骤104、第一节点对目标文件进行写操作,将修改后的数据保存在第一节点的缓存中,并将第一节点对目标文件的修改记录更新到最新全局缓存表。Step 104, the first node writes the target file, saves the modified data in the cache of the first node, and updates the modification record of the target file by the first node to the latest global cache table.

当第一节点确定第一节点上保存的全局缓存表和目标文件的数据都为最新时,从第一节点的缓存中读取目标文件,对目标文件进行写操作,将修改后的数据保存在第一节点的缓存中,在对目标文件修改成功后,第一节点将第一节点对目标文件的修改记录更新到最新全局缓存表,由于写访问,会对目标文件的数据进行修改,所以各节点在对目标文件进行修改后,都要更新自身存储的全局缓存表。When the first node determines that the data in the global cache table and the target file saved on the first node are all up-to-date, it reads the target file from the cache of the first node, writes the target file, and saves the modified data in In the cache of the first node, after successfully modifying the target file, the first node updates the modification record of the target file to the latest global cache table. Due to write access, the data of the target file will be modified, so each After the node modifies the target file, it must update the global cache table stored by itself.

本实施例提供的方法,通过为目标文件定义一个全局缓存表,全局缓存表中包含有各节点对目标文件的修改记录,第一节点对目标文件进行写访问时,根据写锁中包含对目标文件进行过最新修改的第二节点的信息获取到最新全局缓存表,根据最新全局缓存表中第二节点对目标文件的最新修改记录获取到第二节点对目标文件的修改数据,当两个节点同时交互写目标文件的不同数据的情况下各自缓存中的数据都是有效的,后续的读可以直接从缓存中获取,当两个节点交互写相同数据的情况下,需要从另一个节点获取修改数据,数据在网络间的传递比一次写盘和读盘效率高很多,所以不管是交叉修改相同数据还是不同数据,集群文件系统性能相较现有方式都有较大提升。In the method provided by this embodiment, by defining a global cache table for the target file, the global cache table contains the modification records of each node to the target file, and when the first node performs write access to the target file, it The information of the second node whose file has been newly modified is obtained from the latest global cache table, and the modification data of the second node to the target file is obtained according to the latest modification record of the second node to the target file in the latest global cache table. When two nodes In the case of interactively writing different data of the target file at the same time, the data in each cache is valid, and subsequent reads can be obtained directly from the cache. When two nodes write the same data interactively, they need to be modified from another node. Data, the transfer of data between networks is much more efficient than one-time disk writing and disk reading, so whether it is cross-modification of the same data or different data, the performance of the cluster file system has been greatly improved compared with the existing methods.

在实施例一的基础上,在本发明另一实施例中,步骤104之后,还可以包括以下步骤:当第一节点对目标文件进行读访问时,向锁管理装置申请目标文件对应的读锁,读锁中包含对目标文件进行过最新修改的第一节点的信息;第一节点从第一节点的缓存中读取目标文件。当第一节点对目标文件进行修改之后,若第一节点又申请对目标文件进行读访问,第一节点首先向锁管理装置申请目标文件对应的读锁,锁管理装置在接收到第一节点发送的读锁申请请求后,并不对第一节点上的缓存进行写盘,第一节点缓存中的数据仍是有效的,锁管理装置将读锁授权给第一节点,该读锁中包含对目标文件进行过最新修改的第一节点的信息,第一节点根据读锁发现自己是对目标文件进行过最新修改的节点,因此,第一节点的缓存中存储的目标文件的数据是有效的,第一节点从缓存中读取目标文件。On the basis of Embodiment 1, in another embodiment of the present invention, after step 104, the following steps may also be included: when the first node performs read access to the target file, apply to the lock management device for a read lock corresponding to the target file , the read lock includes information about the first node that has recently modified the target file; the first node reads the target file from the cache of the first node. After the first node modifies the target file, if the first node applies for read access to the target file again, the first node first applies to the lock management device for a read lock corresponding to the target file, and the lock management device receives the first node's send After the read lock application request, the cache on the first node is not written to the disk, the data in the cache of the first node is still valid, and the lock management device authorizes the read lock to the first node. The information of the first node where the file has been newly modified. The first node finds that it is the node that has made the latest modification to the target file according to the read lock. Therefore, the data of the target file stored in the cache of the first node is valid. A node reads the object file from the cache.

在实施例一的基础上,在本发明又一实施例中,步骤104之后,还可以包括以下步骤:第一节点接收第二节点发送的全局缓存表同步请求消息,该全局缓存表同步请求消息为第二节点需要对目标文件进行读访问或写访问时向第一节点发送的。具体的,在第一节点对目标文件进行修改之后,如果第二节点需要对目标文件进行读访问或写访问时,第二节点首先向锁管理装置申请目标文件对应的读锁或写锁,锁管理装置在接收到第二节点发送的读锁或写锁申请请求后,并不对第一节点上的缓存进行写盘,第一节点缓存中的数据仍是有效的,锁管理装置将读锁或写锁授权给第二节点,该读锁或写锁中包含对目标文件进行过最新修改的第一节点的信息,第二节点根据第一节点的信息向第一节点发送全局缓存表同步请求消息,第一节点接收到全局缓表同步请求消息后,向第二节点返回全局缓存表同步响应消息,全局缓存表同步响应消息中包含更新后的最新全局缓存表根据更新后的最新全局缓存表。On the basis of Embodiment 1, in yet another embodiment of the present invention, after step 104, the following steps may also be included: the first node receives the global cache table synchronization request message sent by the second node, and the global cache table synchronization request message It is sent to the first node when the second node needs to perform read or write access to the target file. Specifically, after the first node modifies the target file, if the second node needs to perform read or write access to the target file, the second node first applies to the lock management device for a read lock or write lock corresponding to the target file, and the lock After the management device receives the read lock or write lock application request sent by the second node, it does not write to the cache on the first node, and the data in the cache of the first node is still valid, and the lock management device will read or write the lock. The write lock is authorized to the second node, and the read lock or write lock contains the information of the first node that has made the latest modification to the target file, and the second node sends a global cache table synchronization request message to the first node according to the information of the first node After receiving the global buffer table synchronization request message, the first node returns a global cache table synchronization response message to the second node, and the global cache table synchronization response message includes the updated latest global cache table according to the updated latest global cache table.

第二节点在获取到该更新后的最新全局缓存表后,将该更新后的最新全局缓存表作为最新的全局缓存表,根据最新全局缓存表中第一节点对目标文件的修改记录,确定第一节点对目标文件的修改数据是否与自己要访问的目标文件的数据相同,若相同,则说明第一节点上保存的数据是最新的,第二节点向第一节点发送数据同步请求,第一节点接收第二节点发送的数据同步请求,数据同步请求消息为第二节点根据更新后的最新全局缓存表中第一节点对目标文件的修改记录发送的。After obtaining the updated latest global cache table, the second node takes the updated global cache table as the latest global cache table, and determines the first node according to the modification record of the target file in the latest global cache table. Whether the data modified by a node to the target file is the same as the data of the target file to be accessed by itself, if they are the same, it means that the data saved on the first node is the latest, and the second node sends a data synchronization request to the first node, the first The node receives the data synchronization request sent by the second node, and the data synchronization request message is sent by the second node according to the modification record of the first node to the target file in the updated latest global cache table.

第一节点向第二节点发送数据同步响应,数据同步响应中包括第一节点对目标文件的修改数据,以使第二节点将第一节点对目标文件的修改数据保存在第二节点的缓存中,当第二节点对数据进行读访问或写访问时可以从第二节点的缓存中读取目标文件。The first node sends a data synchronization response to the second node, and the data synchronization response includes the modification data of the first node to the target file, so that the second node saves the modification data of the first node to the target file in the cache of the second node , when the second node performs read access or write access to the data, the target file may be read from the cache of the second node.

图4为本发明分布式集群文件系统的缓存同步方法实施例二的流程图,如图4所示,本实施例提供的方法包括以下步骤:FIG. 4 is a flowchart of Embodiment 2 of the cache synchronization method of the distributed cluster file system of the present invention. As shown in FIG. 4, the method provided in this embodiment includes the following steps:

步骤201、锁管理装置接收第一节点发送的目标文件对应的写锁申请请求,写锁申请请求是客户端对目标文件进行写访问时,第一节点向锁管理装置发送的。Step 201. The lock management device receives a write lock application request corresponding to the target file sent by the first node. The write lock application request is sent by the first node to the lock management device when the client performs write access to the target file.

当客户端对目标文件进行写访问时,第一节点首先向锁管理装置申请目标文件对应的写锁。When the client performs write access to the target file, the first node first applies to the lock management device for a write lock corresponding to the target file.

步骤202、锁管理装置确定第二节点申请过目标文件对应的写锁,对目标文件进行过最新修改,则锁管理装置向第二节点发送目标文件对应的写锁回收命令,向第二节点回收目标文件对应的写锁,锁管理装置在向第二节点回收目标文件对应的写锁时,并不对第二节点的缓存中的目标文件的数据写盘和无效。Step 202, the lock management device determines that the second node has applied for the write lock corresponding to the target file, and has made the latest modification to the target file, then the lock management device sends the write lock recovery command corresponding to the target file to the second node, and reclaims the write lock to the second node. For the write lock corresponding to the target file, when the lock management device reclaims the write lock corresponding to the target file from the second node, it does not write and invalidate the data of the target file in the cache of the second node.

锁管理装置在接收到第一节点发送的目标文件对应的写锁申请请求后,确定是否有其他节点申请过该目标文件对应的写锁,如果锁管理装置确定第二节点申请过目标文件对应的写锁,对目标文件进行过最新修改,则锁管理装置向第二节点回收该目标文件对应的写锁。和现有技术中不同,锁管理装置在向第二节点回收目标文件对应的写锁时,并不对第二节点的缓存中的目标文件的数据写盘和无效,因此,第二节点的缓存中存储的目标文件的数据仍是有效的,后续如果第二节点再次访问该目标文件中时,不需要从磁盘中读取,直接从缓存中读取目标文件中需要的数据即可。After receiving the write lock application request corresponding to the target file sent by the first node, the lock management device determines whether other nodes have applied for the write lock corresponding to the target file. If the lock management device determines that the second node has applied for the write lock corresponding to the target file For a write lock, if the target file has been newly modified, the lock management device reclaims the write lock corresponding to the target file from the second node. Different from the prior art, when the lock management device reclaims the write lock corresponding to the target file from the second node, it does not write and invalidate the data of the target file in the cache of the second node. Therefore, the cache of the second node The stored data of the target file is still valid, and if the second node accesses the target file again later, it does not need to read from the disk, but directly reads the required data in the target file from the cache.

步骤203、锁管理装置向第一节点发送写锁授权响应,写锁中包括第二节点的信息。Step 203, the lock management device sends a write lock authorization response to the first node, and the write lock includes information of the second node.

锁管理装置从第二节点回收目标文件对应的写锁后,向第一节点发送写锁授权响应,将目标文件对应的写锁授权给第一节点,并在写锁中包括对目标文件进行过最新修改的第二节点的信息。第一节点在获得写锁后,发现第二节点对目标文件进行过写锁,则第一节点确定出自身缓存中保存的目标文件的数据不是最新的,因此,第一节点需要从第二节点处获取最新全局缓存表,最新全局缓存表中保存有第二节点对目标文件的最新修改记录。第一节点根据第二节点对目标文件的最新修改记录确定是否需要获取第二节点对目标文件的修改数据。After the lock management device reclaims the write lock corresponding to the target file from the second node, it sends a write lock authorization response to the first node, authorizes the write lock corresponding to the target file to the first node, and includes the write lock on the target file in the write lock. Information about the last modified second node. After the first node obtains the write lock, it finds that the second node has applied the write lock to the target file, then the first node determines that the data of the target file stored in its own cache is not up-to-date. The latest global cache table is obtained at the location, and the latest modification record of the target file by the second node is stored in the latest global cache table. The first node determines whether to acquire modification data of the target file by the second node according to the latest modification record of the target file by the second node.

本实施例提供的方法,当第一节点向锁管理装置申请目标文件对应的写锁时,锁管理装置确定第二节点也申请过目标文件对应的写锁,锁管理装置在向第二节点回收目标文件对应的写锁时,并不对第二节点缓存中的数据进行写盘和无效,第二节点缓存中的数据仍是有效,从而使得第二节点再次对目标文件进行修改时,可以从第二节点的缓存中读取数据,即使第一节点和第二节点交替对目标文件进行修改,两个节点的缓存中的数据都是有效的,避免了频繁的读盘和写盘。In the method provided in this embodiment, when the first node applies to the lock management device for the write lock corresponding to the target file, the lock management device determines that the second node has also applied for the write lock corresponding to the target file, and the lock management device recovers the lock from the second node. When the write lock corresponding to the target file is applied, the data in the cache of the second node is not written and invalidated, and the data in the cache of the second node is still valid, so that when the second node modifies the target file again, it can be accessed from the second node. The data is read in the cache of the two nodes, even if the first node and the second node modify the target file alternately, the data in the caches of the two nodes are valid, avoiding frequent disk reading and writing.

本实施例锁管理装置向第一节点发送写锁授权响应之后,如果第一节点需要对目标文件进行读访问,则本实施例提供的方法还可以包括以下步骤:锁管理装置接收第一节点发送的目标文件对应的读锁申请请求;锁管理装置确定第一节点申请过目标文件对应的写锁,对目标文件进行过最新修改,则锁管理装置向第一节点发送目标文件对应的写锁回收命令,向第一节点回收目标文件对应的写锁,锁管理装置在向第一节点回收目标文件对应的写锁时,并不对第一节点的缓存中的目标文件的数据写盘和无效,因此,第一节点缓存中的数据仍是有效的。锁管理装置向第一节点回收目标文件对应的写锁后,向第一节点发送读锁授权响应,读锁中包括第一节点的信息,以使第一节点从第一节点的缓存中读取目标文件。这里,由于锁管理装置在向第一节点回收目标文件对应的写锁时,并不对第一节点缓存中的数据写盘和无效,第一节点缓存中的数据仍是有效的,第一节点可以直接从缓存中读取数据,如果后续第二节点也需要读取目标文件的数据时,可以根据第一节点对目标文件的修改记录,获取第一节点对目标文件的修改数据,第一节点将自身对目标文件的修改数据发送给第二节点,使得两个节点的数据一致,从而避免了第二节点从磁盘中读取数据,由于数据在网络间的传递比一次写盘和读盘效率高很多,提高了资源的利用率。After the lock management device in this embodiment sends a write lock authorization response to the first node, if the first node needs to perform read access to the target file, the method provided in this embodiment may further include the following steps: the lock management device receives the The lock management device determines that the first node has applied for the write lock corresponding to the target file, and the target file has been updated, and the lock management device sends the write lock recovery corresponding to the target file to the first node. command to reclaim the write lock corresponding to the target file to the first node, and the lock management device does not write and invalidate the data of the target file in the cache of the first node when reclaiming the write lock corresponding to the target file from the first node, so , the data in the cache of the first node is still valid. After the lock management device reclaims the write lock corresponding to the target file from the first node, it sends a read lock authorization response to the first node, and the read lock includes the information of the first node, so that the first node reads from the cache of the first node Target file. Here, since the lock management device reclaims the write lock corresponding to the target file from the first node, it does not write and invalidate the data in the cache of the first node, the data in the cache of the first node is still valid, and the first node can Read data directly from the cache. If the subsequent second node also needs to read the data of the target file, it can obtain the modification data of the first node to the target file according to the modification record of the first node to the target file. The first node will The modified data of the target file is sent to the second node, so that the data of the two nodes are consistent, thus avoiding the second node from reading data from the disk, because the transmission of data between networks is more efficient than writing and reading disk once Many, improving resource utilization.

本实施例锁管理装置向第一节点发送写锁授权响应之后,如果第二节点需要对目标文件进行读访问或写访问,则本实施例提供的方法还可以包括以下步骤:锁管理装置接收第二节点发送的目标文件对应的读锁或写锁申请请求,锁管理装置在接收到第二节点发送的目标文件对应的读锁或写锁申请请求后,确定是否有其他节点申请过该目标文件对应的写锁或读锁,锁管理装置确定第一节点申请过目标文件对应的写锁,对目标文件进行过最新修改,则锁管理装置向第一节点发送目标文件对应的写锁回收命令,向第一节点回收目标文件对应的写锁,锁管理装置在向第一节点回收目标文件对应的写锁时,并不对第一节点的缓存中的目标文件的数据写盘和无效,第一节点缓存中的数据仍是有效的,锁管理装置在向第一节点回收目标文件对应的写锁后,向第二节点发送读锁或写锁授权响应,读锁或写锁中包括第一节点的信息,以使第二节点根据第一节点的信息获取最新全局缓存表。第二节点得到读锁或写锁授权后,获知第一节点对目标文件进行过修改,则读锁或写锁中包括第一节点的信息,从第一节点中获取最新全局缓存表,该最新全局缓存表中记录有第一节点对目标文件的修改记录。并根据第一节点对目标文件的修改记录确定是否需要从第一节点处同步数据,具体地,第一节点确定第一节点对目标文件进行写访问的数据块与第二节点要访问的数据块是否为同一个数据块,举例来说,如果第二节点要访问目标文件中的第0数据块,第一节点对目标文件的第2数据块进行过修改,但是第一节点并没有对第0数据块修改过,第二节点上保存的目标文件的第0数据块的数据仍是最新的,则第二节点不需要获取第一节点对目标文件的修改数据,从第二节点的缓存中读取数据,如果缓存中没有,则从第二节点的磁盘中读取。如果第二节点要访问的是第2数据,则第二节点需要获取第一节点对目标文件的修改数据,使得两个节点上的数据同步。第二节点通过网络从第一节点上将数据传递过来,从而避免了第二节点从磁盘中读取数据,由于数据在网络间的传递比一次写盘和读盘效率高很多,提高了资源的利用率。After the lock management device in this embodiment sends a write lock authorization response to the first node, if the second node needs to perform read or write access to the target file, the method provided in this embodiment may further include the following steps: the lock management device receives the first The read lock or write lock application request corresponding to the target file sent by the second node, the lock management device determines whether other nodes have applied for the target file after receiving the read lock or write lock application request corresponding to the target file sent by the second node For the corresponding write lock or read lock, the lock management device determines that the first node has applied for the write lock corresponding to the target file, and the target file has been newly modified, then the lock management device sends a write lock recovery command corresponding to the target file to the first node, Reclaim the write lock corresponding to the target file to the first node. When the lock management device reclaims the write lock corresponding to the target file from the first node, it does not write and invalidate the data of the target file in the cache of the first node. The first node The data in the cache is still valid. After the lock management device reclaims the write lock corresponding to the target file from the first node, it sends a read lock or write lock authorization response to the second node. The read lock or write lock includes the first node's Information, so that the second node obtains the latest global cache table according to the information of the first node. After the second node obtains the authorization of the read lock or write lock and learns that the first node has modified the target file, the read lock or write lock includes the information of the first node, and obtains the latest global cache table from the first node. The modification record of the first node to the target file is recorded in the global cache table. And according to the modification record of the first node to the target file, it is determined whether it is necessary to synchronize data from the first node. Specifically, the first node determines the data block that the first node performs write access to the target file and the data block to be accessed by the second node. Whether it is the same data block, for example, if the second node wants to access the 0th data block in the target file, the first node has modified the 2nd data block of the target file, but the first node has not modified the 0th data block The data block has been modified, and the data of the 0th data block of the target file saved on the second node is still the latest, then the second node does not need to obtain the modified data of the target file from the first node, and reads it from the cache of the second node If there is no data in the cache, read it from the disk of the second node. If the second data is to be accessed by the second node, the second node needs to obtain the modification data of the target file by the first node, so that the data on the two nodes are synchronized. The second node transmits the data from the first node through the network, thereby avoiding the second node from reading data from the disk. Since the data transmission between the networks is much more efficient than writing and reading disks once, resource utilization is improved. utilization rate.

图5为本发明分布式集群文件系统的缓存同步方法实施例三的流程图,如图5所示,本实施例提供的方法包括以下步骤:FIG. 5 is a flow chart of Embodiment 3 of the cache synchronization method of the distributed cluster file system of the present invention. As shown in FIG. 5, the method provided in this embodiment includes the following steps:

步骤301、第二节点接收第一节点发送的全局缓存表同步请求消息。Step 301, the second node receives the global cache table synchronization request message sent by the first node.

第一节点在接收到锁管理装置发送的写锁或读锁授权响应后,向第二节点发送全局缓存表同步请求消息,用于获取最新全局缓存表。After receiving the write lock or read lock authorization response sent by the lock management device, the first node sends a global cache table synchronization request message to the second node for obtaining the latest global cache table.

步骤302、第二节点根据全局缓存表同步请求消息,向第一节点返回全局缓存表同步响应消息,全局缓存表同步响应消息中包含最新全局缓存表,最新全局缓存表中保存有第二节点对目标文件的最新修改记录。Step 302, the second node returns a global cache table synchronization response message to the first node according to the global cache table synchronization request message, the global cache table synchronization response message includes the latest global cache table, and the latest global cache table stores the second node pair A record of the last modification of the object file.

第二节点将最新全局缓存表发送给第一节点之后,最新全局缓存表中保存有第二节点对目标文件的最新修改记录,第一节点根据第二节点对目标文件的最新修改记录,确定是否需要获取第一节点对目标文件的修改数据,若需要,则第一节点向第二节点发送数据同步请求消息,第二节点接收第一节点发送的数据同步请求消息;第二节点根据数据同步请求消息,向第一节点返回数据同步响应消息,数据同步响应消息中包含第二节点对目标文件的修改数据。从而使得第一节点和第二节点上的数据同步。After the second node sends the latest global cache table to the first node, the latest modification record of the second node to the target file is stored in the latest global cache table, and the first node determines whether to It is necessary to obtain the modification data of the target file by the first node. If necessary, the first node sends a data synchronization request message to the second node, and the second node receives the data synchronization request message sent by the first node; the second node receives the data synchronization request message according to the data synchronization request message, returning a data synchronization response message to the first node, where the data synchronization response message includes the modification data of the target file by the second node. Thus, the data on the first node and the second node are synchronized.

图6为本发明分布式集群文件系统的缓存同步方法实施例四的流程图,本实施例将通过一个具体的例子对实施例一所示的方案进行详细的描述,如图6所示,本实施例提供的方法包括以下步骤:FIG. 6 is a flow chart of Embodiment 4 of the cache synchronization method of the distributed cluster file system of the present invention. This embodiment will describe the scheme shown in Embodiment 1 in detail through a specific example. As shown in FIG. 6 , this embodiment The method that embodiment provides comprises the following steps:

步骤401、当第二节点要写文件1的第4数据块时,第二节点向锁管理装置发送文件1对应的写锁申请请求。Step 401. When the second node wants to write the fourth data block of file 1, the second node sends a write lock application request corresponding to file 1 to the lock management device.

本实施例中,文件1为目标文件,文件1中包括六个数据块,第0数据块、第1数据块、第2数据块、第3数据块、第4数据块、第5数据块。第一节点和第二节点都没有对文件1进行写操作时,文件1对应的全局缓存表为空,在全局缓存表为空的时候进行读访问,先从节点的缓存中读取数据,如果节点的缓存有需要读取的数据就从缓存返回,若节点的缓存中没有要读取的数据,则从磁盘中读取。之后第二节点对文件1进行写访问,写文件1的第4数据块,第二节点首先向锁管理装置申请文件1对应的写锁。In this embodiment, the file 1 is the target file, and the file 1 includes six data blocks, the 0th data block, the 1st data block, the 2nd data block, the 3rd data block, the 4th data block, and the 5th data block. When both the first node and the second node do not write to file 1, the global cache table corresponding to file 1 is empty. When the global cache table is empty, read access is performed, and the data is read from the cache of the node first. If If there is data to be read in the cache of the node, it returns from the cache. If there is no data to be read in the cache of the node, it is read from the disk. Afterwards, the second node performs write access to the file 1 to write the fourth data block of the file 1, and the second node first applies for a write lock corresponding to the file 1 from the lock management device.

步骤402、锁管理装置向第二节点返回文件1对应的写锁申请响应。In step 402, the lock management device returns a write lock application response corresponding to file 1 to the second node.

锁管理装置在接收到第二节点发送的写锁申请请求后,确定没有其他节点申请过文件1对应的写锁,则将文件1对应的写锁授权给第二节点。After receiving the write lock application request sent by the second node, the lock management device determines that no other node has applied for the write lock corresponding to file 1, and authorizes the write lock corresponding to file 1 to the second node.

步骤403、第二节点对文件1第4数据块进行修改,并更新文件1对应的全局缓存表。Step 403, the second node modifies the fourth data block of file 1, and updates the global cache table corresponding to file 1.

第二节点持有文件1的写锁之后,对文件1的第4数据块修改,并将修改后的数据保存在缓存中,同时更新文件1对应的全局缓存表,在文件1对应的全局缓存表添加新的记录项,每个文件对应一个全局缓存表,全局缓存表中有多个记录项,每个记录项对应一个数据块,如果文件中有5个数据块,则为每个数据块建立一个记录项,当某一节点对某一数据块进行修改后,则更新全局缓存表中该数据块对应的记录项。在本步骤中,由于全局缓存表之前为空,需要添加新的记录项,该记录项为第4数据块对应的记录项,这里将第二节点对文件1的第4数据块的最新修改记录更新到第4数据块对应的记录项中。After the second node holds the write lock of file 1, it modifies the fourth data block of file 1, saves the modified data in the cache, and updates the global cache table corresponding to file 1 at the same time. Add a new record item to the table, each file corresponds to a global cache table, there are multiple record items in the global cache table, each record item corresponds to a data block, if there are 5 data blocks in the file, each data block A record item is established, and when a node modifies a data block, the record item corresponding to the data block in the global cache table is updated. In this step, since the global cache table was empty before, a new record item needs to be added, which is the record item corresponding to the fourth data block. Here, the latest modification record of the second node to the fourth data block of file 1 is recorded Update to the record item corresponding to the 4th data block.

步骤404、当第一节点要写文件1的第4数据块时,第一节点向锁管理装置申请文件1对应的写锁。Step 404, when the first node wants to write the fourth data block of file 1, the first node applies for a write lock corresponding to file 1 from the lock management device.

步骤405、锁管理装置向第二节点发送文件1对应的写锁回收请求。Step 405, the lock management device sends a write lock recovery request corresponding to file 1 to the second node.

步骤406、第二节点向锁管理装置返回文件1对应的写锁回收响应。Step 406, the second node returns a write lock recovery response corresponding to file 1 to the lock management device.

第二节点在接收到锁管理装置发送的文件1对应的写锁回收请求后,准备锁交还,在锁交还时,并不对第二节点缓存中的数据写盘和无效,第二节点缓存中的数据仍是有效的。步骤407、锁管理装置向第一节点返回文件1对应的写锁申请响应。After the second node receives the write lock recovery request corresponding to file 1 sent by the lock management device, it prepares to return the lock. When the lock is returned, it does not write and invalidate the data in the second node cache, and the data in the second node cache Data is still valid. Step 407, the lock management device returns a write lock application response corresponding to file 1 to the first node.

锁管理装置将文件1对应的写锁授权给第一节点,写锁中包含对文件1进行过最新修改的第二节点的信息。The lock management device authorizes the write lock corresponding to the file 1 to the first node, and the write lock includes the information of the second node that has made the latest modification to the file 1 .

步骤408、第一节点向第二节点发送全局缓存表同步请求消息。Step 408, the first node sends a global cache table synchronization request message to the second node.

第一节点向第二节点发送全局缓存表同步请求消息,用于向第二节点获取最新全局缓存表。The first node sends a global cache table synchronization request message to the second node to obtain the latest global cache table from the second node.

步骤409、第二节点向第一节点发送的全局缓存表同步响应消息。Step 409, the global cache table synchronization response message sent by the second node to the first node.

全局缓存表同步响应消息中包含最新全局缓存表,最新全局缓存表中保存有第二节点对文件1的最新修改记录,即第二节点对文件1的第4数据块的修改记录。The global cache table synchronization response message includes the latest global cache table, and the latest global cache table stores the latest modification record of the second node to the file 1, that is, the modification record of the second node to the fourth data block of the file 1.

步骤410、第一节点根据最新全局缓存表中第二节点对目标文件的最新修改记录,向第二节点发送第4数据块的数据同步请求消息。Step 410, the first node sends a data synchronization request message of the fourth data block to the second node according to the latest modification record of the second node to the target file in the latest global cache table.

第一节点接收第二节点发送的全局缓存表同步响应消息后,根据文件1的最新全局缓存表确定第二节点对文件1的第4数据块修改过,则第一节点向第二节点发送数据同步请求消息,用于获取第二节点对文件1的第4数据块的修改数据。After the first node receives the global cache table synchronization response message sent by the second node, it determines that the second node has modified the fourth data block of file 1 according to the latest global cache table of file 1, and then the first node sends data to the second node The synchronization request message is used to obtain the modification data of the fourth data block of the file 1 by the second node.

步骤411、第二节点向第一节点发送第4数据块的数据同步响应消息。Step 411, the second node sends a data synchronization response message of the fourth data block to the first node.

其中,第4数据块的数据同步响应消息中包含第二节点对目标文件的第4数据块的修改数据。Wherein, the data synchronization response message of the fourth data block includes the modification data of the second node to the fourth data block of the target file.

步骤412、第一节点修改第4数据块,将修改后的数据保存到第一节点的缓存中,更新文件1对应的全局缓存表。Step 412, the first node modifies the fourth data block, saves the modified data in the cache of the first node, and updates the global cache table corresponding to file 1.

第一节点接收到第二节点发送的第4数据块的修改数据后,将第4数据块的修改数据填入预先分配好的缓存中,完成两个节点的数据同步,之后进行真正的修改,将对第4数据块修改后的数据保存在缓存中。由于在第二节点对第4数据块修改时,已经在全局缓存表中添加了第4数据块的修改记录项,所以,这里第一节点对第4数据块修改完成之后更新全局缓存表的记录项即可,即更新为:文件1的第4数据块被第一节点修改。After the first node receives the modification data of the fourth data block sent by the second node, it fills the modification data of the fourth data block into the pre-allocated cache, completes the data synchronization of the two nodes, and then performs the real modification. Save the modified data of the fourth data block in the cache. Since the modification record item of the fourth data block has been added to the global cache table when the second node modifies the fourth data block, here the first node updates the record of the global cache table after the modification of the fourth data block is completed item, that is, the update is: the fourth data block of file 1 is modified by the first node.

步骤413、当第一节点要对文件1的第3数据块修改时,查询全局缓存表,确定没有其他节点对第3数据块修改过,对第3数据块进行修改。Step 413 , when the first node wants to modify the third data block of file 1, query the global cache table, determine that no other node has modified the third data block, and modify the third data block.

如果第一节点再来修改文件1的第3数据块,查询全局缓存表,发现没有其他节点对第3数据块进行过修改,无需同步,直接修改即可,第3数据块在全局缓存表中没有相关的记录项,需要添加第3数据块的记录项,文件1的第3数据块被第一节点修改过。If the first node modifies the third data block of file 1 again, queries the global cache table, and finds that no other node has modified the third data block, no need to synchronize, just modify it directly, and the third data block is not in the global cache table For related record items, the record item of the third data block needs to be added, and the third data block of file 1 has been modified by the first node.

步骤414、当第二节点要读文件1的第4数据块,向锁管理装置发送文件1对应的读锁申请请求。Step 414: When the second node wants to read the fourth data block of file 1, it sends a read lock application request corresponding to file 1 to the lock management device.

如果后续第二节点要对文件1的第4数据块进行读访问,首先申请文件1对应的读锁,If the subsequent second node wants to perform read access to the fourth data block of file 1, first apply for the read lock corresponding to file 1,

步骤415、锁管理装置向第二节点返回文件1对应的读锁申请响应。Step 415, the lock management device returns a read lock application response corresponding to file 1 to the second node.

步骤416、第二节点向第一节点发送全局缓存表同步请求。Step 416, the second node sends a global cache table synchronization request to the first node.

第二节点获得读锁之后,该读锁中包含对文件1的第4数据块进行过最新修改的第一节点的信息,第一节点之前申请过写锁,于是第一节点上的全局缓存表时最新的了。第二节点向第一节点发起全局缓存表同步请求。After the second node obtains the read lock, the read lock contains the information of the first node that has recently modified the fourth data block of file 1. The first node has applied for a write lock before, so the global cache table on the first node up to date. The second node initiates a global cache table synchronization request to the first node.

步骤417、第一节点向第二节点返回全局缓存表同步响应。Step 417, the first node returns a global cache table synchronization response to the second node.

该全局缓存表同步响应中包含最新的全局缓存表,第二节点获取到最新的全局缓存表之后,确定第4数据块第一节点修改过,于是向第一节点发起数据同步请求。The global cache table synchronization response includes the latest global cache table. After obtaining the latest global cache table, the second node determines that the fourth data block has been modified by the first node, and then initiates a data synchronization request to the first node.

步骤418、第二节点向第一节点发送第4数据块的数据同步请求。Step 418, the second node sends a data synchronization request of the fourth data block to the first node.

步骤419、第一节点向第二节点返回第4数据块的数据同步响应。Step 419, the first node returns a data synchronization response of the fourth data block to the second node.

该第4数据块的数据同步响应中包含第一节点对第4数据块的修改数据,第二节点获取第一节点对第4数据块的修改数据,使得两个节点上的数据同步,并将修改数据存储到第二节点的缓存。The data synchronization response of the 4th data block includes the modified data of the 4th data block by the first node, and the second node obtains the modified data of the 4th data block by the first node, so that the data on the two nodes are synchronized, and The modified data is stored in the cache of the second node.

步骤420、第二节点从第二节点的缓存中读取第4数据块的数据。Step 420, the second node reads the data of the fourth data block from the cache of the second node.

本实施例中,之后第一节点和第二节点还可能对文件1进行写或取,这里不再一一列举,例如第二节点还要读取第2数据块,在读取的时候发现第2数据块是被第二节点在修改过的,所以第二节点的缓存中肯定是最新的数据,从缓存中返回即可。若第二节点读取第5数据块的时候发现第5数据块没有被任何节点修改过,走正常读流程:若缓存中有,从缓存返回,若没有,从磁盘读取。In this embodiment, the first node and the second node may also write or fetch file 1, which will not be listed one by one here. For example, the second node also needs to read the second data block. When reading, it finds that the first 2. The data block is modified by the second node, so the cache of the second node must be the latest data, just return it from the cache. If the second node reads the 5th data block and finds that the 5th data block has not been modified by any node, follow the normal reading process: if it exists in the cache, return from the cache, if not, read it from the disk.

需要说明的是,本发明各实施例中,对于读访问是可以并发的,第二节点进行了写访问,其余节点均对其进行读访问,若其余节点访问到了第二节点修改的数据,均从第二节点请求相应的数据。It should be noted that, in each embodiment of the present invention, read access can be concurrent. The second node performs write access, and other nodes all perform read access to it. If other nodes access the data modified by the second node, all The corresponding data is requested from the second node.

本实施例提供的方法,通过在集群中建立文件的全局缓存表,此表随着锁授权迁移到当前要对文件访问的节点上,访问的时候通过查询全局缓存表,以确定访问的数据是否被其他节点修改,并且确定是否需要同步数据,用较少的开销来实现“按需”同步数据,加入GCT后,不用在每个节点都缓存文件的最新数据,只缓存需要用到的数据,将极大地减少缓存的消耗同时避免频繁读写盘,以达到提升集群文件系统性能。In the method provided by this embodiment, by establishing a global cache table for files in the cluster, this table is migrated to the node currently accessing the file along with the lock authorization, and when accessing, the global cache table is queried to determine whether the accessed data is It is modified by other nodes and determines whether data needs to be synchronized. It uses less overhead to achieve "on-demand" data synchronization. After adding GCT, it is not necessary to cache the latest data of the file on each node, but only cache the data that needs to be used. It will greatly reduce the consumption of the cache and avoid frequent disk reads and writes, so as to improve the performance of the cluster file system.

本实施例提供的方法,能够避免集群节点间并发交替访问同一文件时频繁的写盘读盘造成的无缓存运行,同时本实施例提供的方法实现了一种“按需”交互数据的方案,节点间的数据交互是根据需要来进行传递的,在绝大部分情况下,节点间仅仅交互全局缓存表就可以了,避免了不必要的数据传输,占用的网络开销少,数据在网络间的传递比一次写盘→读盘效率高很多,同时交互写不同数据的情况下各自缓存都是有效的,后续的读可以直接从缓存中获取,所以不管是交叉修改相同数据还是不同数据,集群文件系统性能相较现有方式都有较大提升。The method provided in this embodiment can avoid the no-cache operation caused by frequent writing and reading of the same file when cluster nodes concurrently and alternately access the same file. At the same time, the method provided in this embodiment implements a "on-demand" interactive data solution. The data interaction between nodes is transmitted according to the needs. In most cases, only the global cache table can be exchanged between nodes, which avoids unnecessary data transmission, occupies less network overhead, and saves data between networks. Transferring is much more efficient than writing to disk → reading disk once. In the case of interactively writing different data at the same time, each cache is valid, and subsequent reads can be obtained directly from the cache. Therefore, whether it is cross-modification of the same data or different data, the cluster file Compared with the existing methods, the system performance has been greatly improved.

为了方便描述,本发明各实施例中仅以两个节点为例进行说明,但本发明可以应用到n个节点的集群中(n>=2),本发明对节点的个数并不做限制,当多个节点同时交替对目标文件进行读和写访问时,本发明各实施例提供的方案仍然适用。For the convenience of description, only two nodes are taken as an example in each embodiment of the present invention, but the present invention can be applied to a cluster of n nodes (n>=2), and the present invention does not limit the number of nodes , when multiple nodes alternately perform read and write access to the target file at the same time, the solutions provided by the embodiments of the present invention are still applicable.

图7为本发明第一节点的结构示意图,包括:锁申请模块51、缓存表获取模块52、文件修改模块53。FIG. 7 is a schematic structural diagram of the first node of the present invention, including: a lock application module 51 , a cache table acquisition module 52 , and a file modification module 53 .

锁申请模块51,用于当客户端对第一节点上的目标文件进行写访问时,向锁管理装置申请目标文件对应的写锁,写锁中包括对目标文件进行过最新修改的第二节点的信息;The lock application module 51 is used to apply to the lock management device for a write lock corresponding to the target file when the client performs write access to the target file on the first node, and the write lock includes the second node that has carried out the latest modification to the target file Information;

缓存表获取模块52,用于根据第二节点的信息获取目标文件对应的最新全局缓存表,最新全局缓存表中保存有第二节点对目标文件的最新修改记录;The cache table obtaining module 52 is used to obtain the latest global cache table corresponding to the target file according to the information of the second node, and the latest modification record of the second node to the target file is stored in the latest global cache table;

文件修改模块53,用于根据第二节点对目标文件的最新修改记录对目标文件进行修改,将修改后的数据保存在第一节点的缓存中,并将第一节点对目标文件的修改记录更新到最新全局缓存表。The file modification module 53 is used to modify the target file according to the latest modification record of the second node to the target file, save the modified data in the cache of the first node, and update the modification record of the target file by the first node to the latest global cache table.

锁申请模块51具体用于:向锁管理装置发送目标文件对应的写锁申请请求,以使锁管理装置向第二节点回收写锁;接收锁管理装置发送的写锁授权响应。The lock application module 51 is specifically configured to: send a write lock application request corresponding to the target file to the lock management device, so that the lock management device reclaims the write lock to the second node; receive a write lock authorization response sent by the lock management device.

文件修改模块53包括判断单元、数据获取单元和文件修改单元;判断单元,用于根据第二节点对目标文件的最新修改记录确定是否获取第二节点对目标文件的修改数据;若是,则获取单元获取第二节点对目标文件的修改数据,将获取到的目标文件的修改数据存储在第一节点的缓存中,使得第一节点和第二节点上存储的目标文件的数据保持一致,文件修改单元从第一节点的缓存中读取数据,对目标文件进行修改;若否,则文件修改单元从第一节点的缓存中读取数据,对目标文件进行修改。File modification module 53 comprises judgment unit, data acquisition unit and file modification unit; Judgment unit is used for determining whether to obtain the modification data of second node to target file according to the latest modification record of second node to target file; If so, then acquisition unit Obtain the modification data of the target file by the second node, store the modified data of the obtained target file in the cache of the first node, so that the data of the target file stored on the first node and the second node are consistent, and the file modification unit Read data from the cache of the first node to modify the target file; if not, the file modification unit reads data from the cache of the first node to modify the target file.

本实施例中,目标文件包括至少两个数据块,第二节点对目标文件的最新修改记录中包括:第二节点对目标文件进行过最新修改的数据块的信息;判断单元具体用于:根据第二节点对目标文件进行过最新修改的数据块的信息,确定第一节点对目标文件进行写访问的数据块与第二节点对目标文件进行过最新修改的数据块是否为同一个数据块;若是,则数据获取单元获取第二节点对目标文件的修改数据。In this embodiment, the target file includes at least two data blocks, and the latest modification record of the second node to the target file includes: the information of the data block that the second node has recently modified the target file; the judging unit is specifically used to: The second node has carried out the information of the data block that the target file has been modified recently, and it is determined whether the data block that the first node has performed write access to the target file and the data block that the second node has carried out the latest modification to the target file are the same data block; If yes, the data obtaining unit obtains the modification data of the target file by the second node.

缓存表获取模块52具体通过以下方式获取最新全局缓存表:向第二节点发送全局缓存表同步请求消息;接收第二节点发送的全局缓存表同步响应消息,全局缓存表同步响应消息中包含最新全局缓存表,最新全局缓存表中保存有第二节点对目标文件的最新修改记录。The cache table obtaining module 52 specifically obtains the latest global cache table in the following manner: sending a global cache table synchronization request message to the second node; receiving a global cache table synchronization response message sent by the second node, the global cache table synchronization response message contains the latest global cache table In the cache table, the latest modification record of the target file by the second node is stored in the latest global cache table.

数据获取单元具体用于通过以下方式获取修改数据:根据最新全局缓存表中第二节点对目标文件的最新修改记录,向第二节点发送数据同步请求消息;接收第二节点发送的数据同步响应消息,数据同步响应消息中包含第二节点对目标文件的修改数据。The data acquisition unit is specifically used to obtain the modified data in the following manner: according to the latest modification record of the second node to the target file in the latest global cache table, send a data synchronization request message to the second node; receive a data synchronization response message sent by the second node , the data synchronization response message includes the modification data of the target file by the second node.

本实施例提供的第一节点,可用于执行方法实施例一和实施例四的技术方案,具体实现方式和技术效果类似,这里不再赘述。The first node provided in this embodiment can be used to implement the technical solutions of the method embodiments 1 and 4, and the specific implementation manner and technical effect are similar and will not be repeated here.

图8为本发明第一节点的实施例二的结构示意图,如图8所示,本实施例的第一节点在图7所示第一节点结构的基础上,进一步地还可以包括:文件读取模块54、接收模块55、发送模块56。Fig. 8 is a schematic structural diagram of Embodiment 2 of the first node of the present invention. As shown in Fig. 8, the first node of this embodiment may further include: file reading on the basis of the structure of the first node shown in Fig. 7 Fetching module 54, receiving module 55, sending module 56.

其中,锁申请模块51还用于:当第一节点对目标文件进行读访问时,向锁管理装置申请目标文件对应的读锁,读锁中包含对目标文件进行过最新修改的第一节点的信息;Wherein, the lock application module 51 is also used for: when the first node performs read access to the target file, apply to the lock management device for the read lock corresponding to the target file, and the read lock includes the first node that has carried out the latest modification to the target file. information;

文件读取模块54,用于从第一节点的缓存中读取目标文件。The file reading module 54 is configured to read the target file from the cache of the first node.

在文件修改模块53对目标文件进行修改之后,如果接收模块55,接收到第二节点发送的全局缓存表同步请求消息,全局缓存表同步请求消息为第二节点需要对目标文件进行读访问或写访问时向第一节点发送的,则发送模块56,用于根据全局缓存表同步请求消息,向第二节点返回全局缓存表同步响应消息,全局缓存表同步响应消息中包含更新后的最新全局缓存表。After the file modification module 53 modifies the target file, if the receiving module 55 receives the global cache table synchronization request message sent by the second node, the global cache table synchronization request message is that the second node needs to read or write the target file. If it is sent to the first node during access, the sending module 56 is used to return the global cache table synchronization response message to the second node according to the global cache table synchronization request message, and the global cache table synchronization response message includes the updated latest global cache surface.

接收模块55还用于:接收第二节点发送的数据同步请求,数据同步请求消息为第二节点根据更新后的最新全局缓存表中第一节点对目标文件的修改记录发送的;发送模块56还用于:向第二节点发送数据同步响应,数据同步响应中包括第一节点对目标文件的修改数据,以使第二节点将第一节点对目标文件的修改数据保存在第二节点的缓存中,当第二节点对数据进行读访问或写访问时可以从第二节点的缓存中读取目标文件。The receiving module 55 is also used to: receive the data synchronization request sent by the second node, the data synchronization request message is sent by the second node according to the modification record of the first node in the updated latest global cache table to the target file; the sending module 56 is also Used to: send a data synchronization response to the second node, the data synchronization response includes the modification data of the target file by the first node, so that the second node saves the modification data of the target file by the first node in the cache of the second node , when the second node performs read access or write access to the data, the target file may be read from the cache of the second node.

本实施例提供的第一节点,可用于执行方法实施例一和实施例四的技术方案,具体实现方式和技术效果类似,这里不再赘述。The first node provided in this embodiment can be used to implement the technical solutions of the method embodiments 1 and 4, and the specific implementation manner and technical effect are similar and will not be repeated here.

图9为本发明锁管理装置的实施例一的结构示意图,本实施例的锁管理装置,包括:接收模块61、确定模块62、发送模块63。FIG. 9 is a schematic structural diagram of Embodiment 1 of the lock management device of the present invention. The lock management device of this embodiment includes: a receiving module 61 , a determining module 62 , and a sending module 63 .

其中,接收模块61,用于接收第一节点发送的目标文件对应的写锁申请请求,写锁申请请求是客户端对目标文件进行写访问时,第一节点向锁管理装置发送的;Wherein, the receiving module 61 is configured to receive the write lock application request corresponding to the target file sent by the first node, and the write lock application request is sent by the first node to the lock management device when the client performs write access to the target file;

确定模块62,用于确定第二节点申请过目标文件对应的写锁,第二节点对目标文件进行过最新修改;A determining module 62, configured to determine that the second node has applied for a write lock corresponding to the target file, and the second node has carried out the latest modification to the target file;

发送模块63,用于向第二节点发送目标文件对应的写锁回收命令,向第二节点回收目标文件对应的写锁,锁管理装置在向第二节点回收目标文件对应的写锁时,并不对第二节点的缓存中的目标文件的数据写盘和无效;The sending module 63 is configured to send a write lock recovery command corresponding to the target file to the second node, and recover the write lock corresponding to the target file from the second node, and when the lock management device recovers the write lock corresponding to the target file from the second node, and Do not write to disk and invalidate the data of the target file in the cache of the second node;

发送模块63还用于:当锁管理装置在向第二节点回收到目标文件对应的写锁后,向第一节点发送写锁授权响应,写锁中包括第二节点的信息。The sending module 63 is further configured to: send a write lock authorization response to the first node after the lock management device reclaims the write lock corresponding to the target file from the second node, and the write lock includes information of the second node.

接收模块61还用于:接收第一节点发送的目标文件对应的读锁申请请求;确定模块62还用于:确定第一节点申请过目标文件对应的写锁,第一节点对目标文件进行过最新修改;发送模块63还用于:向第一节点发送目标文件对应的写锁回收命令,向第一节点回收目标文件对应的写锁,锁管理装置在向第一节点回收目标文件对应的写锁时,并不对第一节点的缓存中的目标文件的数据写盘和无效;发送模块63还用于:向第一节点发送读锁授权响应,读锁中包括第一节点的信息,以使第一节点从第一节点的缓存中读取目标文件。The receiving module 61 is also used for: receiving the read lock application request corresponding to the target file sent by the first node; the determining module 62 is also used for: determining that the first node has applied for the write lock corresponding to the target file, and the first node has applied for the target file. The latest modification; the sending module 63 is also used to: send the write lock reclaim command corresponding to the target file to the first node, reclaim the write lock corresponding to the target file to the first node, and the lock management device reclaims the write lock corresponding to the target file to the first node When locking, the data of the target file in the cache of the first node is not written to disk and invalid; the sending module 63 is also used to: send a read lock authorization response to the first node, and the read lock includes the information of the first node, so that The first node reads the target file from the cache of the first node.

本实施例中,接收模块61还用于:接收第二节点发送的目标文件对应的读锁或写锁申请请求;确定模块62还用于:确定第一节点申请过目标文件对应的写锁,第一节点对目标文件进行过最新修改;发送模块63还用于:向第一节点发送目标文件对应的写锁回收命令,向第一节点回收目标文件对应的写锁,锁管理装置在向第一节点回收目标文件对应的写锁时,并不对第一节点的缓存中的目标文件的数据写盘和无效;发送模块63还用于:向第二节点发送读锁或写锁授权响应,读锁或写锁中包括第一节点的信息,以使第二节点根据第一节点的信息获取最新全局缓存表。In this embodiment, the receiving module 61 is also used to: receive the read lock or write lock application request corresponding to the target file sent by the second node; the determination module 62 is also used to: determine that the first node has applied for the write lock corresponding to the target file, The first node has carried out the latest modification to the target file; the sending module 63 is also used to: send the write lock reclaim command corresponding to the target file to the first node, reclaim the write lock corresponding to the target file to the first node, and the lock management device is sending to the first node When a node reclaims the write lock corresponding to the target file, it does not write and invalidate the data of the target file in the cache of the first node; the sending module 63 is also used to: send a read lock or write lock authorization response to the second node, read The lock or write lock includes the information of the first node, so that the second node obtains the latest global cache table according to the information of the first node.

本实施例提供的锁管理装置,可用于执行方法实施例二提供的技术方案,具体实现方式和技术效果类似,这里不再赘述。The lock management device provided in this embodiment can be used to implement the technical solution provided in the second method embodiment, and the specific implementation method and technical effect are similar, and will not be repeated here.

图10为本发明第二节点实施例一的结构示意图,本实施例提供的第二节点包括:接收模块71、发送模块72。FIG. 10 is a schematic structural diagram of Embodiment 1 of the second node of the present invention. The second node provided in this embodiment includes: a receiving module 71 and a sending module 72 .

其中,接收模块71,用于接收第一节点发送的全局缓存表同步请求消息;Wherein, the receiving module 71 is configured to receive the global cache table synchronization request message sent by the first node;

发送模块72,用于根据全局缓存表同步请求消息,向第一节点返回全局缓存表同步响应消息,全局缓存表同步响应消息中包含最新全局缓存表,最新全局缓存表中保存有第二节点对目标文件的最新修改记录。The sending module 72 is configured to return a global cache table synchronization response message to the first node according to the global cache table synchronization request message, the global cache table synchronization response message includes the latest global cache table, and the latest global cache table stores the second node pair A record of the last modification of the object file.

接收模块71还用于:接收第一节点发送的数据同步请求消息,数据同步请求消息为第一节点根据最新全局缓存表中第二节点对目标文件的最新修改记录发送的;发送模块72还用于:根据数据同步请求消息,向第一节点返回数据同步响应消息,数据同步响应消息中包含第二节点对目标文件的修改数据。The receiving module 71 is also used for: receiving the data synchronization request message sent by the first node, the data synchronization request message is sent by the first node according to the latest modification record of the second node in the latest global cache table to the target file; the sending module 72 also uses In: returning a data synchronization response message to the first node according to the data synchronization request message, where the data synchronization response message includes modification data of the target file by the second node.

本实施例提供的第二节点,可用于执行方法实施例三提供的技术方案,具体实现方式和技术效果类似,这里不再赘述。The second node provided in this embodiment can be used to execute the technical solution provided in the third embodiment of the method, and the specific implementation method and technical effect are similar, and will not be repeated here.

图11为本发明第一节点实施例三的结构示意图,如图11所示,本实施例的第一节点800包括:处理器81、存储器82、发射器83和接收器84,存储器82、发射器83和接收器84和处理器81通过总线连接,存储器82存储执行指令,当第一节点800运行时,处理器81与存储器82之间通信,处理器81执行指令使得第一节点800执行本发明提供的分布式集群文件系统的缓存同步方法,处理器81具体用于执行以下操作:Fig. 11 is a schematic structural diagram of the third embodiment of the first node of the present invention. As shown in Fig. 11, the first node 800 of this embodiment includes: a processor 81, a memory 82, a transmitter 83 and a receiver 84, a memory 82, a transmitter The processor 83, the receiver 84 and the processor 81 are connected through the bus, and the memory 82 stores execution instructions. When the first node 800 is running, the processor 81 communicates with the memory 82, and the processor 81 executes the instructions so that the first node 800 executes the present In the cache synchronization method of the distributed cluster file system provided by the invention, the processor 81 is specifically used to perform the following operations:

当客户端对第一节点上的目标文件进行写访问时,向锁管理装置申请目标文件对应的写锁,写锁中包括对目标文件进行过最新修改的第二节点的信息;When the client performs write access to the target file on the first node, it applies to the lock management device for a write lock corresponding to the target file, and the write lock includes the information of the second node that has carried out the latest modification to the target file;

根据第二节点的信息获取目标文件对应的最新全局缓存表,最新全局缓存表中保存有第二节点对目标文件的最新修改记录;According to the information of the second node, the latest global cache table corresponding to the target file is obtained, and the latest modification record of the second node to the target file is stored in the latest global cache table;

根据第二节点对目标文件的最新修改记录对目标文件进行修改,将修改后的数据保存在第一节点的缓存中,并将第一节点对目标文件的修改记录更新到最新全局缓存表。The target file is modified according to the latest modification record of the second node to the target file, the modified data is stored in the cache of the first node, and the modification record of the first node to the target file is updated to the latest global cache table.

处理器81向锁管理装置申请目标文件对应的写锁,具体为:处理器81通过发射器83向锁管理装置发送目标文件对应的写锁申请请求,以使锁管理装置向第二节点回收写锁,并通过接收器84接收锁管理装置发送的写锁授权响应。The processor 81 applies to the lock management device for a write lock corresponding to the target file, specifically: the processor 81 sends a write lock application request corresponding to the target file to the lock management device through the transmitter 83, so that the lock management device reclaims the write lock to the second node. lock, and receive the write lock authorization response sent by the lock management device through the receiver 84.

处理器81根据第二节点对目标文件的最新修改记录对目标文件进行修改,具体为:根据第二节点对目标文件的最新修改记录确定是否获取第二节点对目标文件的修改数据;若是,则获取第二节点对目标文件的修改数据,将获取到的目标文件的修改数据存储在第一节点的缓存中,使得第一节点和第二节点上存储的目标文件的数据保持一致,从第一节点的缓存中读取数据,对目标文件进行修改;若否,则从第一节点的缓存中读取数据,对目标文件进行修改。The processor 81 modifies the target file according to the latest modification record of the second node to the target file, specifically: determining whether to obtain the modification data of the second node to the target file according to the latest modification record of the second node to the target file; if so, then Obtain the modification data of the target file from the second node, and store the obtained modification data of the target file in the cache of the first node, so that the data of the target file stored on the first node and the second node are consistent, from the first The data is read from the cache of the node, and the target file is modified; if not, the data is read from the cache of the first node, and the target file is modified.

本发明一种可能的实现方式中,目标文件包括至少两个数据块,第二节点对目标文件的最新修改记录中包括:第二节点对目标文件进行过最新修改的数据块的信息;In a possible implementation of the present invention, the target file includes at least two data blocks, and the latest modification record of the target file by the second node includes: information of the data block that the second node has recently modified for the target file;

处理器81根据第二节点对目标文件的最新修改记录确定是否获取第二节点对目标文件的修改数据,具体为:根据第二节点对目标文件进行过最新修改的数据块的信息,确定第一节点对目标文件进行写访问的数据块与第二节点对目标文件进行过最新修改的数据块是否为同一个数据块;若是,则获取第二节点对目标文件的修改数据。The processor 81 determines whether to obtain the modification data of the target file by the second node according to the latest modification record of the target file by the second node, specifically: according to the information of the data block that has been newly modified by the second node to the target file, determine the first Whether the data block that the node performs write access to the target file and the data block that the second node has recently modified on the target file are the same data block; if so, obtain the modification data of the target file by the second node.

第一节点根据第二节点的信息获取最新全局缓存表,具体为:The first node obtains the latest global cache table according to the information of the second node, specifically:

发射器83向第二节点发送全局缓存表同步请求消息,然后,接收器84接收第二节点发送的全局缓存表同步响应消息,全局缓存表同步响应消息中包含最新全局缓存表,最新全局缓存表中保存有第二节点对目标文件的最新修改记录。The transmitter 83 sends a global cache table synchronization request message to the second node, and then the receiver 84 receives the global cache table synchronization response message sent by the second node, the global cache table synchronization response message includes the latest global cache table, the latest global cache table The latest modification record of the second node to the target file is saved in .

处理器81根据第二节点对目标文件的最新修改记录获取第二节点对目标文件的修改数据,具体为:The processor 81 obtains the modification data of the second node to the target file according to the latest modification record of the second node to the target file, specifically:

处理器81根据最新全局缓存表中第二节点对目标文件的最新修改记录,通过发射器83向第二节点发送数据同步请求消息;然后,接收器84接收第二节点发送的数据同步响应消息,数据同步响应消息中包含第二节点对目标文件的修改数据。The processor 81 sends a data synchronization request message to the second node through the transmitter 83 according to the latest modification record of the second node in the latest global cache table to the target file; then, the receiver 84 receives the data synchronization response message sent by the second node, The data synchronization response message includes the modification data of the target file by the second node.

本实施例中,当第一节点对目标文件进行写操作,将修改后的数据保存在第一节点的缓存中,并将第一节点对目标文件的修改记录更新到最新全局缓存表之后,处理器81还用于:当第一节点对目标文件进行读访问时,向锁管理装置申请目标文件对应的读锁,读锁中包含对目标文件进行过最新修改的第一节点的信息,在得到写锁授权后,从第一节点的缓存中读取目标文件。In this embodiment, when the first node writes the target file, saves the modified data in the cache of the first node, and updates the modification record of the target file by the first node to the latest global cache table, the processing The device 81 is also used for: when the first node performs read access to the target file, apply to the lock management device for the read lock corresponding to the target file, and the read lock includes the information of the first node that has carried out the latest modification to the target file. After the write lock is granted, the target file is read from the cache of the first node.

本实施例中,第一节点目标文件进行写操作,将修改后的数据保存在第一节点的缓存中,并将第一节点对目标文件的修改记录更新到最新全局缓存表之后,处理器81还用于:In this embodiment, the first node performs a write operation on the target file, saves the modified data in the cache of the first node, and updates the modification record of the target file by the first node to the latest global cache table, the processor 81 Also used for:

通过接收器84接收第二节点发送的全局缓存表同步请求消息,全局缓存表同步请求消息为第二节点需要对目标文件进行读访问或写访问时向第一节点发送的,然后,处理器81根据全局缓存表同步请求消息,通过发射器83向第二节点返回全局缓存表同步响应消息,全局缓存表同步响应消息中包含更新后的最新全局缓存表。The global cache table synchronization request message sent by the second node is received by the receiver 84. The global cache table synchronization request message is sent to the first node when the second node needs to perform read access or write access to the target file. Then, the processor 81 According to the global cache table synchronization request message, the transmitter 83 returns a global cache table synchronization response message to the second node, and the global cache table synchronization response message includes the latest updated global cache table.

本实施例中,第一节点根据全局缓存表同步请求消息,向第二节点或第三节点返回全局缓存表同步响应消息之后,还包括:In this embodiment, after the first node returns the global cache table synchronization response message to the second node or the third node according to the global cache table synchronization request message, it further includes:

接收器84接收第二节点发送的数据同步请求,数据同步请求消息为第二节点根据更新后的最新全局缓存表中第一节点对目标文件的修改记录发送的;发射器83向第二节点发送数据同步响应,数据同步响应中包括第一节点对目标文件的修改数据,以使第二节点将第一节点对目标文件的修改数据保存在第二节点的缓存中,当第二节点对数据进行读访问或写访问时可以从第二节点的缓存中读取目标文件。The receiver 84 receives the data synchronization request sent by the second node, and the data synchronization request message is sent by the second node according to the modification record of the first node in the updated latest global cache table to the target file; the transmitter 83 sends to the second node Data synchronization response, the data synchronization response includes the modification data of the first node to the target file, so that the second node saves the modification data of the first node to the target file in the cache of the second node, when the second node performs the modification on the data The target file may be read from the cache of the second node during read access or write access.

本实施例提供的第一节点,可用于执行方法实施例一和实施例四提供的技术方案,具体实现方式和技术效果类似,这里不再赘述。The first node provided in this embodiment can be used to implement the technical solutions provided in the first and fourth method embodiments, and the specific implementation and technical effects are similar, and will not be repeated here.

图12为本发明锁管理装置实施例二的结构示意图,如图12所示,本实施例的锁管理装置900包括:处理器91、存储器92、发射器93和接收器94,存储器92、发射器93和接收器94和处理器91通过总线连接,存储器92存储执行指令,当锁管理装置900运行时,处理器91与存储器92之间通信,处理器91执行指令。Fig. 12 is a schematic structural diagram of Embodiment 2 of the lock management device of the present invention. As shown in Fig. The processor 93 and the receiver 94 are connected to the processor 91 through a bus, and the memory 92 stores execution instructions. When the lock management device 900 is running, the processor 91 communicates with the memory 92, and the processor 91 executes the instructions.

其中,接收器94,用于接收第一节点发送的目标文件对应的写锁申请请求,写锁申请请求是客户端对目标文件进行写访问时,第一节点向锁管理装置发送的;Wherein, the receiver 94 is configured to receive the write lock application request corresponding to the target file sent by the first node, and the write lock application request is sent by the first node to the lock management device when the client performs write access to the target file;

处理器91,用于确定第二节点申请过目标文件对应的写锁,对目标文件进行过最新修改,则锁管理装置向第二节点发送目标文件对应的写锁回收命令,向第二节点回收目标文件对应的写锁,锁管理装置在向第二节点回收目标文件对应的写锁时,并不对第二节点的缓存中的目标文件的数据写盘和无效;The processor 91 is configured to determine that the second node has applied for a write lock corresponding to the target file, and the target file has been newly modified, then the lock management device sends a write lock reclaim command corresponding to the target file to the second node, and reclaims the write lock to the second node. For the write lock corresponding to the target file, when the lock management device reclaims the write lock corresponding to the target file from the second node, it does not write and invalidate the data of the target file in the cache of the second node;

发射器93,用于向第一节点发送写锁授权响应,写锁中包括第二节点的信息。The transmitter 93 is configured to send a write lock authorization response to the first node, where the write lock includes information of the second node.

发射器93向第一节点发送写锁授权响应之后,接收器94还用于接收第一节点发送的目标文件对应的读锁申请请求;处理器91还用于确定第一节点申请过目标文件对应的写锁,对目标文件进行过最新修改,则锁管理装置向第一节点发送目标文件对应的写锁回收命令,向第一节点回收目标文件对应的写锁,锁管理装置在向第一节点回收目标文件对应的写锁时,并不对第一节点的缓存中的目标文件的数据写盘和无效;发射器93锁管理装置向第一节点发送读锁授权响应,读锁中包括第一节点的信息,以使第一节点从第一节点的缓存中读取目标文件。After the transmitter 93 sends the write lock authorization response to the first node, the receiver 94 is also used to receive the read lock application request corresponding to the target file sent by the first node; the processor 91 is also used to determine that the first node has applied for the target file corresponding to If the target file has been newly modified, the lock management device sends a write lock recovery command corresponding to the target file to the first node, and reclaims the write lock corresponding to the target file to the first node. When the write lock corresponding to the target file is reclaimed, the data of the target file in the cache of the first node is not written to disk and invalidated; the transmitter 93 lock management device sends a read lock authorization response to the first node, and the read lock includes the first node information, so that the first node reads the target file from the cache of the first node.

本实施例提供的锁管理装置,可用于执行方法实施例二提供的技术方案,具体实现方式和技术效果类似,这里不再赘述。The lock management device provided in this embodiment can be used to implement the technical solution provided in the second method embodiment, and the specific implementation method and technical effect are similar, and will not be repeated here.

图13为本发明第二节点实施例二的结构示意图,如图13所示,本实施例的第二节点100包括:处理器11、存储器12、发射器13和接收器14,存储器12、发射器13和接收器14和处理器11通过总线连接,存储器12存储执行指令,当第二节点100运行时,处理器11与存储器12之间通信,处理器11执行指令。Fig. 13 is a schematic structural diagram of Embodiment 2 of the second node of the present invention. As shown in Fig. 13, the second node 100 of this embodiment includes: a processor 11, a memory 12, a transmitter 13 and a receiver 14, a memory 12, a transmitter The processor 13 and the receiver 14 are connected to the processor 11 through a bus, and the memory 12 stores execution instructions. When the second node 100 is running, the processor 11 communicates with the memory 12, and the processor 11 executes the instructions.

本实施中,接收器14,用于接收第一节点发送的全局缓存表同步请求消息;In this implementation, the receiver 14 is configured to receive the global cache table synchronization request message sent by the first node;

处理器11,用于根据全局缓存表同步请求消息,通过发射器13向第一节点返回全局缓存表同步响应消息,全局缓存表同步响应消息中包含最新全局缓存表,最新全局缓存表中保存有第二节点对目标文件的最新修改记录。The processor 11 is configured to return a global cache table synchronization response message to the first node through the transmitter 13 according to the global cache table synchronization request message, the global cache table synchronization response message includes the latest global cache table, and the latest global cache table stores the The latest modification record of the target file by the second node.

在发射器13向第一节点返回全局缓存表同步响应消息之后,接收器14还用于:接收第一节点发送的数据同步请求消息,数据同步请求消息为第一节点根据最新全局缓存表中第二节点对目标文件的最新修改记录发送的;处理器11根据第二节点根据数据同步请求消息,通过发射器13向第一节点返回数据同步响应消息,数据同步响应消息中包含第二节点对目标文件的修改数据。After the transmitter 13 returns the global cache table synchronization response message to the first node, the receiver 14 is also used to: receive the data synchronization request message sent by the first node, the data synchronization request message is the first node according to the first node in the latest global cache table. Two nodes send the latest modification record of the target file; the processor 11 returns a data synchronization response message to the first node through the transmitter 13 according to the second node according to the data synchronization request message, and the data synchronization response message includes the second node's request for the target file. Modification data of the file.

本实施例提供的第二节点,可用于执行方法实施例三提供的技术方案,具体实现方式和技术效果类似,这里不再赘述。The second node provided in this embodiment can be used to execute the technical solution provided in the third embodiment of the method, and the specific implementation method and technical effect are similar, and will not be repeated here.

本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by program instructions and related hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.

Claims (28)

1. a buffer memory synchronous method for distributed cluster file system, is characterized in that, comprising:
When client is carried out write access to the file destination on first node, described first node to file destination described in spot lock management device application corresponding write lock, described in write lock and comprise the information of described file destination being carried out to the Section Point of up-to-date modification;
The up-to-date global buffer table that described first node is corresponding according to file destination described in the acquisition of information of described Section Point, preserves the up-to-date amendment record of described Section Point to described file destination in described up-to-date global buffer table;
Described first node is modified to described file destination to the up-to-date amendment record of described file destination according to described Section Point, amended data are kept in the buffer memory of described first node, and described first node is updated to described up-to-date global buffer table to the amendment record of described file destination.
2. method according to claim 1, is characterized in that, described first node is modified to described file destination to the up-to-date amendment record of described file destination according to described Section Point, comprising:
Described first node determines whether to obtain the Update Table of described Section Point to described file destination according to described Section Point to the up-to-date amendment record of described file destination;
If, described first node obtains the Update Table of described Section Point to described file destination, the Update Table of the described file destination getting is stored in the buffer memory of described first node, the data of the described file destination stored on described first node and described Section Point are consistent, from the buffer memory of described first node, read described data, described file destination is modified;
If not, described first node reading out data from the buffer memory of described first node, modifies to described file destination.
3. method according to claim 2, it is characterized in that, described file destination comprises at least two data blocks, and described Section Point comprises the up-to-date amendment record of described file destination: described Section Point carried out the information of the data block of up-to-date modification to described file destination;
Described first node determines whether to obtain the Update Table of described Section Point to described file destination according to described Section Point to the up-to-date amendment record of described file destination, comprising:
Described first node carried out the information of the data block of up-to-date modification to described file destination according to described Section Point, determine that described first node carries out the data block of write access to described file destination and whether data block that described Section Point carried out up-to-date modification to described file destination is same data block;
If so, described first node obtains the Update Table of described Section Point to described file destination.
4. method according to claim 1, is characterized in that, described first node, according to the up-to-date global buffer table of the acquisition of information of described Section Point, comprising:
Described first node sends global buffer table synchronization request message to described Section Point;
Described first node receives the global buffer table synchronous response message that described Section Point sends, in described global buffer table synchronous response message, comprise described up-to-date global buffer table, in described up-to-date global buffer table, preserve the up-to-date amendment record of described Section Point to described file destination.
5. method according to claim 3, is characterized in that, described first node obtains the Update Table of described Section Point to described file destination according to described Section Point to the up-to-date amendment record of described file destination, comprising:
Described first node, according to the up-to-date amendment record of Section Point to described file destination described in described up-to-date global buffer table, sends data synchronization request message to described Section Point;
Described first node receives the data sync response message that described Section Point sends, and comprises the Update Table of described Section Point to described file destination in described data sync response message.
6. method according to claim 1, it is characterized in that, described first node carries out write operation to described file destination, amended data are kept in the buffer memory of described first node, and after described first node is updated to described up-to-date global buffer table to the amendment record of described file destination, also comprise:
When described first node carries out read access to described file destination, to read lock corresponding to file destination described in described spot lock management device application, in described read lock, comprise the information of described file destination being carried out to the described first node of up-to-date modification;
Described first node reads described file destination from the buffer memory of described first node.
7. method according to claim 1, it is characterized in that, described in described first node, file destination carries out write operation, amended data are kept in the buffer memory of described first node, and after described first node is updated to described up-to-date global buffer table to the amendment record of described file destination, also comprise:
Described first node receives the global buffer table synchronization request message that described Section Point sends, and described global buffer table synchronization request message is that described Section Point sends to described first node need to carry out read access or write access to described file destination time;
Described first node, according to described global buffer table synchronization request message, returns to global buffer table synchronous response message to described Section Point, comprises the up-to-date global buffer table after described renewal in described global buffer table synchronous response message.
8. method according to claim 7, is characterized in that, described first node is according to described global buffer table synchronization request message, after described Section Point or described the 3rd node return to global buffer table synchronous response message, also comprises:
Described first node receives the data synchronization request that described Section Point sends, and described data synchronization request message is that described Section Point sends the amendment record of described file destination according to first node described in the up-to-date global buffer table after described renewal;
Described first node sends data sync response to described Section Point, described data sync response comprises the Update Table of described first node to described file destination, so that described Section Point is kept at described first node in the buffer memory of described Section Point to the Update Table of described file destination, when carrying out read access or write access to described data, described Section Point can from the buffer memory of described Section Point, read described file destination.
9. method according to claim 1, is characterized in that, described first node to file destination described in spot lock management device application corresponding write lock, comprising:
Described first node sends to described spot lock management device the lock application request of writing that described file destination is corresponding, so that described spot lock management device is write lock described in described Section Point recovery;
Described first node receives that described spot lock management device sends writes lock authorization response.
10. a buffer memory synchronous method for distributed type assemblies target file system, is characterized in that, comprising:
Spot lock management device receives the lock application request of writing corresponding to file destination that described first node sends, described in to write lock application request be client when described file destination is carried out to write access, described first node sends to described spot lock management device;
Described spot lock management device determine Section Point application cross described file destination corresponding write lock, described file destination was carried out to up-to-date modification, described spot lock management device sends to described Section Point the lock of writing that described file destination is corresponding and reclaims order, to described Section Point reclaim described file destination corresponding write lock, described spot lock management device to described Section Point, reclaim described file destination corresponding write when lock, the data of the described file destination in the buffer memory of described Section Point are not write to dish and invalid;
Described spot lock management device sends and writes lock authorization response to described first node, described in write the information that lock comprises described Section Point.
11. methods according to claim 10, is characterized in that, described spot lock management device sends and writes lock authorization response to described first node, described in write the information that lock comprises described Section Point after, also comprise:
Described spot lock management device receives read lock application request corresponding to described file destination that described first node sends;
Described spot lock management device determine described first node application cross described file destination corresponding write lock, described file destination was carried out to up-to-date modification, described spot lock management device sends to described first node the lock of writing that described file destination is corresponding and reclaims order, to described first node reclaim described file destination corresponding write lock, described spot lock management device to described first node, reclaim described file destination corresponding write when lock, the data of the described file destination in the buffer memory of described first node are not write to dish and invalid;
Described spot lock management device sends read lock authorization response to described first node, and described read lock comprises the information of described first node, so that described first node reads described file destination from the buffer memory of described first node.
12. methods according to claim 10, is characterized in that, described spot lock management device sends and writes lock authorization response to described first node, described in write the information that lock comprises described Section Point after, also comprise:
Described spot lock management device receives the read lock that described file destination that described Section Point sends is corresponding or writes lock application request;
Described spot lock management device determine described first node application cross described file destination corresponding write lock, described file destination was carried out to up-to-date modification, described spot lock management device sends to described first node the lock of writing that described file destination is corresponding and reclaims order, to described first node reclaim described file destination corresponding write lock, described spot lock management device to described first node, reclaim described file destination corresponding write when lock, the data of the described file destination in the buffer memory of described first node are not write to dish and invalid;
Described spot lock management device sends read lock or writes lock authorization response to described Section Point, and described read lock or write the information that lock comprises described first node, so that described Section Point is according to the up-to-date global buffer table of the acquisition of information of described first node.
The buffer memory synchronous method of 13. 1 kinds of distributed type assemblies target file system, is characterized in that, comprising:
Described Section Point receives the global buffer table synchronization request message that described first node sends;
Described Section Point is according to described global buffer table synchronization request message, to described first node, return to global buffer table synchronous response message, in described global buffer table synchronous response message, comprise described up-to-date global buffer table, in described up-to-date global buffer table, preserve the up-to-date amendment record of described Section Point to described file destination.
14. methods according to claim 13, is characterized in that, described Section Point, according to described global buffer table synchronization request message, after described first node returns to global buffer table synchronous response message, also comprises:
Described Section Point receives the data synchronization request message that described first node sends, and described data synchronization request message is that described first node sends the up-to-date amendment record of described file destination according to Section Point described in described up-to-date global buffer table;
Described Section Point, according to described data synchronization request message, to described first node return data synchronous response message, comprises the Update Table of described Section Point to described file destination in described data sync response message.
15. 1 kinds of nodes, described node is first node, it is characterized in that, comprising:
Lock application module, for when client is carried out write access to the file destination on first node, to file destination described in spot lock management device application corresponding write lock, described in write lock and comprise the information of described file destination being carried out to the Section Point of up-to-date modification;
Cache table acquisition module, for the up-to-date global buffer table corresponding according to file destination described in the acquisition of information of described Section Point, preserves the up-to-date amendment record of described Section Point to described file destination in described up-to-date global buffer table;
File modification module, for the up-to-date amendment record of described file destination being modified to described file destination according to described Section Point, amended data are kept in the buffer memory of described first node, and described first node is updated to described up-to-date global buffer table to the amendment record of described file destination.
16. nodes according to claim 15, is characterized in that, described file modification module comprises judging unit, data capture unit and file modification unit;
Described judging unit, for determining whether to obtain the Update Table of described Section Point to described file destination according to described Section Point to the up-to-date amendment record of described file destination;
If, described acquiring unit obtains the Update Table of described Section Point to described file destination, the Update Table of the described file destination getting is stored in the buffer memory of described first node, the data of the described file destination stored on described first node and described Section Point are consistent, described file modification unit reads described data from the buffer memory of described first node, and described file destination is modified;
If not, described file modification unit reading out data from the buffer memory of described first node, modifies to described file destination.
17. nodes according to claim 16, it is characterized in that, described file destination comprises at least two data blocks, and described Section Point comprises the up-to-date amendment record of described file destination: described Section Point carried out the information of the data block of up-to-date modification to described file destination;
Described judging unit specifically for:
According to described Section Point, described file destination was carried out the information of the data block of up-to-date modification, determined that described first node carried out the data block of write access to described file destination and whether data block that described Section Point carried out up-to-date modification to described file destination is same data block;
If so, described data capture unit obtains the Update Table of described Section Point to described file destination.
18. nodes according to claim 15, is characterized in that, described cache table acquisition module specifically for:
To described Section Point, send global buffer table synchronization request message;
Receive the global buffer table synchronous response message that described Section Point sends, in described global buffer table synchronous response message, comprise described up-to-date global buffer table, in described up-to-date global buffer table, preserve the up-to-date amendment record of described Section Point to described file destination.
19. nodes according to claim 17, is characterized in that, described data capture unit specifically for:
According to the up-to-date amendment record of Section Point to described file destination described in described up-to-date global buffer table, to described Section Point, send data synchronization request message;
Receive the data sync response message that described Section Point sends, in described data sync response message, comprise the Update Table of described Section Point to described file destination.
20. nodes according to claim 15, is characterized in that, also comprise: file read module;
Described lock application module also for: when described first node carries out read access to described file destination, to read lock corresponding to file destination described in described spot lock management device application, in described read lock, comprise the information of described file destination being carried out to the described first node of up-to-date modification;
Described file read module, reads described file destination for the buffer memory from described first node.
21. nodes according to claim 15, is characterized in that, also comprise:
Receiver module, the global buffer table synchronization request message sending for receiving described Section Point, described global buffer table synchronization request message is that described Section Point sends to described first node need to carry out read access or write access to described file destination time;
Sending module, for according to described global buffer table synchronization request message, returns to global buffer table synchronous response message to described Section Point, comprises the up-to-date global buffer table after described renewal in described global buffer table synchronous response message.
22. nodes according to claim 21, is characterized in that, described receiver module also for:
Receive the data synchronization request that described Section Point sends, described data synchronization request message is that described Section Point sends the amendment record of described file destination according to first node described in the up-to-date global buffer table after described renewal;
Described sending module also for: to described Section Point, send data sync response, described data sync response comprises the Update Table of described first node to described file destination, so that described Section Point is kept at described first node in the buffer memory of described Section Point to the Update Table of described file destination, when carrying out read access or write access to described data, described Section Point can from the buffer memory of described Section Point, read described file destination.
23. nodes according to claim 15, is characterized in that, described lock application module specifically for:
To described spot lock management device, send the lock application request of writing that described file destination is corresponding, so that described spot lock management device is write lock described in described Section Point recovery;
What receive that described spot lock management device sends writes lock authorization response.
24. 1 kinds of spot lock management devices, is characterized in that, comprising:
Receiver module, the lock application request of writing corresponding to file destination sending for receiving described first node, described in to write lock application request be client when described file destination is carried out to write access, described first node sends to described spot lock management device;
Determination module, for determine Section Point application cross described file destination corresponding write lock, described Section Point carried out up-to-date modification to described file destination;
Sending module, for send the lock of writing that described file destination is corresponding to described Section Point, reclaim order, to described Section Point reclaim described file destination corresponding write lock, described spot lock management device to described Section Point, reclaim described file destination corresponding write when lock, the data of the described file destination in the buffer memory of described Section Point are not write to dish and invalid;
Described sending module also for: to described first node, send and write lock authorization response, described in write the information that lock comprises described Section Point.
25. spot lock management devices according to claim 24, is characterized in that, described receiver module also for:
Receive read lock application request corresponding to described file destination that described first node sends;
Described determination module also for: determine described first node application cross described file destination corresponding write lock, described first node carried out up-to-date modification to described file destination;
Described sending module also for: to described first node, send the lock of writing that described file destination is corresponding and reclaim order, to described first node reclaim described file destination corresponding write lock, described spot lock management device to described first node, reclaim described file destination corresponding write when lock, the data of the described file destination in the buffer memory of described first node are not write to dish and invalid;
Described sending module also for: to described first node, send read lock authorization response, described read lock comprises the information of described first node, so that described first node reads described file destination from the buffer memory of described first node.
26. spot lock management devices according to claim 24, is characterized in that, described receiver module also for:
Receive the read lock that described file destination that described Section Point sends is corresponding or write lock application request;
Described determination module also for: determine described first node application cross described file destination corresponding write lock, described first node carried out up-to-date modification to described file destination;
Described sending module also for: to described first node, send the lock of writing that described file destination is corresponding and reclaim order, to described first node reclaim described file destination corresponding write lock, described spot lock management device to described first node, reclaim described file destination corresponding write when lock, the data of the described file destination in the buffer memory of described first node are not write to dish and invalid;
Described sending module also for: to described Section Point, send read lock or write lock authorization response, described read lock or write the information that lock comprises described first node, so that described Section Point is according to the up-to-date global buffer table of the acquisition of information of described first node.
27. 1 kinds of nodes, described node is Section Point, it is characterized in that, comprising:
Receiver module, the global buffer table synchronization request message sending for receiving described first node;
Sending module, be used for according to described global buffer table synchronization request message, to described first node, return to global buffer table synchronous response message, in described global buffer table synchronous response message, comprise described up-to-date global buffer table, in described up-to-date global buffer table, preserve the up-to-date amendment record of described Section Point to described file destination.
28. nodes according to claim 27, is characterized in that, described receiver module also for:
Receive the data synchronization request message that described first node sends, described data synchronization request message is that described first node sends the up-to-date amendment record of described file destination according to Section Point described in described up-to-date global buffer table;
Described sending module also for: according to described data synchronization request message, to described first node return data synchronous response message, in described data sync response message, comprise the Update Table of described Section Point to described file destination.
CN201310596276.6A 2013-11-21 2013-11-21 The cache synchronization method and equipment of distributed cluster file system Active CN103559319B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310596276.6A CN103559319B (en) 2013-11-21 2013-11-21 The cache synchronization method and equipment of distributed cluster file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310596276.6A CN103559319B (en) 2013-11-21 2013-11-21 The cache synchronization method and equipment of distributed cluster file system

Publications (2)

Publication Number Publication Date
CN103559319A true CN103559319A (en) 2014-02-05
CN103559319B CN103559319B (en) 2017-07-07

Family

ID=50013565

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310596276.6A Active CN103559319B (en) 2013-11-21 2013-11-21 The cache synchronization method and equipment of distributed cluster file system

Country Status (1)

Country Link
CN (1) CN103559319B (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106713250A (en) * 2015-11-18 2017-05-24 杭州华为数字技术有限公司 Data access method and device based on distributed system
CN106973089A (en) * 2017-03-16 2017-07-21 北京索瑞特医学技术有限公司 Data processing method and device
CN107145501A (en) * 2017-03-20 2017-09-08 中国建设银行股份有限公司 File updating method, file copying method and corresponding system
CN109783463A (en) * 2018-12-13 2019-05-21 杭州数梦工场科技有限公司 File synchronisation method, device and computer readable storage medium
CN111291011A (en) * 2020-02-19 2020-06-16 北京百度网讯科技有限公司 File synchronization method and device, electronic device and readable storage medium
CN111399781A (en) * 2020-04-21 2020-07-10 中国科学院光电技术研究所 Storage method for improving reliability of real-time image recording system
CN111651464A (en) * 2020-04-15 2020-09-11 北京皮尔布莱尼软件有限公司 Data processing method and system and computing equipment
CN112073456A (en) * 2017-04-26 2020-12-11 华为技术有限公司 Method, related equipment and system for realizing distributed lock
CN112448983A (en) * 2019-09-02 2021-03-05 广州彩熠灯光股份有限公司 Method for clustering multiple physical devices into one logical device
CN114817140A (en) * 2021-01-18 2022-07-29 华为技术有限公司 Distributed file access method and related equipment
CN115675905A (en) * 2022-09-30 2023-02-03 中国船舶重工集团公司第七一三研究所 Folding wing unmanned aerial vehicle cluster type launching and recycling system
CN117931815A (en) * 2023-12-14 2024-04-26 北京火山引擎科技有限公司 Distributed data storage control method and device, readable medium and electronic equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6199141B1 (en) * 1991-03-22 2001-03-06 Object Design, Inc. Method and apparatus for virtual memory mapping and transaction management in an object-oriented database system
CN1996944A (en) * 2006-11-09 2007-07-11 华中科技大学 A method for global buffer management of the cluster storage system
CN101308513A (en) * 2008-06-27 2008-11-19 福建星网锐捷网络有限公司 Distributed system cache data synchronous configuration method and apparatus
US20100100529A1 (en) * 2005-12-19 2010-04-22 Commvault Systems, Inc. Rolling cache configuration for a data replication system
CN102098344A (en) * 2011-02-21 2011-06-15 中国科学院计算技术研究所 Method and device for synchronizing editions during cache management and cache management system
CN102646127A (en) * 2012-02-29 2012-08-22 浪潮(北京)电子信息产业有限公司 Distributed file system copy selection method and device
CN103036717A (en) * 2012-12-12 2013-04-10 北京邮电大学 Consistency maintenance system and methods for distributed-type data
CN103379159A (en) * 2012-04-24 2013-10-30 阿里巴巴集团控股有限公司 Distributed web site data synchronization method
CN103392167A (en) * 2012-12-28 2013-11-13 华为技术有限公司 Caching method of distributed storage system, nodes and computer readable medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6199141B1 (en) * 1991-03-22 2001-03-06 Object Design, Inc. Method and apparatus for virtual memory mapping and transaction management in an object-oriented database system
US20100100529A1 (en) * 2005-12-19 2010-04-22 Commvault Systems, Inc. Rolling cache configuration for a data replication system
CN1996944A (en) * 2006-11-09 2007-07-11 华中科技大学 A method for global buffer management of the cluster storage system
CN101308513A (en) * 2008-06-27 2008-11-19 福建星网锐捷网络有限公司 Distributed system cache data synchronous configuration method and apparatus
CN102098344A (en) * 2011-02-21 2011-06-15 中国科学院计算技术研究所 Method and device for synchronizing editions during cache management and cache management system
CN102646127A (en) * 2012-02-29 2012-08-22 浪潮(北京)电子信息产业有限公司 Distributed file system copy selection method and device
CN103379159A (en) * 2012-04-24 2013-10-30 阿里巴巴集团控股有限公司 Distributed web site data synchronization method
CN103036717A (en) * 2012-12-12 2013-04-10 北京邮电大学 Consistency maintenance system and methods for distributed-type data
CN103392167A (en) * 2012-12-28 2013-11-13 华为技术有限公司 Caching method of distributed storage system, nodes and computer readable medium

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106713250B (en) * 2015-11-18 2019-08-20 杭州华为数字技术有限公司 Data access method and device based on distributed system
CN106713250A (en) * 2015-11-18 2017-05-24 杭州华为数字技术有限公司 Data access method and device based on distributed system
CN106973089A (en) * 2017-03-16 2017-07-21 北京索瑞特医学技术有限公司 Data processing method and device
CN106973089B (en) * 2017-03-16 2020-07-17 北京索瑞特医学技术有限公司 Data processing method and device
CN107145501B (en) * 2017-03-20 2020-09-29 中国建设银行股份有限公司 File updating method, file copying method and corresponding system
CN107145501A (en) * 2017-03-20 2017-09-08 中国建设银行股份有限公司 File updating method, file copying method and corresponding system
CN112073456B (en) * 2017-04-26 2022-01-07 华为技术有限公司 Method, related equipment and system for realizing distributed lock
CN112073456A (en) * 2017-04-26 2020-12-11 华为技术有限公司 Method, related equipment and system for realizing distributed lock
CN109783463A (en) * 2018-12-13 2019-05-21 杭州数梦工场科技有限公司 File synchronisation method, device and computer readable storage medium
CN112448983B (en) * 2019-09-02 2023-09-19 广州彩熠灯光股份有限公司 A method of clustering multiple physical devices into one logical device
CN112448983A (en) * 2019-09-02 2021-03-05 广州彩熠灯光股份有限公司 Method for clustering multiple physical devices into one logical device
CN111291011A (en) * 2020-02-19 2020-06-16 北京百度网讯科技有限公司 File synchronization method and device, electronic device and readable storage medium
CN111291011B (en) * 2020-02-19 2023-10-20 北京百度网讯科技有限公司 File synchronization method and device, electronic equipment and readable storage medium
CN111651464A (en) * 2020-04-15 2020-09-11 北京皮尔布莱尼软件有限公司 Data processing method and system and computing equipment
CN111651464B (en) * 2020-04-15 2024-02-23 北京皮尔布莱尼软件有限公司 Data processing method, system and computing device
CN111399781A (en) * 2020-04-21 2020-07-10 中国科学院光电技术研究所 Storage method for improving reliability of real-time image recording system
CN111399781B (en) * 2020-04-21 2023-09-19 中国科学院光电技术研究所 Storage method for improving reliability of real-time image recording system
CN114817140A (en) * 2021-01-18 2022-07-29 华为技术有限公司 Distributed file access method and related equipment
CN115675905A (en) * 2022-09-30 2023-02-03 中国船舶重工集团公司第七一三研究所 Folding wing unmanned aerial vehicle cluster type launching and recycling system
CN117931815A (en) * 2023-12-14 2024-04-26 北京火山引擎科技有限公司 Distributed data storage control method and device, readable medium and electronic equipment

Also Published As

Publication number Publication date
CN103559319B (en) 2017-07-07

Similar Documents

Publication Publication Date Title
CN103559319B (en) The cache synchronization method and equipment of distributed cluster file system
US11297031B2 (en) Hierarchical namespace service with distributed name resolution caching and synchronization
CN105549905B (en) A kind of method that multi-dummy machine accesses distributed objects storage system
CN103392167B (en) The caching method of distributed memory system, node
CN102307206B (en) Caching method of caching system for quickly accessing virtual machine mirror image based on cloud storage
CN106775446B (en) Distributed file system small file access method based on solid state disk acceleration
CN105183839A (en) Hadoop-based storage optimizing method for small file hierachical indexing
CN108810041A (en) A kind of data write-in of distributed cache system and expansion method, device
CN103270499B (en) log storing method and system
CN116821058B (en) Metadata access method, device, equipment and storage medium
CN107818111B (en) Method for caching file data, server and terminal
CN104111804A (en) Distributed file system
US11341163B1 (en) Multi-level replication filtering for a distributed database
WO2018137327A1 (en) Data transmission method for host and standby devices, control node, and database system
CN103095686A (en) Hot metadata access control method and server
CN112015807B (en) Data synchronization processing method and device, electronic equipment and computer storage medium
CN113032356A (en) Cabin distributed file storage system and implementation method
CN109299056A (en) A kind of method of data synchronization and device based on distributed file system
CN119396745A (en) A data pre-fetching method, computing node and storage system
CN119473168A (en) Cache processing method for heterogeneous devices, heterogeneous system, product, device and medium
CN121127841A (en) Dynamic expansion and deallocation of cache coherency snoop filter entries
CN108009029A (en) Method and system based on the data cached decoupling persistence of Ignite grids
CN111488293A (en) Method and device for accessing data visitor directory in multi-core system
CN109597903A (en) Image file processing apparatus and method, document storage system and storage medium
CN102984256A (en) Processing method and system for metadata based on authorization manner

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