CN103095687B - Metadata processing method and device - Google Patents
Metadata processing method and device Download PDFInfo
- Publication number
- CN103095687B CN103095687B CN201210554481.1A CN201210554481A CN103095687B CN 103095687 B CN103095687 B CN 103095687B CN 201210554481 A CN201210554481 A CN 201210554481A CN 103095687 B CN103095687 B CN 103095687B
- Authority
- CN
- China
- Prior art keywords
- identifier
- client
- metadata
- data
- data server
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明提供一种元数据处理方法及装置,其中元数据处理方法包括接收写请求,写请求中携带有对象标识;根据写请求,生成与对象标识对应的至少一条修改指令,修改指令包括数据标识和与数据标识对应的目标值,数据标识为与对象标识对应的至少一个元数据中的需要进行修改的元数据的标识;将修改指令发送给数据标识对应的客户端及数据服务器,以供客户端和数据服务器分别根据修改指令,将数据标识对应的元数据修改为目标值。从而使得客户端和数据服务器中所存储的元数据能够得到同步的更新,保证了分布式系统中对数据进行存储的一致性,避免了由于多个客户端同时发送写请求而出现写冲突的情况,有效地保证了分布式系统提供元数据服务的性能。
The present invention provides a metadata processing method and device, wherein the metadata processing method includes receiving a write request, the write request carries an object identifier; according to the write request, at least one modification instruction corresponding to the object identifier is generated, and the modification instruction includes a data identifier And the target value corresponding to the data identifier, the data identifier is the identifier of the metadata that needs to be modified in at least one metadata corresponding to the object identifier; the modification instruction is sent to the client and the data server corresponding to the data identifier for the client The terminal and the data server respectively modify the metadata corresponding to the data identifier to the target value according to the modification instruction. In this way, the metadata stored in the client and the data server can be updated synchronously, ensuring the consistency of data storage in the distributed system, and avoiding write conflicts due to multiple clients sending write requests at the same time , which effectively guarantees the performance of the distributed system to provide metadata services.
Description
技术领域technical field
本发明实施例涉及网络技术和计算机技术,尤其涉及一种元数据处理方法及装置。Embodiments of the present invention relate to network technology and computer technology, and in particular to a metadata processing method and device.
背景技术Background technique
分布式系统提供元数据服务的方式主要包括两种,分别为中心式元数据服务和对等式元数据服务。There are mainly two ways for distributed systems to provide metadata services, namely central metadata services and peer-to-peer metadata services.
中心式元数据服务,包括元数据集群和数据集群。其中,元数据集群由分别用于存储元数据的多个元数据服务器组成,数据集群由分别用于存储数据的多个数据服务器组成。在中心式元数据服务中,元数据集群通常由其中一个元数据服务器作为中心节点与客户端进行通信,对外提供服务。在元数据被修改后,该中心节点对元数据集群中的其他元数据服务器中的元数据进行更新。Centralized metadata services, including metadata clusters and data clusters. Wherein, the metadata cluster is composed of multiple metadata servers respectively used for storing metadata, and the data cluster is composed of multiple data servers respectively used for storing data. In the centralized metadata service, the metadata cluster usually uses one of the metadata servers as the central node to communicate with the client and provide external services. After the metadata is modified, the central node updates the metadata in other metadata servers in the metadata cluster.
但是,分布式系统在采用中心式元数据服务的方式时,由于各客户端对元数据进行修改或访问的请求,均需要路由到元数据集群的中心节点,使得该中心节点不仅需要对外提供对元数据的修改和访问的服务,还需要将元数据的变动同步到元数据集群中的其他元数据服务器,对于单一节点的过分依赖,会导致元数据服务的性能受到该中心节点性能的限制。However, when the distributed system adopts the centralized metadata service method, each client’s request to modify or access the metadata needs to be routed to the central node of the metadata cluster, so that the central node not only needs to provide external Metadata modification and access services also need to synchronize metadata changes to other metadata servers in the metadata cluster. Excessive reliance on a single node will cause the performance of metadata services to be limited by the performance of the central node.
分布式系统在采用对等式元数据服务的方法时,元数据与数据均存储在多个数据服务器组成的数据集群中,数据集群中不存在中心节点,客户端可以直接修改或访问存储在各数据服务器中的元数据,从而克服了元数据服务的性能受到中心节点性能限制的问题。When the distributed system adopts the method of peer-to-peer metadata service, the metadata and data are stored in the data cluster composed of multiple data servers. There is no central node in the data cluster, and the client can directly modify or access the data stored in each The metadata in the data server overcomes the problem that the performance of the metadata service is limited by the performance of the central node.
但是,由于多个客户端均可以对各数据服务器进行读或写操作,而当多个客户端并发写时,会出现写冲突的情况。在这样的情况下,数据服务器和客户端之间会发送大量的重试信息,导致在进行并发写时,数据服务器提供元数据服务的性能较低。However, since multiple clients can perform read or write operations on each data server, when multiple clients write concurrently, write conflicts will occur. In such a case, a large amount of retry information will be sent between the data server and the client, resulting in low performance of the data server in providing metadata services during concurrent writing.
发明内容Contents of the invention
本发明的第一个方面是提供一种元数据处理方法包括:A first aspect of the present invention is to provide a metadata processing method comprising:
接收写请求,所述写请求中携带有对象标识;receiving a write request, where the write request carries an object identifier;
根据所述写请求,生成与所述对象标识对应的至少一条修改指令,所述修改指令包括数据标识和与所述数据标识对应的目标值,所述数据标识为与所述对象标识对应的至少一个元数据中的需要进行修改的元数据的标识;According to the write request, at least one modification instruction corresponding to the object identifier is generated, the modification instruction includes a data identifier and a target value corresponding to the data identifier, and the data identifier is at least one corresponding to the object identifier The identifier of the metadata that needs to be modified in a metadata;
将所述修改指令发送给所述数据标识对应的客户端及数据服务器,以供所述客户端和所述数据服务器分别根据所述修改指令,将所述数据标识对应的元数据修改为所述目标值。sending the modification instruction to the client and the data server corresponding to the data identifier, so that the client and the data server can modify the metadata corresponding to the data identifier to the target value.
结合第一个方面的元数据处理方法,在第一种可能的实现方式中,所述根据所述写请求,生成与所述对象标识对应的至少一条修改指令之后,所述方法还包括:With reference to the metadata processing method of the first aspect, in a first possible implementation manner, after generating at least one modification instruction corresponding to the object identifier according to the write request, the method further includes:
将所述至少一条修改指令发送至用于存储修改指令的数据服务器;sending the at least one modification instruction to a data server for storing the modification instruction;
相应地,所述方法还包括:Correspondingly, the method also includes:
在将所述至少一条修改指令分别发送给所述数据标识对应的客户端及数据服务器之后,向所述用于存储修改指令的数据服务器发送删除消息,以指示所述用于存储修改指令的数据服务器删除所述至少一条修改指令。After sending the at least one modification instruction to the client and the data server corresponding to the data identifier, send a delete message to the data server for storing the modification instruction to indicate that the data for storing the modification instruction The server deletes the at least one modification instruction.
结合第一个方面的第一种可能的实现方式,在第二种可能的实现方式中,所述方法还包括:With reference to the first possible implementation of the first aspect, in a second possible implementation, the method further includes:
从所述用于存储修改指令的数据服务器中获取未被删除的修改指令;Obtaining undeleted modification instructions from the data server for storing the modification instructions;
将所述未被删除的修改指令发送给所述未被删除的修改指令中的数据标识对应的客户端及数据服务器。Send the undeleted modification instruction to the client and the data server corresponding to the data identifier in the undeleted modification instruction.
结合第一个方面、第一种或第二种可能的实现方式,在第三种可能的实现方式中,所述对象标识为文件标识或虚拟磁盘标识。With reference to the first aspect, the first or the second possible implementation manner, in a third possible implementation manner, the object identifier is a file identifier or a virtual disk identifier.
本发明第二个方面是提供一种元数据处理方法,包括:The second aspect of the present invention is to provide a metadata processing method, including:
接收读请求,所述读请求中携带有对象标识;receiving a read request, where the read request carries an object identifier;
若在所存储的对象标识与元数据的对应关系中,未查找到与所述对象标识对应的元数据,则根据所述读请求,生成与所述对象标识对应的至少一条访问指令,所述访问指令包括与所述对象标识对应的元数据的数据标识;If no metadata corresponding to the object identifier is found in the stored correspondence between the object identifier and the metadata, at least one access instruction corresponding to the object identifier is generated according to the read request, and the The access instruction includes a data identifier of metadata corresponding to the object identifier;
将所述访问指令发送给所述数据标识对应的数据服务器;Send the access instruction to the data server corresponding to the data identifier;
接收所述数据服务器根据所述数据标识返回的目标元数据。receiving target metadata returned by the data server according to the data identifier.
结合第二个方面的元数据处理方法,在第一种可能的实现方式中,所述读请求中还携带有客户端标识;In combination with the metadata processing method of the second aspect, in a first possible implementation manner, the read request also carries a client identifier;
相应地,所述接收所述数据服务器根据所述数据标识返回的目标元数据之后,所述方法还包括:Correspondingly, after receiving the target metadata returned by the data server according to the data identifier, the method further includes:
将所述目标元数据发送给所述客户端标识对应的客户端,以供所述客户端将所述目标元数据保存为与所述对象标识对应的元数据。Sending the target metadata to a client corresponding to the client identifier, so that the client saves the target metadata as metadata corresponding to the object identifier.
结合第二个方面或第一种可能的实现方式,在第二种可能的实现方式中,所述对象标识为文件标识或虚拟磁盘标识。With reference to the second aspect or the first possible implementation manner, in the second possible implementation manner, the object identifier is a file identifier or a virtual disk identifier.
本发明第三个方面是提供一种客户端,包括:A third aspect of the present invention is to provide a client, including:
接收单元,用于接收写请求,所述写请求中携带有对象标识;a receiving unit, configured to receive a write request, where the write request carries an object identifier;
处理单元,用于根据所述写请求,生成与所述对象标识对应的至少一条修改指令,所述修改指令包括数据标识和与所述数据标识对应的目标值,所述数据标识为与所述对象标识对应的至少一个元数据中的需要进行修改的元数据的标识;A processing unit, configured to generate at least one modification instruction corresponding to the object identifier according to the write request, the modification instruction includes a data identifier and a target value corresponding to the data identifier, and the data identifier is the same as the object identifier An identifier of metadata that needs to be modified in at least one piece of metadata corresponding to the object identifier;
发送单元,用于将所述修改指令发送给所述数据标识对应的客户端及数据服务器,以供所述客户端和所述数据服务器分别根据所述修改指令,将所述数据标识对应的元数据修改为所述目标值。A sending unit, configured to send the modification instruction to the client and the data server corresponding to the data identifier, so that the client and the data server can respectively send the element corresponding to the data identifier according to the modification instruction. The data is modified to the stated target value.
结合第三个方面提供的客户端,在第一种可能的实现方式中,所述处理单元还用于:In combination with the client provided in the third aspect, in a first possible implementation, the processing unit is further configured to:
在根据所述写请求,生成与所述对象标识对应的至少一条修改指令之后,将所述至少一条修改指令发送至用于存储修改指令的数据服务器;After generating at least one modification instruction corresponding to the object identifier according to the write request, sending the at least one modification instruction to a data server for storing the modification instruction;
相应地,所述发送单元还用于:Correspondingly, the sending unit is also used for:
在将所述至少一条修改指令分别发送给所述数据标识对应的客户端及数据服务器之后,向所述用于存储修改指令的数据服务器发送删除消息,以指示所述用于存储修改指令的数据服务器删除所述至少一条修改指令。After sending the at least one modification instruction to the client and the data server corresponding to the data identifier, send a delete message to the data server for storing the modification instruction to indicate that the data for storing the modification instruction The server deletes the at least one modification instruction.
结合第三个方面的第一种可能的实现方式,在第二种可能的实现方式中,所述客户端还包括:With reference to the first possible implementation of the third aspect, in a second possible implementation, the client further includes:
获取单元,用于从所述用于存储修改指令的数据服务器中获取未被删除的修改指令;an acquisition unit, configured to acquire undeleted modification instructions from the data server for storing modification instructions;
相应地,所述发送单元还用于:Correspondingly, the sending unit is also used for:
将所述未被删除的修改指令发送给所述未被删除的修改指令中的数据标识对应的客户端及数据服务器。Send the undeleted modification instruction to the client and the data server corresponding to the data identifier in the undeleted modification instruction.
结合第三个方面、第一种或第二种可能的实现方式,在第三种可能的实现方式中,所述接收单元接收到的所述写请求中的所述对象标识为文件标识或虚拟磁盘标识。With reference to the third aspect, the first or the second possible implementation manner, in the third possible implementation manner, the object identifier in the write request received by the receiving unit is a file identifier or a virtual Disk ID.
本发明第四个方面是提供一种客户端,包括:A fourth aspect of the present invention is to provide a client, including:
接收单元,用于接收读请求,所述读请求中携带有对象标识;a receiving unit, configured to receive a read request, where the read request carries an object identifier;
处理单元,当在所存储的对象标识与元数据的对应关系中,未查找到与所述对象标识对应的元数据时,根据所述读请求,生成与所述对象标识对应的至少一条访问指令,所述访问指令包括与所述对象标识对应的元数据的数据标识;The processing unit generates at least one access instruction corresponding to the object identifier according to the read request when no metadata corresponding to the object identifier is found in the stored correspondence between the object identifier and the metadata , the access instruction includes a data identifier of metadata corresponding to the object identifier;
发送单元,用于将所述访问指令发送给所述数据标识对应的数据服务器;a sending unit, configured to send the access instruction to a data server corresponding to the data identifier;
相应地,所述接收单元还用于,接收所述数据服务器根据所述数据标识返回的目标元数据。Correspondingly, the receiving unit is further configured to receive target metadata returned by the data server according to the data identifier.
结合第四个方面提供的客户端,在第一种可能的实现方式中,所述接收单元接收到的所述读请求中还携带有客户端标识;With reference to the client provided in the fourth aspect, in a first possible implementation manner, the read request received by the receiving unit also carries a client identifier;
相应地,所述发送单元还用于:Correspondingly, the sending unit is also used for:
在接收到所述数据服务器根据所述数据标识返回的目标元数据之后,将所述目标元数据发送给所述客户端标识对应的客户端,以供所述客户端将所述目标元数据保存为与所述对象标识对应的元数据。After receiving the target metadata returned by the data server according to the data identifier, sending the target metadata to a client corresponding to the client identifier, so that the client can save the target metadata is the metadata corresponding to the object ID.
结合第四个方面或第一种可能的实现方式,在第二种可能的实现方式中,所述接收单元接收到的所述读请求中的所述对象标识为文件标识或虚拟磁盘标识。With reference to the fourth aspect or the first possible implementation manner, in a second possible implementation manner, the object identifier in the read request received by the receiving unit is a file identifier or a virtual disk identifier.
本发明实施例提供的元数据处理方法及装置,根据写请求生成与对象标识对应的至少一条修改指令,在该修改指令中包括需要修改的元数据的数据标识以及对该元数据进行修改的目标值,将各条修改指令分别发送给存储对应的元数据的客户端和数据服务器,从而使得客户端和数据服务器中所存储的元数据能够得到同步的更新,保证了分布式系统中对数据进行存储的一致性,此外,由于各客户端的写请求均需要通过作为主控客户端的客户端,发送给数据集群中的数据服务器,避免了由于多个客户端同时发送写请求而出现写冲突的情况,有效地保证了分布式系统提供元数据服务的性能。The metadata processing method and device provided by the embodiments of the present invention generate at least one modification instruction corresponding to the object identifier according to the write request, and the modification instruction includes the data identifier of the metadata to be modified and the target for modifying the metadata value, each modification command is sent to the client and data server that store the corresponding metadata, so that the metadata stored in the client and the data server can be updated synchronously, ensuring that the data in the distributed system Consistency of storage. In addition, since the write requests of each client need to be sent to the data server in the data cluster through the client as the master client, avoiding the situation of write conflicts caused by multiple clients sending write requests at the same time , which effectively guarantees the performance of the distributed system to provide metadata services.
附图说明Description of drawings
图1为本发明实施例提供的元数据处理方法的流程图;FIG. 1 is a flowchart of a metadata processing method provided by an embodiment of the present invention;
图2为本发明实施例提供的另一元数据处理方法的流程图;FIG. 2 is a flowchart of another metadata processing method provided by an embodiment of the present invention;
图3为本发明实施例提供的又一元数据处理方法的流程图;FIG. 3 is a flowchart of another metadata processing method provided by an embodiment of the present invention;
图4为本发明实施例提供的又一元数据处理方法的流程图;FIG. 4 is a flowchart of another metadata processing method provided by an embodiment of the present invention;
图5为本发明实施例提供的客户端的结构示意图;FIG. 5 is a schematic structural diagram of a client provided by an embodiment of the present invention;
图6为本发明实施例提供的另一客户端的结构示意图Fig. 6 is a schematic structural diagram of another client provided by an embodiment of the present invention
图7为本发明实施例提供的又一客户端的结构示意图;FIG. 7 is a schematic structural diagram of another client provided by an embodiment of the present invention;
图8为本发明实施例提供的又一客户端的结构示意图;FIG. 8 is a schematic structural diagram of another client provided by an embodiment of the present invention;
图9为本发明实施例提供的又一客户端的结构示意图。FIG. 9 is a schematic structural diagram of another client provided by an embodiment of the present invention.
具体实施方式Detailed ways
本发明各实施例提供的分布式系统包括中心集群、数据集群以及至少一个客户端。The distributed system provided by various embodiments of the present invention includes a central cluster, a data cluster, and at least one client.
其中,中心集群由一个或多个中心节点组成,中心节点可以为服务器。中心节点不用于存储元数据,而是用于当客户端为多个时,从其中选择一个客户端作为主控客户端。当中心节点为多个时,其中一个中心节点为主控中心节点,其他中心节点作为主控中心节点的备份中心节点,以便于在主控中心节点发生故障时,可以由备份中心节点完成该主控中心节点的工作。以下所称的中心节点即表示该主控中心节点。Wherein, the central cluster is composed of one or more central nodes, and the central nodes may be servers. The central node is not used to store metadata, but is used to select one client as the master client when there are multiple clients. When there are multiple central nodes, one of the central nodes is the main control central node, and the other central nodes are the backup central nodes of the main control central node, so that when the main control central node fails, the backup central node can complete the main control node. The work of the control center node. The central node referred to below refers to the master control center node.
数据集群由一个或多个数据服务器组成,各数据服务器中存储有对象的元数据和/或数据。A data cluster is composed of one or more data servers, and metadata and/or data of objects are stored in each data server.
客户端为用于供用户对数据集群中所存储的对象进行操作的设备,客户端可以为个人计算机或服务器等设备,可以在客户端中预置相应的系统,以便于用户在客户端上对对象进行操作和控制。The client is a device for users to operate on the objects stored in the data cluster. The client can be a personal computer or a server, and the corresponding system can be preset in the client so that the user can operate on the client. Objects are manipulated and controlled.
当分布式系统中的客户端为多个时,中心集群将多个客户端中的一个客户端设置为主控客户端,各客户端需要与数据集群进行通信时,均需要经过该主控客户端,由该主控客户端与数据集群中的数据服务器进行通信。When there are multiple clients in the distributed system, the central cluster sets one of the multiple clients as the master client. When each client needs to communicate with the data cluster, it needs to pass through the master client. end, the master client communicates with the data server in the data cluster.
具体的,用户通过客户端对分布式系统中的对象进行读操作和写操作的方法如下。Specifically, the method for the user to perform read and write operations on objects in the distributed system through the client is as follows.
图1为本发明实施例提供的元数据处理方法的流程图,如图1所示,该方法包括:Fig. 1 is a flowchart of a metadata processing method provided by an embodiment of the present invention. As shown in Fig. 1, the method includes:
101、接收写请求。其中,所述写请求中携带有对象标识。101. Receive a write request. Wherein, the write request carries an object identifier.
具体的,用户通过客户端对分布式系统进行操作时,包括以下两种情况。一种情况为用户所使用的客户端为主控客户端,则该主控客户端接收的写请求是用户所发送的;另一种情况为用户所使用的客户端不是主控客户端,则该客户端在接收到用户发送的写请求之后,需要将该写请求发送给主控客户端,则该主控客户端接收到的写请求是其他客户端所发送的。Specifically, when a user operates a distributed system through a client, it includes the following two situations. One case is that the client used by the user is the master client, and the write request received by the master client is sent by the user; the other case is that the client used by the user is not the master client, then After receiving the write request sent by the user, the client needs to send the write request to the master client, and the write request received by the master client is sent by other clients.
无论主控客户端接收到的写请求是用户发送的,还是其他客户端发送的,在写请求中均携带有对象标识。对象在数据集群中以元数据和数据的形式,分布式地存储在一个或多个数据服务器中。对象标识是该对象在面向用户侧的标识。Regardless of whether the write request received by the master client is sent by the user or sent by other clients, the write request carries an object identifier. Objects are distributed in one or more data servers in the form of metadata and data in the data cluster. The object identifier is the identifier of the object on the user-facing side.
102、根据所述写请求,生成与所述对象标识对应的至少一条修改指令。其中,所述修改指令包括数据标识和与所述数据标识对应的目标值,所述数据标识为与所述对象标识对应的至少一个元数据中的需要进行修改的元数据的标识。102. Generate at least one modification instruction corresponding to the object identifier according to the write request. Wherein, the modification instruction includes a data identifier and a target value corresponding to the data identifier, and the data identifier is an identifier of metadata that needs to be modified in at least one piece of metadata corresponding to the object identifier.
具体的,主控客户端中预先存储有对象标识与元数据的数据标识的对应关系,一个对象标识可以与一个或多个元数据标识是对应的。因此,主控客户端在接收到写请求之后,可以根据写请求中的对象标识查找到与该对象标识对应的元数据的数据标识。并且,在主控客户端根据接收到的写请求,可以获知需要对对象中的哪些元数据进行修改,以及修改的目标值,从而,主控客户端根据写请求能够生成与该对象标识对应的一条或多条修改指令。Specifically, the corresponding relationship between object identifiers and metadata data identifiers is pre-stored in the master control client, and one object identifier may correspond to one or more metadata identifiers. Therefore, after receiving the write request, the master client can find the data identifier of the metadata corresponding to the object identifier according to the object identifier in the write request. Moreover, according to the received write request, the master client can know which metadata in the object needs to be modified and the modified target value, so that the master client can generate the corresponding object ID according to the write request. One or more modification instructions.
在生成的每条修改指令中,不仅包括需要修改的元数据的数据标识,还需要包括对该元数据进行修改的目标值。从而,接收到该修改指令的数据服务器能够根据修改指令,将相应的元数据修改为目标值。In each generated modification instruction, not only the data identifier of the metadata to be modified is included, but also the target value for modifying the metadata is required. Therefore, the data server that receives the modification instruction can modify the corresponding metadata to the target value according to the modification instruction.
103、将所述修改指令发送给所述数据标识对应的客户端及数据服务器。执行步骤103是为了供所述客户端和所述数据服务器分别根据所述修改指令,将所述数据标识对应的元数据修改为所述目标值。103. Send the modification instruction to the client and the data server corresponding to the data identifier. Step 103 is performed for the client and the data server to modify the metadata corresponding to the data identifier to the target value according to the modification instruction.
具体的,在主控客户端中不仅存储有对象标识与元数据的数据标识的对应关系,还存储有元数据的数据标识与客户端的对应关系,以及元数据的数据标识与数据服务器的对应关系。也就是说,主控客户端根据数据标识可以查找到哪个元数据是存储在哪个客户端和哪个数据服务器中的。Specifically, the master client not only stores the correspondence between the object identifier and the data identifier of the metadata, but also stores the correspondence between the data identifier of the metadata and the client, and the correspondence between the data identifier of the metadata and the data server . That is to say, the master client can find out which metadata is stored in which client and which data server according to the data identifier.
相应地,主控客户端将一条或多条修改指令分别发送给对应的客户端和数据服务器。从而,不仅数据服务器能够根据修改指令将相应的元数据修改为目标值,存储有该元数据的客户端也能够相应地将该元数据修改为目标值,保证了客户端与数据服务器中所存储的该元数据具有一致性。Correspondingly, the master control client sends one or more modification instructions to the corresponding client and data server respectively. Therefore, not only the data server can modify the corresponding metadata to the target value according to the modification instruction, but the client that stores the metadata can also modify the metadata to the target value accordingly, ensuring that the data stored in the client and the data server This metadata is consistent.
本发明实施例提供的元数据处理方法,根据写请求生成与对象标识对应的至少一条修改指令,在该修改指令中包括需要修改的元数据的数据标识以及对该元数据进行修改的目标值,将各条修改指令分别发送给存储对应的元数据的客户端和数据服务器,从而使得客户端和数据服务器中所存储的元数据能够得到同步的更新,保证了分布式系统中对数据进行存储的一致性,此外,由于各客户端的写请求均需要通过作为主控客户端的客户端,发送给数据集群中的数据服务器,避免了由于多个客户端同时发送写请求而出现写冲突的情况,有效地保证了分布式系统提供元数据服务的性能。The metadata processing method provided by the embodiment of the present invention generates at least one modification instruction corresponding to the object identifier according to the write request, and the modification instruction includes the data identifier of the metadata to be modified and the target value for modifying the metadata, Send each modification instruction to the client and data server that store the corresponding metadata, so that the metadata stored in the client and the data server can be updated synchronously, ensuring the accuracy of data storage in the distributed system. Consistency. In addition, since the write requests of each client need to be sent to the data server in the data cluster through the client as the master client, it avoids the situation of write conflicts caused by multiple clients sending write requests at the same time, effectively It guarantees the performance of the distributed system to provide metadata services.
图2为本发明实施例提供的另一元数据处理方法的流程图,如图2所示,该方法包括:Fig. 2 is a flowchart of another metadata processing method provided by an embodiment of the present invention. As shown in Fig. 2, the method includes:
201、接收写请求。201. Receive a write request.
具体的,可以参见步骤101中所述的实现方式。Specifically, reference may be made to the implementation manner described in step 101.
进一步地,所述对象标识为文件标识或虚拟磁盘标识。Further, the object identifier is a file identifier or a virtual disk identifier.
在数据集群中存储的对象可以为文件,还可以为虚拟磁盘。相应地,当对象为文件时,对象标识为文件标识,元数据即为文件的元数据;当对象为虚拟磁盘时,对象标识为虚拟磁盘标识,元数据即为虚拟磁盘的元数据。The objects stored in the data cluster can be files or virtual disks. Correspondingly, when the object is a file, the object identifier is the file identifier, and the metadata is the metadata of the file; when the object is a virtual disk, the object identifier is the virtual disk identifier, and the metadata is the metadata of the virtual disk.
需要说明的是,文件和虚拟磁盘仅为存储在数据集群中的两种对象形式,可选的对象形式并不仅限于此。对于可以存储在分布式系统中的其他形式的对象的元数据,同样可以采用本发明各实施例中所述的元数据处理方法和客户端进行处理。It should be noted that files and virtual disks are only two object forms stored in the data cluster, and the optional object forms are not limited thereto. Metadata of other forms of objects that can be stored in the distributed system can also be processed by using the metadata processing methods and clients described in the various embodiments of the present invention.
202、根据所述写请求,生成与所述对象标识对应的至少一条修改指令。202. Generate at least one modification instruction corresponding to the object identifier according to the write request.
具体的,可以参见步骤102中所述的实现方式。Specifically, reference may be made to the implementation manner described in step 102 .
203、将所述至少一条修改指令发送至用于存储修改指令的数据服务器。203. Send the at least one modification instruction to a data server for storing the modification instruction.
具体的,主控客户端在生成了至少一条修改指令之后,还需要将这些修改指令发送给用于存储修改指令的数据服务器。Specifically, after generating at least one modification instruction, the master client needs to send these modification instructions to the data server for storing the modification instruction.
数据服务器存储修改指令的方式可以与存储其他数据的方式类似,也就是说,将修改指令作为一部分特殊的数据存储在数据服务器中。The manner in which the data server stores the modification instruction may be similar to the manner in which other data is stored, that is, the modification instruction is stored in the data server as a part of special data.
进一步地,主控客户端生成的至少一条修改指令可以为事务日志。Further, at least one modification instruction generated by the master client may be a transaction log.
优选的,可以为事务日志中的重做(redo)日志。Preferably, it may be a redo log in the transaction log.
需要说明的是,可选的修改指令的形式并不仅限于此。It should be noted that the form of the optional modification instruction is not limited to this.
204、将所述至少一条修改指令分别发送给所述数据标识对应的客户端及数据服务器。204. Send the at least one modification instruction to the client and the data server corresponding to the data identifier respectively.
具体的,可以参见步骤103中所述的实现方式。Specifically, reference may be made to the implementation manner described in step 103 .
205、向所述用于存储修改指令的数据服务器发送删除消息。执行步骤205是为了指示所述用于存储修改指令的数据服务器删除所述至少一条修改指令。205. Send a delete message to the data server for storing the modification instruction. Step 205 is executed to instruct the data server for storing the modification instruction to delete the at least one modification instruction.
具体的,主控客户端在将各条修改指令分别发送给相应的客户端和数据服务器之后,向用于存储修改指令的数据服务器发送删除消息。用于存储修改指令的数据服务器在接收到删除消息之后,将相应的修改指令删除。Specifically, after sending each modification instruction to the corresponding client and data server respectively, the master control client sends a delete message to the data server for storing the modification instruction. After receiving the deletion message, the data server for storing the modification instruction deletes the corresponding modification instruction.
由于修改指令是与对象标识对应的,因此,当与对象标识对应的修改指令为多条时,该多条修改指令可以被认为是一组修改指令。用于存储修改指令的数据服务器将每组修改指令作为一个整体。Since the modification instruction corresponds to the object identifier, when there are multiple modification instructions corresponding to the object identifier, the plurality of modification instructions can be regarded as a group of modification instructions. The data server for storing modification instructions treats each set of modification instructions as a whole.
当主控客户端将每组修改指令中的各条修改指令,依次发送给对应的客户端和数据服务器之后,向用于存储修改指令的数据服务器发送删除消息,以指示该数据服务器将该组修改指令删除。After the main control client sends each modification instruction in each group of modification instructions to the corresponding client and data server in turn, it sends a delete message to the data server for storing the modification instructions to instruct the data server to delete the group Modify instruction to delete.
主控客户端将至少一条修改指令存储在数据服务器中,是为了提高元数据服务的性能。The main control client stores at least one modification instruction in the data server in order to improve the performance of the metadata service.
若主控客户端发生故障,中心节点将从其他客户端中重新选择一个客户端作为新的主控客户端。If the master client fails, the central node will reselect a client from other clients as the new master client.
新的主控客户端需要从用于存储修改指令的数据服务器中,获取当前未被删除的修改指令。由于当一组修改指令全部执行完毕时,该数据服务器将根据主控客户端的指示,将这一组修改指令删除,因此,如果该数据服务器中存在未被删除的修改指令,则说明未被删除的修改指令中的一条或多条是尚未被执行的。The new master control client needs to obtain the currently undeleted modification instructions from the data server used to store the modification instructions. Since when a group of modification instructions are all executed, the data server will delete this group of modification instructions according to the instruction of the master client, therefore, if there is an undeleted modification instruction in the data server, it means that it has not been deleted One or more of the modification instructions for is not yet executed.
新的主控客户端将从所述用于存储修改指令的数据服务器中获取到未被删除的修改指令之后,将所述未被删除的修改指令发送给所述未被删除的修改指令中的数据标识对应的客户端及数据服务器。由于未被删除的修改指令中包括数据标识和目标值,因此,新的主控客户端将各条修改指令依次发送给修改指令中的数据标识对应的客户端和数据服务器,以使得接收到修改指令的客户端和数据服务器将数据标识对应的元数据修改为目标值。After the new master control client obtains the undeleted modification instructions from the data server for storing the modification instructions, it sends the undeleted modification instructions to the The corresponding client and data server of the data identifier. Since the modification instructions that have not been deleted include data identifiers and target values, the new master client sends each modification instruction to the client and data server corresponding to the data identifiers in the modification instructions in turn, so that the modified The instruction client and data server modify the metadata corresponding to the data identifier to the target value.
同样的,当新的主控客户端将获取到的未被删除的修改指令发送给相应的客户端和数据服务器之后,向用于存储修改指令的数据服务器发送删除消息,以指示该数据服务器将执行完的修改指令删除。Similarly, after the new master client sends the obtained undeleted modification instruction to the corresponding client and data server, it sends a delete message to the data server for storing the modification instruction, to indicate that the data server will Executed modification commands are deleted.
主控客户端将所生成的修改指令,也存储在数据集群的数据服务器中,并且在主控客户端执行完各条修改指令之后,才指示存储修改指令的数据服务器将相应的修改指令删除,使得在一组修改指令全部执行完成之前,即使主控客户端发生故障,新的主控客户端仍能够获取到该组修改指令。通过由新的主控客户端将该组修改指令重新执行一遍,使得写请求所指示的需要对对象进行的修改能够全部被执行,并且保证了对元数据的修改在客户端和数据服务器中保持一致。The master control client also stores the generated modification instructions in the data server of the data cluster, and after the master control client executes each modification instruction, it instructs the data server storing the modification instructions to delete the corresponding modification instructions. This makes it possible for a new master client to obtain the set of modification instructions even if the master client fails before all the modification instructions are executed. By re-executing the group of modification instructions by the new master client, all the modifications to the object indicated by the write request can be executed, and the modification to the metadata is guaranteed to be maintained in the client and the data server unanimous.
进一步地,在主控客户端发生故障时,中心节点从其他客户端中选出一个新的主控客户端之后,还向除该新的主控客户端之外的其他客户端发送消息,以指示这些客户端将其客户端标识,以及各自所存储的对象标识和数据标识的对应关系,发送给新的主控客户端。从而,新的主控客户端能够获知每个客户端中所存储的对象标识与数据标识的对应关系。以供新的主控客户端根据数据标识查找到对象标识,进而查找到数据标识对应的客户端。Further, when the master client fails, after the central node selects a new master client from other clients, it also sends a message to other clients except the new master client, to These clients are instructed to send their client IDs and the corresponding relationship between their stored object IDs and data IDs to the new master client. Therefore, the new master client can know the corresponding relationship between the object identifier and the data identifier stored in each client. For the new master client to find the object identifier according to the data identifier, and then find the client corresponding to the data identifier.
图3为本发明实施例提供的又一元数据处理方法的流程图,如图3所示,该方法包括:Fig. 3 is a flowchart of another metadata processing method provided by an embodiment of the present invention. As shown in Fig. 3, the method includes:
301、接收读请求。其中,所述读请求中携带有对象标识。301. Receive a read request. Wherein, the read request carries an object identifier.
具体的,当用户所使用的客户端为除主控客户端以外的其他客户端时,该客户端在接收到用户发送的读请求时,首先根据读请求中所携带的对象标识,在其所存储的对象标识和元数据的对应关系中进行查找,若查找到与该对象标识对应的至少一个元数据,即表明该客户端中存储有该至少一个元数据。相应地,该客户端将查找到的各元数据返回给用户即可。Specifically, when the client used by the user is a client other than the master client, when the client receives the read request sent by the user, first, according to the object identifier carried in the read request, the The corresponding relationship between the stored object identifier and metadata is searched, and if at least one metadata corresponding to the object identifier is found, it indicates that the at least one metadata is stored in the client. Correspondingly, the client only needs to return the found metadata to the user.
当用户所使用的客户端为主控客户端时,主控客户端根据接收到的读请求中的对象标识,在其所存储的对应标识和元数据的对应关系中进行查找,若查找到与该对象标识对应的至少一个元数据,即表明该主控客户端中存储有该至少一个元数据。相应地,该主控客户端将查找到的各元数据返回给用户。When the client used by the user is the master client, the master client searches the corresponding relationship between the corresponding identifier and metadata stored in it according to the object identifier in the received read request. The object identifier corresponds to at least one piece of metadata, which means that the at least one piece of metadata is stored in the master client. Correspondingly, the master control client returns the found metadata to the user.
当用户所使用的客户端为除客户端以外的其他客户端,且在其上未查找到与对象标识对应的元数据时,则将该读请求发送给主控客户端。When the client used by the user is a client other than the client, and the metadata corresponding to the object identifier is not found on it, the read request is sent to the master client.
主控客户端在接收到该读请求之后,若能够在其上查找到与对象标识对应的各元数据,则将各元数据返回给该客户端。相应地,该客户端在接收到各元数据之后,将各元数据存储为与该对象标识对应的元数据。After the master client receives the read request, if it can find the metadata corresponding to the object identifier, it will return the metadata to the client. Correspondingly, after receiving the metadata, the client stores the metadata as metadata corresponding to the object identifier.
但是,主控客户端在接收到该读请求之后,若未能够在其上查找到与该对象标识对应的各元数据,则需要从数据集群中读取这些元数据。However, after receiving the read request, if the master client cannot find the metadata corresponding to the object identifier, it needs to read the metadata from the data cluster.
302、当在所存储的对象标识与元数据的对应关系中,未查找到与所述对象标识对应的元数据时,根据所述读请求,生成与所述对象标识对应的至少一条访问指令。其中,所述访问指令包括与所述对象标识对应的元数据的数据标识。302. When no metadata corresponding to the object identifier is found in the stored correspondence between the object identifier and the metadata, generate at least one access instruction corresponding to the object identifier according to the read request. Wherein, the access instruction includes a data identifier of metadata corresponding to the object identifier.
具体的,主控客户端中预先存储有对象标识与元数据的数据标识之间的对应关系。若主控客户端在其上未查找到与读请求中的对象标识对应的元数据,则根据该读请求,生成一条或多条与该对象标识对应的访问指令。Specifically, the corresponding relationship between the object identifier and the data identifier of the metadata is pre-stored in the master client. If the master client does not find the metadata corresponding to the object identifier in the read request, then generate one or more access instructions corresponding to the object identifier according to the read request.
由于主控客户端根据接收到的读请求,可以获知需要访问对象中的哪些元数据,因此主控客户端能够根据读请求生成一条或多条访问指令。每条访问指令中包括需要访问的元数据的数据标识。需要访问的元数据的数据标识是与读请求中的对象标识对应的。Since the master client can know which metadata in the object needs to be accessed according to the received read request, the master client can generate one or more access instructions according to the read request. Each access instruction includes the data identification of the metadata to be accessed. The data identifier of the metadata to be accessed corresponds to the object identifier in the read request.
303、将所述访问指令发送给所述数据标识对应的数据服务器。303. Send the access instruction to the data server corresponding to the data identifier.
具体的,由于主控客户端中存储有数据标识与数据服务器的对应关系。因此,主控客户端在生成访问指令之后,根据访问指令中的数据标识,将访问指令发送给与该数据标识对应的数据服务器。Specifically, since the corresponding relationship between the data identifier and the data server is stored in the master control client. Therefore, after generating the access instruction, the master client sends the access instruction to the data server corresponding to the data identifier according to the data identifier in the access instruction.
若主控客户端生成的访问指令为多条,则依次将每条访问指令发送给各数据标识对应的数据服务器。If there are multiple access instructions generated by the master client, each access instruction is sent to the data server corresponding to each data identifier in turn.
304、接收所述数据服务器根据所述数据标识返回的目标元数据。304. Receive target metadata returned by the data server according to the data identifier.
具体的,主控客户端在将访问指令发送给相应的数据服务器之后,即可等待该数据服务器返回相应的目标元数据。主控客户端接收到的目标元数据即为与访问指令中的数据标识对应的元数据。Specifically, after the master control client sends the access instruction to the corresponding data server, it can wait for the data server to return the corresponding target metadata. The target metadata received by the master client is the metadata corresponding to the data identifier in the access instruction.
本发明实施例提供的元数据处理方法,在主控客户端中未存储与读请求中的对象标识对应的元数据时,生成与该对象标识对应的一条或多条访问指令,并将各条访问指令发送给元数据的数据标识对应的数据服务器,以从数据服务器接收与数据标识对应的目标元数据。从而使得在客户端或主控客户端中均未存储相应的元数据时,才需要通过访问数据服务器获取相应的元数据,而当客户端和主控客户端上存储有相应的元数据,则可直接或间接地返回给用户,有效地提高了元数据服务的性能和效率。In the metadata processing method provided by the embodiment of the present invention, when no metadata corresponding to the object identifier in the read request is stored in the master client, one or more access instructions corresponding to the object identifier are generated, and each The access instruction is sent to the data server corresponding to the data identifier of the metadata, so as to receive the target metadata corresponding to the data identifier from the data server. Therefore, when the corresponding metadata is not stored in the client or the master client, it is necessary to obtain the corresponding metadata by accessing the data server, and when the corresponding metadata is stored on the client and the master client, then It can be directly or indirectly returned to the user, effectively improving the performance and efficiency of the metadata service.
图4为本发明实施例提供的又一元数据处理方法的流程图,如图4所示,该方法包括:Fig. 4 is a flowchart of another metadata processing method provided by an embodiment of the present invention. As shown in Fig. 4, the method includes:
401、接收读请求。其中,所述读请求中携带有对象标识、客户端标识。401. Receive a read request. Wherein, the read request carries an object identifier and a client identifier.
具体的,可以参见步骤301中所述的实现方式。Specifically, reference may be made to the implementation manner described in step 301.
进一步地,所述对象标识为文件标识或虚拟磁盘标识。Further, the object identifier is a file identifier or a virtual disk identifier.
在数据集群中存储的对象可以为文件,还可以为虚拟磁盘。相应地,当对象为文件时,对象标识为文件标识,元数据即为文件的元数据;当对象为虚拟磁盘时,对象标识为虚拟磁盘标识,元数据即为虚拟磁盘的元数据。The objects stored in the data cluster can be files or virtual disks. Correspondingly, when the object is a file, the object identifier is the file identifier, and the metadata is the metadata of the file; when the object is a virtual disk, the object identifier is the virtual disk identifier, and the metadata is the metadata of the virtual disk.
需要说明的是,文件和虚拟磁盘仅为存储在数据集群中的两种对象形式,可选的对象形式并不仅限于此。对于可以存储在分布式系统中的其他形式的对象的元数据,同样可以采用本发明各实施例中所述的元数据处理方法和客户端进行处理。It should be noted that files and virtual disks are only two object forms stored in the data cluster, and the optional object forms are not limited thereto. Metadata of other forms of objects that can be stored in the distributed system can also be processed by using the metadata processing methods and clients described in the various embodiments of the present invention.
进一步地,当主控客户端接收到的读请求来自于其他客户端的情况下,在读请求中还可以携带客户端标识。以供主控客户端将在其上查找到的元数据,或者从数据服务器接收到的目标元数据发送给该客户端标识对应的客户端。并且,主控客户端还会存储该客户端标识与对象标识的对应关系,以供在进行写操作时,不仅将修改指令发送给数据标识对应的数据服务器,还根据数据标识与对象标识的对应关系,将修改指令发送给数据标识对应的客户端。Further, when the read request received by the master client comes from other clients, the read request may also carry the client identifier. The master client sends the metadata found on it, or the target metadata received from the data server, to the corresponding client identified by the client. Moreover, the master client will also store the corresponding relationship between the client ID and the object ID, so that when performing a write operation, it not only sends the modification instruction to the data server corresponding to the data ID, but also relationship, and send the modification command to the client corresponding to the data identifier.
402、当在所存储的对象标识与元数据的对应关系中,未查找到与所述对象标识对应的元数据时,根据所述读请求,生成与所述对象标识对应的至少一条访问指令。402. When no metadata corresponding to the object identifier is found in the stored correspondence between object identifiers and metadata, generate at least one access instruction corresponding to the object identifier according to the read request.
具体的,可以参见步骤302中所述的实现方式。Specifically, reference may be made to the implementation manner described in step 302 .
403、将所述访问指令发送给所述数据标识对应的数据服务器。403. Send the access instruction to the data server corresponding to the data identifier.
具体的,可以参见步骤303中所述的实现方式。Specifically, reference may be made to the implementation manner described in step 303 .
404、接收所述数据服务器根据所述数据标识返回的目标元数据。404. Receive target metadata returned by the data server according to the data identifier.
具体的,可以参见步骤304中所述的实现方式。Specifically, reference may be made to the implementation manner described in step 304 .
405、将所述目标元数据发送给所述客户端标识对应的客户端,以供所述客户端将所述目标元数据保存为与所述对象标识对应的元数据。405. Send the target metadata to a client corresponding to the client identifier, so that the client saves the target metadata as metadata corresponding to the object identifier.
具体的,主控客户端在从数据服务器接收到目标元数据之后,将目标元数据发送给客户端标识对应的客户端。接收到目标元数据的客户端将该目标元数据保存为与读请求中携带的对象标识对应的元数据。从而,当该客户端再次接收到携带有该对象标识的读请求中,即可从其所存储的对象标识与元数据的对应关系中查找到该元数据,进而直接将该元数据返回给用户,而无需将读请求发送给主控客户端,有效地提高了元数据服务的性能和效率。Specifically, after receiving the target metadata from the data server, the master client sends the target metadata to the client corresponding to the client identifier. The client receiving the target metadata saves the target metadata as metadata corresponding to the object identifier carried in the read request. Therefore, when the client receives the read request carrying the object identifier again, it can find the metadata from the stored correspondence between the object identifier and the metadata, and then directly return the metadata to the user , without sending the read request to the master client, effectively improving the performance and efficiency of the metadata service.
在上述各实施例中,主控客户端与中心节点之间设置心跳机制。中心节点如果一直能够检测到主控客户端的心跳,则可判定该主控客户端处于正常的工作状态;中心节点如果在预设的时间长度内检测不到主控客户端的心跳,则判定该主控客户端发生故障,进而从其他的客户端中重新选择新的主控客户端。此外,主控客户端还可以通过直接向中心节点发送请求消息的方式,请求中心节点从其他的客户端中重新选择新的主控客户端。In each of the above embodiments, a heartbeat mechanism is set between the main control client and the central node. If the central node can always detect the heartbeat of the master client, it can determine that the master client is in a normal working state; if the central node cannot detect the heartbeat of the master client within the preset If the control client fails, then re-select a new master client from other clients. In addition, the master client can also request the central node to reselect a new master client from other clients by directly sending a request message to the central node.
进一步地,除主控客户端以外的其他客户端也可以与中心节点保持心跳。同样的,中心节点能够检测到心跳的客户端是处于正常工作状态的客户端;中心节点检测不到心跳的客户端可能处于故障的工作状态。当中心节点从各客户端中重新选择主控客户端时,优选地从可检测到心跳的客户端中进行选择。Further, other clients except the master client can also keep heartbeat with the central node. Similarly, the client whose heartbeat can be detected by the central node is a client in normal working state; the client whose heartbeat cannot be detected by the central node may be in a faulty working state. When the central node reselects the master client from the clients, it preferably selects from the clients whose heartbeat can be detected.
进一步地,当主控客户端以外的其他客户端在从故障的工作状态恢复为正常的工作状态时,不仅需要与中心节点建立心跳,还需要将其客户端标识,及其所存储的对象标识与数据标识的对应关系发送给主控客户端,以供主控客户端更新该客户端的相关信息。Furthermore, when other clients other than the master client recover from a faulty working state to a normal working state, they not only need to establish a heartbeat with the central node, but also need to identify their client IDs and their stored object IDs. The corresponding relationship with the data identifier is sent to the master client, so that the master client can update the relevant information of the client.
图5为本发明实施例提供的客户端的结构示意图,如图5所示,该客户端包括接收单元11、处理单元12和发送单元13。FIG. 5 is a schematic structural diagram of a client provided by an embodiment of the present invention. As shown in FIG. 5 , the client includes a receiving unit 11 , a processing unit 12 and a sending unit 13 .
接收单元11,用于接收写请求,所述写请求中携带有对象标识;The receiving unit 11 is configured to receive a write request, where the write request carries an object identifier;
处理单元12,用于根据所述写请求,生成与所述对象标识对应的至少一条修改指令,所述修改指令包括数据标识和与所述数据标识对应的目标值,所述数据标识为与所述对象标识对应的至少一个元数据中的需要进行修改的元数据的标识;The processing unit 12 is configured to generate at least one modification instruction corresponding to the object identifier according to the write request, the modification instruction includes a data identifier and a target value corresponding to the data identifier, and the data identifier is corresponding to the object identifier The identifier of the metadata that needs to be modified in at least one metadata corresponding to the object identifier;
发送单元13,用于将所述修改指令发送给所述数据标识对应的客户端及数据服务器,以供所述客户端和所述数据服务器分别根据所述修改指令,将所述数据标识对应的元数据修改为所述目标值。The sending unit 13 is configured to send the modification instruction to the client and the data server corresponding to the data identifier, so that the client and the data server can respectively send the modification instruction to the client corresponding to the data identifier. Metadata is modified to the target value.
进一步地,所述处理单元12还用于:Further, the processing unit 12 is also used for:
在根据所述写请求,生成与所述对象标识对应的至少一条修改指令之后,将所述至少一条修改指令发送至用于存储修改指令的数据服务器;After generating at least one modification instruction corresponding to the object identifier according to the write request, sending the at least one modification instruction to a data server for storing the modification instruction;
相应地,所述发送单元13还用于:Correspondingly, the sending unit 13 is also used for:
在将所述至少一条修改指令分别发送给所述数据标识对应的客户端及数据服务器之后,向所述用于存储修改指令的数据服务器发送删除消息,以指示所述用于存储修改指令的数据服务器删除所述至少一条修改指令。After sending the at least one modification instruction to the client and the data server corresponding to the data identifier, send a delete message to the data server for storing the modification instruction to indicate that the data for storing the modification instruction The server deletes the at least one modification instruction.
图6为本发明实施例提供的另一客户端的结构示意图,如图6所示,该客户端还可以包括获取单元14。FIG. 6 is a schematic structural diagram of another client provided by an embodiment of the present invention. As shown in FIG. 6 , the client may further include an acquisition unit 14 .
获取单元14,用于从所述用于存储修改指令的数据服务器中获取未被删除的修改指令;An acquisition unit 14, configured to acquire undeleted modification instructions from the data server for storing modification instructions;
相应地,所述发送单元13还用于:Correspondingly, the sending unit 13 is also used for:
将所述未被删除的修改指令发送给所述未被删除的修改指令中的数据标识对应的客户端及数据服务器。Send the undeleted modification instruction to the client and the data server corresponding to the data identifier in the undeleted modification instruction.
进一步地,所述接收单元11接收到的所述写请求中的所述对象标识为文件标识或虚拟磁盘标识。Further, the object identifier in the write request received by the receiving unit 11 is a file identifier or a virtual disk identifier.
具体的,本发明实施例提供的客户端进行元数据处理的方法,可以参见上述对应的方法实施例中所述的操作步骤,此处不再赘述。Specifically, for the method for processing metadata by the client provided in the embodiment of the present invention, reference may be made to the operation steps described in the corresponding method embodiment above, which will not be repeated here.
本发明实施例提供的客户端,根据写请求生成与对象标识对应的至少一条修改指令,在该修改指令中包括需要修改的元数据的数据标识以及对该元数据进行修改的目标值,将各条修改指令分别发送给存储对应的元数据的客户端和数据服务器,从而使得客户端和数据服务器中所存储的元数据能够得到同步的更新,保证了分布式系统中对数据进行存储的一致性,此外,由于各客户端的写请求均需要通过作为主控客户端的客户端,发送给数据集群中的数据服务器,避免了由于多个客户端同时发送写请求而出现写冲突的情况,有效地保证了分布式系统提供元数据服务的性能。The client provided by the embodiment of the present invention generates at least one modification instruction corresponding to the object identifier according to the write request, and the modification instruction includes the data identifier of the metadata to be modified and the target value for modifying the metadata, and converts each The modification instructions are sent to the client and the data server that store the corresponding metadata, so that the metadata stored in the client and the data server can be updated synchronously, ensuring the consistency of data storage in the distributed system , in addition, since the write requests of each client need to be sent to the data server in the data cluster through the client as the master client, avoiding the situation of writing conflicts caused by multiple clients sending write requests at the same time, effectively ensuring It improves the performance of the distributed system to provide metadata services.
图7为本发明实施例提供的又一客户端的结构示意图,如图7所示,该客户端包括接收单元21、处理单元22和发送单元23。FIG. 7 is a schematic structural diagram of another client provided by an embodiment of the present invention. As shown in FIG. 7 , the client includes a receiving unit 21 , a processing unit 22 and a sending unit 23 .
接收单元21,用于接收读请求,所述读请求中携带有对象标识;The receiving unit 21 is configured to receive a read request, wherein the read request carries an object identifier;
处理单元22,当在所存储的对象标识与元数据的对应关系中,未查找到与所述对象标识对应的元数据时,根据所述读请求,生成与所述对象标识对应的至少一条访问指令,所述访问指令包括与所述对象标识对应的元数据的数据标识;The processing unit 22, when the metadata corresponding to the object identifier is not found in the stored correspondence between the object identifier and the metadata, according to the read request, generate at least one access item corresponding to the object identifier an instruction, the access instruction including a data identifier of metadata corresponding to the object identifier;
发送单元23,用于将所述访问指令发送给所述数据标识对应的数据服务器;A sending unit 23, configured to send the access instruction to a data server corresponding to the data identifier;
相应地,所述接收单元21还用于,接收所述数据服务器根据所述数据标识返回的目标元数据。Correspondingly, the receiving unit 21 is further configured to receive target metadata returned by the data server according to the data identifier.
进一步地,所述接收单元21接收到的所述读请求中还携带有客户端标识;Further, the read request received by the receiving unit 21 also carries a client identifier;
相应地,所述发送单元23还用于:Correspondingly, the sending unit 23 is also used for:
在接收到所述数据服务器根据所述数据标识返回的目标元数据之后,将所述目标元数据发送给所述客户端标识对应的客户端,以供所述客户端将所述目标元数据保存为与所述对象标识对应的元数据。After receiving the target metadata returned by the data server according to the data identifier, sending the target metadata to a client corresponding to the client identifier, so that the client can save the target metadata is the metadata corresponding to the object ID.
进一步地,所述接收单元接收到的所述读请求中的所述对象标识为文件标识或虚拟磁盘标识。Further, the object identifier in the read request received by the receiving unit is a file identifier or a virtual disk identifier.
具体的,本发明实施例提供的客户端进行元数据处理的方法,可以参见上述对应的方法实施例中所述的操作步骤,此处不再赘述。Specifically, for the method for processing metadata by the client provided in the embodiment of the present invention, reference may be made to the operation steps described in the corresponding method embodiment above, which will not be repeated here.
本发明实施例提供的客户端,在未存储与读请求中的对象标识对应的元数据时,生成与该对象标识对应的一条或多条访问指令,并将各条访问指令发送给元数据的数据标识对应的数据服务器,以从数据服务器接收与数据标识对应的目标元数据。从而使得在客户端或主控客户端中均未存储相应的元数据时,才需要通过访问数据服务器获取相应的元数据,而当客户端和主控客户端上存储有相应的元数据,则可直接或间接地返回给用户,有效地提高了元数据服务的性能和效率。The client provided by the embodiment of the present invention, when the metadata corresponding to the object identifier in the read request is not stored, generates one or more access instructions corresponding to the object identifier, and sends each access instruction to the metadata server. A data server corresponding to the data identifier is used to receive target metadata corresponding to the data identifier from the data server. Therefore, when the corresponding metadata is not stored in the client or the master client, it is necessary to obtain the corresponding metadata by accessing the data server, and when the corresponding metadata is stored on the client and the master client, then It can be directly or indirectly returned to the user, effectively improving the performance and efficiency of the metadata service.
图8为本发明实施例提供的又一客户端的结构示意图,如图8所示,该客户端包括:FIG. 8 is a schematic structural diagram of another client provided by an embodiment of the present invention. As shown in FIG. 8, the client includes:
处理器31、存储器32、总线33和通信接口34。处理器31、存储器32和通信接口34之间通过总线33连接并完成相互间的通信。Processor 31 , memory 32 , bus 33 and communication interface 34 . The processor 31 , the memory 32 and the communication interface 34 are connected through the bus 33 to complete mutual communication.
处理器31可能为单核或多核中央处理单元(Central Processing Unit,CPU),或者为特定集成电路(Application Specific Integrated Circuit,ASIC),或者为被配置成实施本发明实施例的一个或多个集成电路。The processor 31 may be a single-core or multi-core central processing unit (Central Processing Unit, CPU), or a specific integrated circuit (Application Specific Integrated Circuit, ASIC), or be configured to implement one or more integrated circuits of the embodiments of the present invention. circuit.
存储器32可以为高速RAM存储器,也可以为非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。The memory 32 can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory.
存储器32用于存放程序321。具体的,程序321中可以包括程序代码,所述程序代码包括计算机操作指令。The memory 32 is used to store the program 321 . Specifically, the program 321 may include program codes, where the program codes include computer operation instructions.
通信接口34,用于接收写请求,所述写请求中携带有对象标识;A communication interface 34, configured to receive a write request, where the write request carries an object identifier;
处理器31运行程序321,以执行:Processor 31 runs program 321 to perform:
根据所述写请求,生成与所述对象标识对应的至少一条修改指令,所述修改指令包括数据标识和与所述数据标识对应的目标值,所述数据标识为与所述对象标识对应的至少一个元数据中的需要进行修改的元数据的标识;According to the write request, at least one modification instruction corresponding to the object identifier is generated, the modification instruction includes a data identifier and a target value corresponding to the data identifier, and the data identifier is at least one corresponding to the object identifier The identifier of the metadata that needs to be modified in a metadata;
将所述修改指令发送给所述数据标识对应的客户端及数据服务器,以供所述客户端和所述数据服务器分别根据所述修改指令,将所述数据标识对应的元数据修改为所述目标值。sending the modification instruction to the client and the data server corresponding to the data identifier, so that the client and the data server can modify the metadata corresponding to the data identifier to the target value.
具体的,本发明实施例提供的客户端进行元数据处理的方法,可以参见上述对应的方法实施例中所述的操作步骤,此处不再赘述。Specifically, for the method for processing metadata by the client provided in the embodiment of the present invention, reference may be made to the operation steps described in the corresponding method embodiment above, which will not be repeated here.
图9为本发明实施例提供的又一客户端的结构示意图,如图9所示,该FIG. 9 is a schematic structural diagram of another client provided by an embodiment of the present invention. As shown in FIG. 9, the
客户端包括:Clients include:
处理器41、存储器42、总线43和通信接口44。处理器41、存储器42和通信接口44之间通过总线43连接并完成相互间的通信。Processor 41 , memory 42 , bus 43 and communication interface 44 . The processor 41 , the memory 42 and the communication interface 44 are connected through the bus 43 to complete mutual communication.
处理器41可能为单核或多核中央处理单元(Central Processing Unit,CPU),或者为特定集成电路(Application Specific Integrated Circuit,ASIC),或者为被配置成实施本发明实施例的一个或多个集成电路。The processor 41 may be a single-core or multi-core central processing unit (Central Processing Unit, CPU), or a specific integrated circuit (Application Specific Integrated Circuit, ASIC), or be configured to implement one or more integrated circuits of the embodiments of the present invention. circuit.
存储器42可以为高速RAM存储器,也可以为非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。The memory 42 can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory.
存储器42用于存放程序421。具体的,程序421中可以包括程序代码,所述程序代码包括计算机操作指令。The memory 42 is used to store the program 421 . Specifically, the program 421 may include program codes, where the program codes include computer operation instructions.
通信接口44,用于接收读请求,所述读请求中携带有对象标识;A communication interface 44, configured to receive a read request, wherein the read request carries an object identifier;
处理器41运行程序421,以执行:Processor 41 runs program 421 to perform:
若在所存储的对象标识与元数据的对应关系中,未查找到与所述对象标识对应的元数据,则根据所述读请求,生成与所述对象标识对应的至少一条访问指令,所述访问指令包括与所述对象标识对应的元数据的数据标识;If no metadata corresponding to the object identifier is found in the stored correspondence between the object identifier and the metadata, at least one access instruction corresponding to the object identifier is generated according to the read request, and the The access instruction includes a data identifier of metadata corresponding to the object identifier;
将所述访问指令发送给所述数据标识对应的数据服务器;Send the access instruction to the data server corresponding to the data identifier;
接收所述数据服务器根据所述数据标识返回的目标元数据。receiving target metadata returned by the data server according to the data identifier.
具体的,本发明实施例提供的客户端进行元数据处理的方法,可以参见上述对应的方法实施例中所述的操作步骤,此处不再赘述。Specifically, for the method for processing metadata by the client provided in the embodiment of the present invention, reference may be made to the operation steps described in the corresponding method embodiment above, which 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 (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210554481.1A CN103095687B (en) | 2012-12-19 | 2012-12-19 | Metadata processing method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210554481.1A CN103095687B (en) | 2012-12-19 | 2012-12-19 | Metadata processing method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103095687A CN103095687A (en) | 2013-05-08 |
| CN103095687B true CN103095687B (en) | 2015-08-26 |
Family
ID=48207820
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201210554481.1A Active CN103095687B (en) | 2012-12-19 | 2012-12-19 | Metadata processing method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103095687B (en) |
Families Citing this family (18)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103875229B (en) * | 2013-12-02 | 2017-04-26 | 华为技术有限公司 | asynchronous replication method, device and system |
| CN104090897B (en) * | 2013-12-19 | 2016-05-04 | 深圳市腾讯计算机系统有限公司 | Method, server and the system of accesses meta-data |
| WO2016118627A1 (en) | 2015-01-20 | 2016-07-28 | Ultrata Llc | Managing meta-data in an object memory fabric |
| WO2016118615A1 (en) | 2015-01-20 | 2016-07-28 | Ultrata Llc | Object memory data flow instruction execution |
| US9886210B2 (en) | 2015-06-09 | 2018-02-06 | Ultrata, Llc | Infinite memory fabric hardware implementation with router |
| US10698628B2 (en) | 2015-06-09 | 2020-06-30 | Ultrata, Llc | Infinite memory fabric hardware implementation with memory |
| CN106293929B (en) * | 2015-06-11 | 2020-10-27 | 联想(北京)有限公司 | Data processing method and first electronic device |
| CN115061971A (en) | 2015-12-08 | 2022-09-16 | 乌尔特拉塔有限责任公司 | Memory fabric operation and consistency using fault tolerant objects |
| EP3387547B1 (en) | 2015-12-08 | 2023-07-05 | Ultrata LLC | Memory fabric software implementation |
| CN105959420A (en) * | 2016-07-15 | 2016-09-21 | 浪潮(北京)电子信息产业有限公司 | Multi-client metadata synchronous update method and device |
| CN106131227A (en) * | 2016-08-31 | 2016-11-16 | 浪潮(北京)电子信息产业有限公司 | Balancing method of loads, meta data server system and load balance system |
| CN106845259B (en) * | 2017-02-28 | 2019-12-17 | 苏州浪潮智能科技有限公司 | A Distributed File Read and Write Permission Setting Method |
| CN108595109B (en) * | 2017-12-29 | 2021-06-29 | 郑州云海信息技术有限公司 | A method of multi-client writing based on Ceph distributed storage system |
| CN108897822A (en) * | 2018-06-21 | 2018-11-27 | 郑州云海信息技术有限公司 | A kind of data-updating method, device, equipment and readable storage medium storing program for executing |
| CN110224988B (en) * | 2019-05-10 | 2023-04-07 | 视联动力信息技术股份有限公司 | Image data processing method, system and device and storage medium |
| CN111339046B (en) * | 2020-02-26 | 2023-09-19 | 中国工商银行股份有限公司 | Method and device for writing, reading and deleting data of file |
| CN113452730B (en) * | 2020-03-25 | 2022-04-29 | 阿里巴巴集团控股有限公司 | Object read management method, device, electronic device, and computer storage medium |
| CN116185962A (en) * | 2022-12-16 | 2023-05-30 | 中国联合网络通信集团有限公司 | Data processing method and device based on distributed file system |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1852318A (en) * | 2006-04-19 | 2006-10-25 | 华中科技大学 | Distributed multi-stage buffer storage system suitable for object network storage |
| CN101217571A (en) * | 2008-01-18 | 2008-07-09 | 清华大学 | Methods for write/read file operations in a multi-replica data grid system |
| CN101741911A (en) * | 2009-12-18 | 2010-06-16 | 中兴通讯股份有限公司 | Multi-copy collaboration-based write operation method, system and node |
| CN102411637A (en) * | 2011-12-30 | 2012-04-11 | 创新科软件技术(深圳)有限公司 | Metadata management method of distributed file system |
| CN102567445A (en) * | 2011-10-25 | 2012-07-11 | 无锡城市云计算中心有限公司 | Method for guaranteeing consistency of metadata in distributed file system |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8965862B2 (en) * | 2010-09-17 | 2015-02-24 | Microsoft Corporation | Directory oplock |
-
2012
- 2012-12-19 CN CN201210554481.1A patent/CN103095687B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1852318A (en) * | 2006-04-19 | 2006-10-25 | 华中科技大学 | Distributed multi-stage buffer storage system suitable for object network storage |
| CN101217571A (en) * | 2008-01-18 | 2008-07-09 | 清华大学 | Methods for write/read file operations in a multi-replica data grid system |
| CN101741911A (en) * | 2009-12-18 | 2010-06-16 | 中兴通讯股份有限公司 | Multi-copy collaboration-based write operation method, system and node |
| CN102567445A (en) * | 2011-10-25 | 2012-07-11 | 无锡城市云计算中心有限公司 | Method for guaranteeing consistency of metadata in distributed file system |
| CN102411637A (en) * | 2011-12-30 | 2012-04-11 | 创新科软件技术(深圳)有限公司 | Metadata management method of distributed file system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103095687A (en) | 2013-05-08 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103095687B (en) | Metadata processing method and device | |
| CN106372221B (en) | A kind of method of file synchronization, equipment and system | |
| US10534547B2 (en) | Consistent transition from asynchronous to synchronous replication in hash-based storage systems | |
| JP5411250B2 (en) | Data placement according to instructions to redundant data storage system | |
| US9305072B2 (en) | Information storage system and data replication method thereof | |
| US9952783B2 (en) | Data processing method and apparatus, and shared storage device | |
| US11157445B2 (en) | Indexing implementing method and system in file storage | |
| CN103718533B (en) | Method, device and system for issuing partition balance subtasks | |
| US9952940B2 (en) | Method of operating a shared nothing cluster system | |
| CN107451013B (en) | Data recovery method, device and system based on distributed system | |
| CN102708165A (en) | Method and device for processing files in distributed file system | |
| WO2012124178A1 (en) | Distributed storage system and distributed storage method | |
| CN111049928A (en) | Data synchronization method, system, electronic device and computer readable storage medium | |
| KR101527634B1 (en) | Method and apparatus for providing sharding service | |
| CA2893304A1 (en) | Data storage method, data storage apparatus, and storage device | |
| CN107657027B (en) | Data storage method and device | |
| CN118152185B (en) | Method, system, device, computer equipment and medium for recovering backup of fragmented clusters | |
| CN110413694A (en) | Metadata management method and relevant apparatus | |
| CN115510036B (en) | Data migration methods, apparatus, equipment and storage media | |
| CN107291876A (en) | A kind of DDM method | |
| CN103440204A (en) | Method for updating file system and storage device | |
| CN116466876A (en) | A storage system and data processing method | |
| CN109597903A (en) | Image file processing apparatus and method, document storage system and storage medium | |
| CN109407975B (en) | Writing data method and computing node and distributed storage system | |
| CN112711382A (en) | Data storage method and device based on distributed system and storage node |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| TR01 | Transfer of patent right | ||
| TR01 | Transfer of patent right |
Effective date of registration: 20220601 Address after: No. 1899 Xiyuan Avenue, high tech Zone (West District), Chengdu, Sichuan 610041 Patentee after: Chengdu Huawei Technologies Co.,Ltd. Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd. |