Aggregate access method, device and equipment for dispersed cluster, storage medium and product
Through unified name space and intelligent request routing mechanism, the wide-area distributed HDFS clusters are aggregated, which solves the problem that traditional technology is difficult to achieve unified access management, and realizes the simple unified access and seamless transparent data of HDFS clients to multiple clusters. Interaction.
Patent Information
- Application Number
- CN202411296884.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-09-14
AI Technical Summary
The prior art is difficult to achieve unified access management of multiple HDFS clusters distributed in wide areas, and the traditional methods are complex and difficult to configure, making seamless and transparent data access impossible.
A unified name space is used to aggregate multiple HDFS clusters. Through intelligent request analysis and routing mechanisms, the content of the aggregate request is parsed, and the request is routed to the appropriate HDFS cluster based on the actual physical location of the data and the client needs to realize data access. Seamless transparent.
It simplifies the data access of HDFS clients to multiple clusters, reduces the complexity of configuration management, realizes unified access management for wide-area distributed clusters, and improves the efficiency and scalability of data access.
Smart Images

Figure CN119299523A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data access technology, and in particular to a method, device, equipment, storage medium and product for aggregated access of a distributed cluster. Background Art
[0002] Currently, HDFS (Hadoop Distributed File System) cluster access is usually achieved by combining the HDFS federation mechanism with the ViewFS (View File System) mechanism, which can significantly increase the scalability and fault tolerance of a single HDFS cluster and provide a simple unified access view for HDFS clients. However, since the ViewFS mechanism needs to be configured on all clients, it is more complicated to manage. Different clients require different configurations. Adding new clients or user directories requires a complete change to the client configuration, which increases the management burden of configuration management and the complexity of subsequent operations and maintenance. In addition, it still focuses on a single HDFS cluster and cannot achieve unified access management for multiple HDFS clusters that are widely dispersed.
[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of this application is to provide a method, device, equipment, storage medium and product for aggregated access of distributed clusters, aiming to solve the technical problem that traditional methods in the prior art are difficult to achieve unified access management of multiple HDFS clusters distributed over a wide area.
[0005] To achieve the above object, the present application provides a decentralized cluster aggregation access method, the method comprising:
[0006] Based on the unified namespace, multiple scattered HDFS clusters are aggregated to obtain an aggregated cluster;
[0007] Obtaining an aggregate access request from an HDFS client to the aggregate cluster, parsing the aggregate access request, and determining target data, target node, and request type of the aggregate access request;
[0008] Based on the target data, target node and request type of the aggregate access request, the aggregate access request is routed to the corresponding target HDFS cluster in the aggregate cluster, and the data blocks in the target HDFS cluster are accessed.
[0009] In one embodiment, the step of routing the aggregate access request to a corresponding target HDFS cluster in the aggregate cluster based on the target data, target node, and request type of the aggregate access request, and accessing the data blocks in the target HDFS cluster includes:
[0010] When the target node of the aggregate access request is a metadata management node, based on the logical address of the target data of the aggregate access request, determine the physical address of the target HDFS cluster corresponding to the target data, and adjust the aggregate access request;
[0011] Based on the physical address of the target HDFS cluster, the adjusted aggregate access request is routed to the metadata management node corresponding to the target HDFS cluster, and the data block in the metadata management node of the target HDFS cluster is accessed.
[0012] In one embodiment, the step of determining the physical address of the target data corresponding to the target HDFS cluster based on the logical address of the target data includes:
[0013] Obtain an address mapping table of the aggregation cluster, where the address mapping table stores the physical address of the HDFS cluster and the logical address mapped from the physical address of the HDFS cluster;
[0014] Based on the logical address of the target data, determining in the address mapping table a physical address that matches the logical address of the target data;
[0015] The HDFS cluster corresponding to the matched physical address is used as the target HDFS cluster corresponding to the target data, and the physical address of the target HDFS cluster is obtained.
[0016] In one embodiment, the step of routing the aggregate access request to a corresponding target HDFS cluster in the aggregate cluster based on the target data, target node, and request type of the aggregate access request, and accessing the data blocks in the target HDFS cluster includes:
[0017] When the target node of the aggregate access request is a data storage node, obtaining request return information of a metadata management node in the aggregate cluster;
[0018] Based on the request return information, determine a target data block of the target data of the aggregate access request in the target node and a physical address of the target node corresponding to the target data block;
[0019] When the request type of the aggregate access request is a write request, the target HDFS cluster of the aggregate access request is determined based on the physical address of the target node, and the aggregate access request is routed to the corresponding data storage node in the target HDFS cluster to access the target data block.
[0020] In one embodiment, after the step of determining, based on the request return information, the target data block of the target data of the aggregate access request in the target node and the physical address of the target node corresponding to the target data block, the step further includes:
[0021] When the request type of the aggregate access request is a read request, obtaining a cache data block of the aggregate cluster;
[0022] When the target data block corresponding to the aggregate access request matches the cache data block, determining that the aggregate access request is a cache hit read request, routing the cache hit read request to the corresponding cache data block based on the cache address of the cache data block, and accessing the cache data block;
[0023] When the target data block corresponding to the aggregate access request does not conform to the cache data block, the aggregate access request is determined to be a non-cache hit read request, and the target HDFS cluster of the cache hit read request is determined based on the physical address of the target node, and the non-cache hit read request is routed to the corresponding data storage node in the target HDFS cluster to access the target data block.
[0024] In one embodiment, the method further comprises:
[0025] Obtaining the status of data blocks of data storage nodes in the aggregation cluster;
[0026] The data blocks in the completely written state are taken as candidate data blocks;
[0027] Based on the data heat of the candidate data blocks, a cache data block of the aggregation cluster is determined.
[0028] In addition, to achieve the above purpose, the present application also proposes a decentralized cluster aggregate access device, the decentralized cluster aggregate access device comprising:
[0029] Aggregation module, used to aggregate multiple scattered HDFS clusters based on a unified namespace to obtain an aggregated cluster;
[0030] An access module is used to obtain an aggregate access request from an HDFS client to the aggregate cluster, parse the aggregate access request, and determine target data, target node, and request type of the aggregate access request;
[0031] The access module is further used to route the aggregate access request to the corresponding target HDFS cluster in the aggregate cluster based on the target data, target node and request type of the aggregate access request, and access the data blocks in the target HDFS cluster.
[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes an aggregate access device for a dispersed cluster, wherein the aggregate access device for a dispersed cluster comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the aggregate access method for a dispersed cluster as described above.
[0033] In addition, to achieve the above objectives, the present invention also proposes a storage medium, which is a computer-readable storage medium, and stores a computer program on the storage medium. When the computer program is executed by a processor, the steps of the aggregate access method of the distributed cluster as described above are implemented.
[0034] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the aggregate access method of the dispersed cluster as described above are implemented.
[0035] The present application provides a method for aggregated access of dispersed clusters. Based on a unified namespace, multiple dispersed HDFS clusters are aggregated to obtain an aggregated cluster; the aggregated access request of the HDFS client to the aggregated cluster is obtained, the aggregated access request is parsed, and the target data, target node, and request type of the aggregated access request are determined; based on the target data, target node, and request type of the aggregated access request, the aggregated access request is routed to the corresponding target HDFS cluster in the aggregated cluster to access the data blocks in the target HDFS cluster. The present application uses a unified namespace to aggregate widely dispersed HDFS clusters to form a concise and unified data access view, so that the HDFS client can simply and uniformly access the data in each cluster, and through an intelligent request analysis and routing mechanism, the content of the aggregated request is parsed in real time, and the request is routed to the appropriate HDFS cluster according to the actual physical location of the data and the needs of the HDFS client, so as to ensure seamless and transparent data access and realize data interaction, thus solving the technical problem that it is difficult to realize unified access management of multiple widely dispersed HDFS clusters by traditional methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0038] Figure 1 A flowchart of Embodiment 1 of the method for aggregated access of a distributed cluster of the present application;
[0039] Figure 2 A schematic diagram of a unified namespace for a method for aggregated access to a distributed cluster provided in Example 1 of the present application;
[0040] Figure 3 A schematic diagram of the overall architecture of the aggregated access method for a distributed cluster provided in Example 1 of the present application;
[0041] Figure 4 This is a schematic diagram of the address mapping representation of the aggregate access method for the dispersed cluster provided in the first embodiment of the present application;
[0042] Figure 5 This is a flow chart of Embodiment 2 of the method for aggregated access of a distributed cluster of the present application;
[0043] Figure 6 This is a flow chart of Embodiment 3 of the method for aggregated access of a distributed cluster of the present application;
[0044] Figure 7 This is a schematic diagram of the module structure of the aggregate access device of the dispersed cluster according to the embodiment of the present application;
[0045] Figure 8 Schematic diagram of the device structure of the hardware operating environment involved in the aggregated access method of the dispersed cluster in the embodiment of the present application.
[0046] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0048] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0049] The main solution of the embodiment of the present application is: based on a unified namespace, multiple scattered HDFS clusters are aggregated to obtain an aggregated cluster; the aggregated access request of the HDFS client to the aggregated cluster is obtained, the aggregated access request is parsed, and the target data, target node and request type of the aggregated access request are determined; based on the target data, target node and request type of the aggregated access request, the aggregated access request is routed to the corresponding target HDFS cluster in the aggregated cluster, and the data blocks in the target HDFS cluster are accessed.
[0050] Currently, HDFS cluster access is usually achieved by combining the HDFS federation mechanism with the ViewFS mechanism, which can significantly increase the scalability and fault tolerance of a single HDFS cluster and provide a simple unified access view for HDFS clients. However, since the ViewFS mechanism needs to be configured on all clients, it is more complicated to manage. Different clients require different configurations. Adding new clients or user directories requires a complete change of the client configuration, which increases the management burden of configuration management and the complexity of subsequent operations and maintenance. In addition, it still focuses on a single HDFS cluster and cannot achieve unified access management of multiple HDFS clusters dispersed over a wide area.
[0051] This application provides a solution that uses a unified namespace to aggregate widely dispersed HDFS clusters to form a concise and unified data access view, allowing HDFS clients to simply and uniformly access data in each cluster. Through intelligent request analysis and routing mechanisms, the content of aggregated requests is parsed in real time, and the requests are routed to the appropriate HDFS cluster based on the actual physical location of the data and the needs of the HDFS client, ensuring seamless and transparent data access and achieving data interaction, solving the technical problem that traditional methods are difficult to achieve unified access management of multiple widely dispersed HDFS clusters.
[0052] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a decentralized cluster aggregation access device, etc., and this embodiment does not specifically limit this. The following takes a decentralized cluster aggregation access device as an example to illustrate this embodiment and the following embodiments.
[0053] The present application embodiment provides a method for aggregate access to a distributed cluster, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the distributed cluster aggregation access method of the present application.
[0054] In this embodiment, the decentralized cluster aggregation access method includes steps S10 to S30:
[0055] Step S10, based on the unified namespace, aggregating multiple dispersed HDFS clusters to obtain an aggregated cluster;
[0056] It should be noted that the aggregate cluster is the aggregated HDFS cluster. On top of the widely dispersed HDFS clusters, a global unified namespace is established through namespace mapping to achieve access aggregation of dispersed HDFS clusters and form a unified data access view.
[0057] In a feasible implementation, the step of constructing a unified namespace may include steps S101 to S102:
[0058] Step S101, obtaining the file space of the HDFS cluster, wherein the file space is provided with a file directory tree, and the file directory trees of different HDFS clusters are independent of each other;
[0059] It should be noted that the file space of each HDFS cluster consists of a file directory tree, and the file directory trees of different HDFS clusters are independent of each other. Figure 2 There are three HDFS clusters in the figure. Each HDFS cluster has an independent file directory tree. hdfs1 is the root directory of HDFS cluster 1, hdfs2 is the root directory of HDFS cluster 2, and hdfs3 is the root directory of HDFS cluster 3. Different directories such as home, bin, and usr can exist under the root directory. The next level of directories can also be set under the home, bin, and usr directories.
[0060] Step S102, adding a mapping of the file directory to the upper layer of the root directory of the file directory tree to obtain a unified name space of the HDFS cluster.
[0061] It can be understood that by adding a layer of file directory mapping above the root directory, the aggregation and construction of a unified name space can be completed.
[0062] It should be understood that in order to achieve a globally unified namespace, a combination of a flat directory structure and a hierarchical directory structure is used to manage the namespace of the widely dispersed HDFS clusters in a unified manner. The upper layer uses a management node to manage the entire namespace to shield the geographical differences between different HDFS clusters. Figure 3 In this embodiment, the unified namespace is configured with an HDFS access aggregation management node and an HDFS access aggregation client.
[0063] It should be noted that the HDFS access aggregation management node has at least the functions of cluster registration and management, namespace mapping management, and log recording. For the cluster registration and management functions, the HDFS access aggregation management node can register and remove clusters. Through the API (Application Programming Interface), the HDFS clusters that need to be managed are registered to the management node, or the clusters that are no longer needed are removed. The HDFS access aggregation management node can also monitor the cluster status. The management node continuously obtains the status of each HDFS cluster and confirms whether the cluster is in a healthy state by sending a timed heartbeat detection to the HDFS cluster. When a cluster is abnormal, the management node will trigger the alarm mechanism and notify the administrator in time. For the namespace mapping management function, the HDFS access aggregation management node can realize geographic location transparency. The HDFS client only needs to access the data in any HDFS cluster through the aggregated logical path. The HDFS access aggregation management node can also realize mapping backup and recovery. Considering the robustness of the system and the security of the data, the management node will regularly back up the namespace mapping information to ensure rapid recovery in the event of a failure. For the logging function, the HDFS access aggregation management node can record all requests, system activities and abnormal events in detail, making it easier for administrators to locate faults, evaluate system performance and conduct security analysis, ensuring traceability and transparency.
[0064] In addition, it should be noted that the HDFS access aggregation client has at least the functions of receiving aggregate access requests, request filtering and defense, traffic analysis and restriction, etc. For the function of receiving aggregate access requests, the HDFS access aggregation client, as the interactive middleware between the HDFS client and the HDFS access aggregation management node, provides a unified and standardized HDFS access interface, shielding the complexity of the HDFS access aggregation system from the upper-layer HDFS client. For the request filtering and defense function, the HDFS access aggregation client can perform basic request filtering, such as determining whether the logical address in the aggregate request meets the system requirements and whether the prefix exists in the address mapping table, to prevent malicious and non-compliant requests from entering the system, thereby improving the security of the system. For the traffic analysis and restriction function, the HDFS access aggregation client can implement a traffic restriction strategy for abnormal request traffic (such as sudden traffic peaks or a large number of requests from a single source) to protect the management node from being overloaded.
[0065] In the specific implementation, refer to Figure 4, an address mapping table is maintained in the HDFS access aggregation management node, and the specific directory mapping situation can be recorded according to the address mapping table. For example, the NameNode node access entry address of HDFS cluster 1 is 10.212.67.8, and the mapped path prefix is / hdfs1, that is, when the user wants to access the file named 1.txt in the root directory / of HDFS cluster 1, it needs to access it through the mapped aggregate access path / hdfs1 / 1.txt. The address mapping table is dynamically maintained according to the registration and deletion of the HDFS cluster. If you want to include a certain HDFS cluster in the unified namespace for centralized management, you only need to register it with the HDFS access aggregation management node. The HDFS access aggregation management node will manage it uniformly and perform health checks regularly to monitor the operation status of the cluster in real time.
[0066] It can be understood that when registering an HDFS cluster to the HDFS access aggregation management node, the HDFS access aggregation management node can specify a path mapping prefix for the HDFS cluster, and accelerate the mapping conversion speed of the logical address through flat metadata management, and store the mapping relationship in the form of (K, V) data pairs, where K is the address of the NameNode node in the HDFS cluster, and V is the path prefix after the address mapping. For example, according to the physical address of the cluster 10.212.67.8, it is mapped to the path / beijing, and according to the physical address of the cluster 10.212.67.12 and the department to which it belongs, it is mapped to the path / wuhan / team1. At this time, for the HDFS client, if you want to access the file with the physical address / a.txt located in 10.212.67.8, the corresponding logical address is / beijing / a.txt, and if you want to access the file with the physical address / b.txt located in 10.212.67.12, the corresponding logical address is / wuhan / team1 / b.txt.
[0067] Step S20, obtaining an aggregate access request from the HDFS client to the aggregate cluster, parsing the aggregate access request, and determining target data, target node, and request type of the aggregate access request;
[0068] It should be noted that the core architecture of the HDFS cluster consists of a NameNode node responsible for managing metadata and multiple DataNode nodes responsible for data storage. The HDFS client interacts with these two types of nodes to meet its data storage and retrieval needs. Therefore, in order to correctly route the aggregation request of the HDFS client to the NameNode / DataNode node in the specified HDFS cluster, this embodiment introduces a request analysis and routing mechanism, which ensures that each request is accurately sent to the correct target node by deeply analyzing the client's aggregation request.
[0069] In addition, it should be noted that an aggregate access request is a request to access data in an aggregate cluster. The access request of an HDFS client is usually sent directly to the HDFS access aggregation client and filtered by the HDFS access aggregation client. Therefore, the obtained aggregate access request is usually filtered by the HDFS access aggregation client, and the retained aggregate access request is a request that complies with the specification. The target node of the aggregate access request is the node to which the aggregate access request needs to be routed, which can be a NameNode node (metadata management node) or a DataNode node (data storage node). The target data of the aggregate access request is the data that the aggregate access request wants to access, that is, the corresponding data in the target node. The request types of aggregate access requests include read requests and write requests. When the request type of the aggregate access request is a read request, only the target data is read. When the request type of the aggregate access request is a write request, data is usually also written (adding data).
[0070] It is understandable that after the HDFS client makes an aggregate access request, the HDFS access aggregation client will filter all aggregate access requests, for example: determine whether the logical address in the aggregate request meets the system requirements, whether the prefix exists in the address mapping table, filter out malicious and non-compliant requests, and improve security. Then, these aggregate access requests that meet the requirements can be parsed to obtain the corresponding target data, target node, and request type, so that these aggregate access requests can be routed to the nodes in the correct HDFS cluster, and then the data in the node can be accessed and operated.
[0071] Step S30: Based on the target data, target node and request type of the aggregate access request, the aggregate access request is routed to the corresponding target HDFS cluster in the aggregate cluster, and the data block in the target HDFS cluster is accessed.
[0072] It should be noted that the target HDFS cluster is the HDFS cluster to which the aggregate access request needs to be routed, and the target data that the aggregate access request wants to access is usually located in the nodes of the target HDFS cluster.
[0073] It can be understood that in this embodiment, data is not simply stored in files, but is broken down into multiple "blocks" for storage. A huge file can be subdivided into multiple data blocks and stored in the entire HDFS cluster. This block data organization method gives HDFS excellent scalability and data redundancy, thereby improving the system's robustness and fault tolerance, accelerating data reading efficiency, reducing the average data access latency and improving the overall system throughput.
[0074] It should be understood that in order to further speed up data access, a distributed caching mechanism is adopted. All requests for NameNode nodes are routed to the HDFS access aggregation management node for processing. Among all access requests for DataNode nodes, only cache hit read requests are routed to the HDFS access aggregation management node for processing. Cache miss read requests and all write requests are directly routed to the target HDFS cluster.
[0075] This embodiment provides a method for aggregated access of a dispersed cluster. Based on a unified namespace, multiple dispersed HDFS clusters are aggregated to obtain an aggregated cluster; the aggregated access request of the HDFS client to the aggregated cluster is obtained, the aggregated access request is parsed, and the target data, target node, and request type of the aggregated access request are determined; based on the target data, target node, and request type of the aggregated access request, the aggregated access request is routed to the corresponding target HDFS cluster in the aggregated cluster to access the data blocks in the target HDFS cluster. A unified namespace is used to aggregate widely dispersed HDFS clusters to form a concise and unified data access view, so that the HDFS client can simply and uniformly access the data in each cluster. Through intelligent request analysis and routing mechanisms, the content of the aggregated request is parsed in real time, and the request is routed to the appropriate HDFS cluster according to the actual physical location of the data and the needs of the HDFS client, to ensure seamless and transparent data access and realize data interaction.
[0076] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 5 , the step S30 may include steps S301 to S304:
[0077] Step S301, when the target node of the aggregate access request is a data storage node, obtaining request return information of a metadata management node in the aggregate cluster;
[0078] It should be noted that all read / write requests must initiate a getBlocksLocation request to the NameNode before accessing a file. The request return value is an array, and each element in the array stores the data block corresponding to the file and the physical address of the DataNode node where the data block is located. The request return information is the request result returned by the NameNode node, which contains relevant information about the target data block.
[0079] In this embodiment, if the target node of the aggregate access request is a data storage node, the request return information of the metadata management node in the aggregate cluster is obtained for subsequent analysis.
[0080] Step S302, based on the request return information, determining a target data block of the target data of the aggregate access request in the target node and a physical address of the target node corresponding to the target data block;
[0081] It can be understood that the target data block of the target data in the target node is the target data block where the target data is located, and the physical address of the target node corresponding to the target data block is the physical address of the target node where the target data block is located. By intercepting the request result returned by the NameNode node, after analysis, the elements in the array are parsed one by one, and the relevant information of the target data block is extracted, such as: the target data block where the target data is located, and the physical address of the target node where the target data block is located.
[0082] Step S303, when the request type of the aggregate access request is a read request, obtaining a cache data block of the aggregate cluster;
[0083] It should be noted that the cached data blocks are cached data blocks that are frequently accessed. In this embodiment, when the request type of the aggregate access request is a read request, the cached data blocks of the aggregate cluster are obtained. Instead of caching the entire file, hot data is identified and captured in units of data blocks, and then the frequently accessed data blocks are cached. Hot data can be located and accessed more quickly, especially for large files, which can significantly reduce unnecessary data loading and processing time. The usage frequency and access pattern of each data block are monitored so that the system can better decide which data should be cached. Such a caching strategy not only improves data access speed, but also reduces the consumption of network bandwidth and storage resources.
[0084] Step S304, when the target data block corresponding to the aggregate access request matches the cache data block, determine that the aggregate access request is a cache hit read request, and based on the cache address of the cache data block, route the cache hit read request to the corresponding cache data block to access the cache data block.
[0085] It should be noted that the unique identifier (blockid) of the target data block can be used to determine whether the target data block exists in the cache data block. The target data block conforms to the cache data block, that is, the target data block exists in the cache data block. At this time, the aggregate access request is considered to be a cache hit read request, and an additional cache address (that is, the address of the local cache) is inserted into the specified position of the request return information. The cache hit read request can access the target data in the cache data block.
[0086] In a feasible implementation, when the target data block corresponding to the aggregate access request does not conform to the cache data block, the aggregate access request is determined to be a non-cache hit read request, and based on the physical address of the target node, the target HDFS cluster of the cache hit read request is determined, and the non-cache hit read request is routed to the corresponding data storage node in the target HDFS cluster to access the target data block.
[0087] It can be understood that the target data block does not conform to the cache data block, that is, the target data block does not exist in the cache data block. At this time, the aggregate access request is considered to be a non-cache hit read request, and no measures are taken. The non-cache hit read request is directly routed to the corresponding data storage node in the target HDFS cluster, so that only cache hit read requests are routed to the HDFS access aggregation management node for processing, and miss read requests are directly routed to the DataNode node in the target HDFS cluster for data access and operation.
[0088] In a feasible implementation, when the request type of the aggregate access request is a write request, the target HDFS cluster of the aggregate access request is determined based on the physical address of the target node, and the aggregate access request is routed to the corresponding data storage node in the target HDFS cluster to access the target data block.
[0089] It can be understood that write requests to DataNode nodes are directly routed to DataNode nodes in the target HDFS cluster for data access and operations.
[0090] In a feasible implementation, the step of determining the cached data blocks may include: obtaining the status of the data blocks of the data storage nodes in the aggregation cluster; taking the data blocks in the fully written state as candidate data blocks; and determining the cached data blocks of the aggregation cluster based on the data heat of the candidate data blocks.
[0091] It should be noted that HDFS only supports append-style data writing, which means that once data is written, it will remain unchanged unless it is explicitly deleted. Therefore, you can safely cache data blocks without worrying about data inconsistency.
[0092] In addition, it should be noted that when the HDFS client is ready to read a data block, it will first send a getVisibleLength request to the DataNode node. The purpose of this request is to obtain the actual size of the data block on the physical storage medium, thereby providing an accurate reference for subsequent data reading. With the help of this strategy, this embodiment can accurately determine the status of a data block by sending a simulation request to the DataNode, especially whether the data block has been fully written. If a data block has been completely written, that is, no subsequent data will be added, then it becomes an ideal candidate for a fine-grained distributed caching strategy. Candidate data blocks are data blocks that are expected to be cached, and cache data blocks can be selected from the candidate data blocks.
[0093] It is understandable that this embodiment adopts a fine-grained distributed cache strategy based on file blocks, and uses data blocks in a fully written state as candidate data blocks. According to the data heat of these candidate data blocks (the frequency with which the data in the data blocks are accessed), the data blocks with high heat are cached, which can more flexibly respond to changes in data heat. When the access frequency of a data block decreases, it can be automatically removed from the cache to make room for other more frequently accessed data blocks. This dynamic adjustment can ensure the optimal use of the cache, thereby achieving more efficient data management and overall performance improvement, which is of great significance for processing large data sets, improving the efficiency of data analysis tasks, and reducing data access latency, especially for data-intensive application scenarios.
[0094] In the specific implementation, by adopting a fine-grained distributed caching strategy based on file blocks, the complexity and inconsistency problems of many traditional caching strategies are avoided, and the efficiency, stability and accuracy of data access are ensured, and the data access process is accelerated, with an average acceleration effect of 40%.
[0095] This embodiment provides a method for aggregated access to a distributed cluster. A unified namespace is used to aggregate widely dispersed HDFS clusters to form a concise and unified data access view, so that HDFS clients can simply and uniformly access data in each cluster. Through intelligent request analysis and routing mechanisms, the content of aggregated requests is parsed in real time, and requests are routed to appropriate HDFS clusters based on the actual physical location of the data and the needs of the HDFS client, ensuring seamless and transparent data access, achieving data interaction, and achieving efficient data access based on a fine-grained distributed cache strategy for file blocks.
[0096] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the above embodiment can be referred to the above introduction, and will not be repeated in the following. Figure 6, the step S30 may include steps S301' to S302':
[0097] Step S301', when the target node of the aggregate access request is a metadata management node, based on the logical address of the target data of the aggregate access request, determine the physical address of the target data corresponding to the target HDFS cluster, and adjust the aggregate access request;
[0098] It can be understood that for the NameNode node request, the aggregate access request is analyzed, the logical address is parsed according to the predetermined rules, the address mapping table is searched to obtain the mapping relationship, and the logical address is converted into the corresponding physical address. After that, the HDFS access aggregation management node will modify the request body appropriately and then route it to the NameNode node in the target HDFS cluster.
[0099] In a feasible implementation, based on the logical address of the target data, the step of determining the physical address of the target HDFS cluster corresponding to the target data may include: obtaining an address mapping table of the aggregation cluster, the address mapping table storing the physical address of the HDFS cluster and the logical address mapped from the physical address of the HDFS cluster; based on the logical address of the target data, determining in the address mapping table the physical address that matches the logical address of the target data; using the HDFS cluster corresponding to the matched physical address as the target HDFS cluster corresponding to the target data, and obtaining the physical address of the target HDFS cluster.
[0100] It should be noted that the reference Figure 4 The address mapping table stores the physical address of the HDFS cluster and the logical address mapped from the physical address of the HDFS cluster. According to the logical address of the target data, the matching physical address is found in the address mapping table, so that the HDFS cluster with the matching physical address can be used as the target HDFS cluster, and the matching physical address can be used as the physical address of the target HDFS cluster, thereby routing the aggregated access request to the NameNode node in the target HDFS cluster, ensuring the efficiency, stability and accuracy of data access.
[0101] Step S302': based on the physical address of the target HDFS cluster, route the adjusted aggregate access request to the metadata management node corresponding to the target HDFS cluster, and access the data block in the metadata management node of the target HDFS cluster.
[0102] In the specific implementation, by adopting the unified namespace technology, the HDFS client can send various aggregate access requests to the HDFS access aggregation client, and realize the function of routing all requests for the NameNode node to this system. After receiving these requests, the HDFS access aggregation client forwards the aggregate access requests that meet the requirements to the HDFS access aggregation management node according to the set filtering rules. By analyzing the request, resolving the logical address according to the predetermined rules, and looking up the address mapping table to obtain the mapping relationship, the logical address is converted into a physical address. The HDFS access aggregation management node makes appropriate modifications to the request body and routes it to the NameNode node in the specified HDFS cluster.
[0103] This embodiment provides a method for aggregated access to distributed clusters. It uses a unified namespace to aggregate widely distributed HDFS clusters to form a concise and unified data access view, so that HDFS clients can simply and uniformly access data in each cluster. Through intelligent request analysis and routing mechanisms, the content of aggregated requests is parsed in real time, and requests are routed to appropriate HDFS clusters based on the actual physical location of the data and the needs of the HDFS client, ensuring seamless and transparent data access, and achieving efficient data access based on a fine-grained distributed caching strategy for file blocks.
[0104] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the aggregate access method of the distributed cluster of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.
[0105] This application also provides a decentralized cluster aggregation access device, please refer to Figure 7 , the aggregate access device of the dispersed cluster includes:
[0106] Aggregation module 10, used to aggregate multiple dispersed HDFS clusters based on a unified namespace to obtain an aggregated cluster;
[0107] The access module 20 is used to obtain the aggregate access request of the HDFS client to the aggregate cluster, parse the aggregate access request, and determine the target data, target node and request type of the aggregate access request;
[0108] The access module 20 is further configured to route the aggregate access request to a corresponding target HDFS cluster in the aggregate cluster based on target data, target node, and request type of the aggregate access request, and access data blocks in the target HDFS cluster.
[0109] In a feasible implementation manner, the access module 20 is further used to determine the physical address of the target data corresponding to the target HDFS cluster based on the logical address of the target data of the aggregate access request when the target node of the aggregate access request is a metadata management node, and adjust the aggregate access request;
[0110] Based on the physical address of the target HDFS cluster, the adjusted aggregate access request is routed to the metadata management node of the corresponding target HDFS cluster, and the data blocks in the metadata management node of the target HDFS cluster are accessed and operated.
[0111] In a feasible implementation manner, the access module 20 is further used to obtain an address mapping table of the aggregation cluster, wherein the address mapping table stores the physical address of the HDFS cluster and the logical address mapped from the physical address of the HDFS cluster;
[0112] Based on the logical address of the target data, determining in the address mapping table a physical address that matches the logical address of the target data;
[0113] The HDFS cluster corresponding to the matched physical address is used as the target HDFS cluster corresponding to the target data, and the physical address of the target HDFS cluster is obtained.
[0114] In a feasible implementation manner, the access module 20 is further configured to obtain request return information of a metadata management node in the aggregation cluster when the target node of the aggregation access request is a data storage node;
[0115] Based on the request return information, determine a target data block of the target data of the aggregate access request in the target node and a physical address of the target node corresponding to the target data block;
[0116] When the request type of the aggregate access request is a write request, the target HDFS cluster of the aggregate access request is determined based on the physical address of the target node, and the aggregate access request is routed to the corresponding data storage node in the target HDFS cluster to access the target data block.
[0117] In a feasible implementation manner, the access module 20 is further configured to obtain a cache data block of the aggregation cluster when the request type of the aggregation access request is a read request;
[0118] When the target data block corresponding to the aggregate access request matches the cache data block, determining that the aggregate access request is a cache hit read request, routing the cache hit read request to the corresponding cache data block based on the cache address of the cache data block, and accessing the cache data block;
[0119] When the target data block corresponding to the aggregate access request does not conform to the cache data block, the aggregate access request is determined to be a non-cache hit read request, and the target HDFS cluster of the cache hit read request is determined based on the physical address of the target node, and the non-cache hit read request is routed to the corresponding data storage node in the target HDFS cluster to access the target data block.
[0120] In a feasible implementation manner, the access module 20 is further used to obtain the status of the data blocks of the data storage nodes in the aggregation cluster;
[0121] The data blocks in the completely written state are taken as candidate data blocks;
[0122] Based on the data heat of the candidate data blocks, a cache data block of the aggregation cluster is determined.
[0123] The aggregate access device for a distributed cluster provided by the present application adopts the aggregate access method for a distributed cluster in the above-mentioned embodiment, and can solve the technical problem of unified access management of multiple HDFS clusters dispersed over a wide area that is difficult to achieve in a traditional way. Compared with the prior art, the beneficial effects of the aggregate access device for a distributed cluster provided by the present application are the same as the beneficial effects of the aggregate access method for a distributed cluster provided by the above-mentioned embodiment, and other technical features in the aggregate access device for a distributed cluster are the same as the features disclosed in the above-mentioned embodiment method, which will not be described in detail here.
[0124] The present application provides an aggregate access device for a dispersed cluster, the aggregate access device for a dispersed cluster comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the aggregate access method for the dispersed cluster in the above-mentioned embodiment 1.
[0125] Reference below Figure 8 , which shows a schematic diagram of the structure of a decentralized cluster aggregation access device suitable for implementing the embodiment of the present application. The decentralized cluster aggregation access device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8The illustrated decentralized cluster aggregation access device is merely an example and should not limit the functionality and scope of use of the embodiments of the present application.
[0126] like Figure 8 As shown, the aggregate access device of the decentralized cluster may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of the aggregate access device of the decentralized cluster are also stored in the RAM 1004. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems may be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication devices 1009 may allow the aggregated access device of the decentralized cluster to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an aggregated access device of a decentralized cluster with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.
[0127] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0128] The aggregate access device for a distributed cluster provided by the present application adopts the aggregate access method for a distributed cluster in the above embodiment, which can solve the technical problem that it is difficult to achieve unified access management for multiple HDFS clusters dispersed over a wide area in the traditional way. Compared with the prior art, the beneficial effects of the aggregate access device for a distributed cluster provided by the present application are the same as the beneficial effects of the aggregate access method for a distributed cluster provided by the above embodiment, and the other technical features of the aggregate access device for a distributed cluster are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0129] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0130] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0131] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the aggregate access method of the dispersed cluster in the above-mentioned embodiment.
[0132] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0133] The computer-readable storage medium may be included in the aggregate access device of the dispersed cluster; or may exist independently without being assembled into the aggregate access device of the dispersed cluster.
[0134] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the aggregate access device of the distributed cluster, the aggregate access device of the distributed cluster: obtains the aggregate access request of the HDFS client to the aggregate cluster, parses the aggregate access request, and determines the target data, target node and request type of the aggregate access request; based on the target data, target node and request type of the aggregate access request, routes the aggregate access request to the corresponding target HDFS cluster in the aggregate cluster, and accesses the data blocks in the target HDFS cluster.
[0135] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0136] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0137] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0138] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned decentralized cluster aggregate access method, and can solve the technical problem that the traditional method is difficult to achieve unified access management of multiple HDFS clusters dispersed over a wide area. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the decentralized cluster aggregate access method provided by the above-mentioned embodiment, and will not be repeated here.
[0139] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned decentralized cluster aggregation access method when executed by a processor.
[0140] The computer program product provided by this application can solve the technical problem that it is difficult to achieve unified access management of multiple HDFS clusters dispersed over a wide area in the traditional way. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the aggregated access method for dispersed clusters provided in the above embodiment, which will not be elaborated here.
[0141] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for aggregate access of a decentralized cluster, characterized in that: The method comprises: Based on the unified namespace, multiple scattered HDFS clusters are aggregated to obtain an aggregated cluster; Obtaining an aggregate access request from an HDFS client to the aggregate cluster, parsing the aggregate access request, and determining target data, target node, and request type of the aggregate access request; Based on the target data, target node and request type of the aggregate access request, the aggregate access request is routed to the corresponding target HDFS cluster in the aggregate cluster, and the data blocks in the target HDFS cluster are accessed.
2. The method according to claim 1, characterized in that The step of routing the aggregate access request to a corresponding target HDFS cluster in the aggregate cluster based on the target data, target node, and request type of the aggregate access request and accessing the data blocks in the target HDFS cluster comprises: When the target node of the aggregate access request is a metadata management node, based on the logical address of the target data of the aggregate access request, determine the physical address of the target HDFS cluster corresponding to the target data, and adjust the aggregate access request; Based on the physical address of the target HDFS cluster, the adjusted aggregate access request is routed to the metadata management node corresponding to the target HDFS cluster, and the data block in the metadata management node of the target HDFS cluster is accessed.
3. The method according to claim 2, characterized in that The step of determining the physical address of the target data corresponding to the target HDFS cluster based on the logical address of the target data includes: Obtain an address mapping table of the aggregation cluster, where the address mapping table stores the physical address of the HDFS cluster and the logical address mapped from the physical address of the HDFS cluster; Based on the logical address of the target data, determining in the address mapping table a physical address that matches the logical address of the target data; The HDFS cluster corresponding to the matched physical address is used as the target HDFS cluster corresponding to the target data, and the physical address of the target HDFS cluster is obtained.
4. The method according to claim 1, characterized in that The step of routing the aggregate access request to a corresponding target HDFS cluster in the aggregate cluster based on the target data, target node, and request type of the aggregate access request and accessing the data blocks in the target HDFS cluster comprises: When the target node of the aggregate access request is a data storage node, obtaining request return information of a metadata management node in the aggregate cluster; Based on the request return information, determine a target data block of the target data of the aggregate access request in the target node and a physical address of the target node corresponding to the target data block; When the request type of the aggregate access request is a write request, the target HDFS cluster of the aggregate access request is determined based on the physical address of the target node, and the aggregate access request is routed to the corresponding data storage node in the target HDFS cluster to access the target data block.
5. The method according to claim 4, characterized in that After the step of determining, based on the request return information, a target data block of the target data of the aggregate access request in the target node and a physical address of the target node corresponding to the target data block, the following step further comprises: When the request type of the aggregate access request is a read request, obtaining a cache data block of the aggregate cluster; When the target data block corresponding to the aggregate access request matches the cache data block, determining that the aggregate access request is a cache hit read request, routing the cache hit read request to the corresponding cache data block based on the cache address of the cache data block, and accessing the cache data block; When the target data block corresponding to the aggregate access request does not conform to the cache data block, the aggregate access request is determined to be a non-cache hit read request, and the target HDFS cluster of the cache hit read request is determined based on the physical address of the target node, and the non-cache hit read request is routed to the corresponding data storage node in the target HDFS cluster to access the target data block.
6. The method according to claim 5, characterized in that The method further comprises: Obtaining the status of data blocks of data storage nodes in the aggregation cluster; The data blocks in the completely written state are taken as candidate data blocks; Based on the data heat of the candidate data blocks, a cache data block of the aggregation cluster is determined.
7. A decentralized cluster aggregation access device, characterized in that: The device comprises: Aggregation module, used to aggregate multiple scattered HDFS clusters based on a unified namespace to obtain an aggregated cluster; An access module is used to obtain an aggregate access request from an HDFS client to the aggregate cluster, parse the aggregate access request, and determine target data, target node, and request type of the aggregate access request; The access module is further used to route the aggregate access request to the corresponding target HDFS cluster in the aggregate cluster based on the target data, target node and request type of the aggregate access request, and access the data blocks in the target HDFS cluster.
8. An aggregate access device for a decentralized cluster, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the decentralized cluster aggregation access method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the decentralized cluster aggregation access method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method for aggregated access of a dispersed cluster as claimed in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Multi- data-centre hadoop distributed file system (HDFS) data read-write system and method
CN104113597A
Dispersed autonomous storage resource aggregation method with unified name space
CN110213352A
Data transmission method, related device, equipment, system and storage medium
CN113992658A
Cluster access method and device and electronic equipment
CN115499430A
Data processing method and device in multi-cluster scene, equipment and storage medium
CN115695426A