File management method and device, storage medium and program product
Through the small file analysis report and application monitoring of the Hadoop file system, small files are detected and optimally managed, which solves the problems of operation and maintenance complexity and cause tracing difficulties caused by small files in HDFS, and realizes automated monitoring and reduction of operation and maintenance difficulty.
Patent Information
- Application Number
- CN202410665266.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-08-23
AI Technical Summary
The large number of small files in the Hadoop distributed file system leads to complex operation and maintenance and difficulty in tracing the causes.
Through preset small file analysis reports and application monitoring based on the Hadoop file system, anomaly detection is performed to determine the causes of small file anomalies and optimize management, including adjusting parameters, merging small files, etc.
It realizes automated monitoring and optimized management of small and medium-sized files in HDFS, reduces the difficulty of operation and maintenance of file management, and solves the problem of difficulty in tracing the causes of small files.
Smart Images

Figure CN118535528A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data file management, and in particular to a file management method, device, storage medium and program product. Background Art
[0002] HDFS (Hadoop Distributed File System) is a highly reliable, high-performance distributed file system suitable for processing large-scale data sets. With the continuous development of big data technology in recent years, HDFS has been increasingly used in various fields of social life. However, the presence of a large number of small files in the Hadoop distributed file system significantly increases the complexity of operation and maintenance.
[0003] The existing HDFS small file management technology is usually manually managed by operation and maintenance personnel to perform operations such as classification, archiving, and merging, which is not only time-consuming but also prone to errors. At the same time, when it is necessary to optimize the Hadoop distributed file system to reduce small files, the existing technology lacks automated tools to track and analyze the source of small files. Developers often find it difficult to locate the root cause of the problem, making it difficult to formulate effective optimization strategies.
[0004] In summary, the operational and maintenance difficulties and the difficulty in tracing the causes of small files in HDFS are issues that need to be addressed urgently.
[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0006] The main purpose of this application is to provide a file management method, device, storage medium and program product, aiming to solve the technical problems of high operation and maintenance difficulty and difficulty in tracing the causes of small files in existing file management methods in HDFS.
[0007] To achieve the above object, the present application proposes a file management method, which is applied to the Hadoop file system and includes:
[0008] Based on the preset small file analysis report and application monitoring of the Hadoop file system, anomaly detection is performed on small files to obtain anomaly detection results, wherein the small file refers to a file whose file size is smaller than the block size of the Hadoop file system;
[0009] Based on the anomaly detection results, combined with the preset small file analysis report and application monitoring, data analysis is performed to determine the cause of the small file anomaly generation;
[0010] Based on the reasons for abnormal generation of small files, optimized management of small files is performed.
[0011] In one embodiment, the step of performing anomaly detection on small files and obtaining anomaly detection results based on the preset small file analysis report and application monitoring of the Hadoop file system further includes:
[0012] Get the FSImage metadata file from the Hadoop file system;
[0013] Parsing the FSImage metadata file to obtain a FSImage parsed file;
[0014] Based on the FSImage parsed file, data analysis and processing are performed according to preset file indicators to generate a small file analysis report for the Hadoop file system for automated small file monitoring.
[0015] In one embodiment, the Hadoop file system includes a Hive server, and before the step of performing anomaly detection on a preset small file analysis report and application monitoring of the Hadoop file system to obtain an anomaly detection result of a small file, the step further includes:
[0016] Collect Hive server logs and parse them to obtain application execution logs;
[0017] Based on the application execution log, obtain the corresponding number of Maps and Reduces;
[0018] Based on the preset Map and Reduce thresholds, the number of Maps and Reduces of the application is monitored to achieve application monitoring.
[0019] In one embodiment, the Hadoop file system includes a cluster side and a user side, the method is applied to the cluster side, and the step of optimizing the management of small files based on the abnormal generation reason of small files includes:
[0020] Classifying the causes of abnormal generation of small files to obtain a cause classification result;
[0021] When the cause classification result is the first classification result, sending an alarm message to the user side;
[0022] When the cause classification result is the second classification result, small files are optimized and managed according to a preset file optimization management solution, and an alarm message is sent to the user side.
[0023] In one embodiment, when the cause classification result is the second classification result, the step of optimizing the management of small files according to the preset file optimization management scheme and sending an alarm message to the user side includes:
[0024] When the abnormal generation of small files is caused by too many Maps and / or Reduces on the Hive server, adjust the parameter settings of the server to optimize the management of small files and send an alarm message to the user side;
[0025] When the abnormal generation of small files is caused by improper application parameter configuration, the parameters are adjusted according to the preset application default parameters, the small files are optimized and managed, and an alarm message is sent to the user side;
[0026] When the abnormal generation of small files is caused by a large number of small files in stock, a cold data partition detection is performed on the small files in the Hadoop file system;
[0027] Automatically merge the cold data partitions and send warning information to the user.
[0028] In one embodiment, the Hadoop file system includes a server side and a user side, the method is applied to the user side, and the step of optimizing the management of small files based on the abnormal generation reason of small files includes:
[0029] Receive alarm information sent by the cluster side;
[0030] Receive user input instructions;
[0031] Based on the user input instruction, the corresponding platform tool is called to perform optimized management of small files.
[0032] In one embodiment, the platform tools include one or more of a concatenate file merging tool, a table rewriting file merging tool, a Hive table survival time TTL setting tool, a visual file detail query and deletion tool, and an application parameter adjustment tool.
[0033] In addition, to achieve the above objectives, the present application also proposes a file management device, which includes: 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 file management method described above.
[0034] In addition, to achieve the above objectives, the present application also proposes a storage medium, which 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 file management method described above are implemented.
[0035] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the file management method described above are implemented.
[0036] One or more technical solutions proposed in this application have at least the following technical effects:
[0037] The embodiments of the present application propose a file management method, device, storage medium and program product, which specifically detect anomalies of small files through preset small file analysis reports and application monitoring based on the Hadoop file system to obtain anomaly detection results; based on the anomaly detection results, combined with the preset small file analysis reports and application monitoring, data analysis is performed to determine the cause of the abnormal generation of small files; based on the cause of the abnormal generation of small files, optimized management of small files is performed.
[0038] The present application realizes automatic monitoring of small and medium files in HFDS by presetting small file analysis reports and application monitoring, so that the causes of abnormal small file generation can be further analyzed based on the small file anomaly detection results, and small files are optimized for the causes of abnormal small file generation. Compared with the existing file management methods, the technical problems of high operation and maintenance difficulty and difficulty in tracing the causes of small files in the existing file management methods of Hadoop file system can be solved, and the operation and maintenance difficulty of file management of Hadoop file system can be effectively reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] 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.
[0040] 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.
[0041] Figure 1 A flowchart of the first embodiment of the application file management method is provided;
[0042] Figure 2 A flowchart of the second embodiment of the application file management method is provided;
[0043] Figure 3 A flowchart of the third embodiment of the application file management method is provided;
[0044] Figure 4 A flowchart of the fourth embodiment of the application file management method is provided;
[0045] Figure 5 A flowchart of the fifth embodiment of the application file management method is provided;
[0046] Figure 6This is a schematic diagram of the simplified architecture of the file management system involved in Embodiment 5 of the present application;
[0047] Figure 7 Schematic diagram of the device structure of the hardware operating environment involved in the file management method in the embodiment of the present application.
[0048] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0049] 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.
[0050] 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.
[0051] The main solution of the embodiment of the present application is: based on the preset small file analysis report and application monitoring of the Hadoop file system, anomaly detection is performed on small files to obtain anomaly detection results; based on the anomaly detection results, data analysis is performed in combination with the preset small file analysis report and application monitoring to determine the cause of the abnormal generation of small files; based on the cause of the abnormal generation of small files, optimized management of small files is performed.
[0052] Technical terms involved in the embodiments of this application:
[0053] HDFS: HDFS (Hadoop Distributed File System) is one of the core components of the Hadoop project. It is a highly fault-tolerant distributed file system designed for processing large-scale data sets. The design goals of HDFS include being able to run on low-cost hardware, providing high throughput to access application data, and providing a streaming data access model to simplify data processing.
[0054] HDFS divides files into fixed-size blocks, which are stored on different data nodes, thus achieving distributed storage of data. There is a central server in HDFS, namely NameNode, which is used to manage the metadata of the file system, such as file names, directory structures, block location information, etc. At the same time, there are multiple DataNodes in HDFS for actual storage of data blocks.
[0055] HDFS is highly fault-tolerant and can ensure data reliability and integrity even if some nodes in the system fail. Data redundancy is achieved through data block replication and distributed storage, ensuring that data can still be recovered and accessed when some nodes fail.
[0056] HDFS provides strong support for big data processing and analysis and is widely used in various big data scenarios, such as data warehouses, log analysis, and scientific computing.
[0057] FSImage: FSImage is a file system image in the Hadoop Distributed File System (HDFS), which stores metadata information of the HDFS file system. Metadata includes information about files, directories, permissions, etc., and is an important part of the HDFS file system. The function of the FSImage file is that when the NameNode is restarted, by reading this file, the state of the HDFS file system when it was last shut down can be restored.
[0058] FSImage is a read-only file that plays a key role in the startup process of HDFS. When NameNode starts, it first loads the FSImage file to obtain the latest status of the file system. Then, NameNode combines the Editslog file to update the status of the file system to the latest status. In this way, HDFS can quickly and accurately restore to the previous state after NameNode restarts, ensuring data integrity and consistency.
[0059] Hive: Hive is a data warehouse tool based on Hadoop that can map structured data files into a database table and provide users with simple SQL query functions. Hive allows users familiar with SQL to query data stored in Hadoop through HQL (Hive Query Language), thereby simplifying the processing and analysis of big data.
[0060] The core design concept of Hive is to store massive amounts of data in HDFS and perform calculations through the MapReduce programming model. Hive does not have a specific data format and can work on a variety of data formats, while also allowing users to specify data formats. Hive not only provides simple SQL query functions, but also supports complex analysis work. Through HQL, users can write complex query statements, and Hive will convert these statements into MapReduce tasks for execution. At the same time, Hive also supports user-defined mappers and reducers to meet complex analysis needs.
[0061] The emergence of Hive has greatly lowered the threshold for big data processing, allowing more users to use Hadoop for large-scale data processing and analysis. Hive has been widely used in various big data scenarios, such as data warehouse construction, data mining, real-time analysis, etc.
[0062] Map: In the field of big data processing, Map is an important stage in the MapReduce programming model. The main task of the Map stage is to split the original data into multiple key-value pairs, execute the user-defined mapping function on each key-value pair, and output the intermediate results. This process is parallel and can be performed simultaneously on multiple nodes, thereby achieving efficient processing of large data sets.
[0063] Specifically, the Map function receives an input record (usually a line in a file) and converts it into one or more key-value pairs. These key-value pairs are then output as intermediate results for subsequent Reduce phase processing. The design of the Map function is very flexible and can be customized according to specific application requirements to achieve various transformation and extraction operations on data.
[0064] In big data processing, the Map stage can fully utilize the computing power of the distributed system to achieve efficient processing of big data by dividing the large data set into multiple small data blocks and processing them in parallel on multiple nodes. At the same time, the Map stage also provides the necessary intermediate results for the subsequent Reduce stage, providing a solid foundation for the entire processing flow.
[0065] Reduce: Reduce is another core phase in the MapReduce programming model. It follows the Map phase and is responsible for merging and sorting the intermediate key-value pairs output by the Map phase to obtain the final result. The main function of the Reduce phase is to aggregate, sort, and calculate data to ultimately generate one or more output key-value pairs.
[0066] In the Reduce phase, all values with the same key are aggregated and passed to the user-defined reduce function for processing. The reduce function merges, sorts, or calculates these values, and then outputs the final key-value pair result. This process is also parallel and can be performed simultaneously on multiple nodes, thereby achieving efficient processing of large data sets.
[0067] The Reduce phase plays a key role in big data processing, integrating and summarizing the results of distributed computing to generate the final summary results. Through the Reduce phase, statistics, analysis, and mining operations on large data sets can be implemented to extract valuable information and insights.
[0068] Cluster: A cluster is a group of machines that use the network to form a larger computer service system. Each machine is an independent server. The clusters work together to complete tasks and can have performance far exceeding that of a single server.
[0069] The existence of a large number of small files in the existing HDFS will significantly increase the complexity of operation and maintenance. However, the existing file management method is usually manually managed by operation and maintenance personnel to perform operations such as classification, archiving, and merging, and there is a lack of automated tools to track and analyze the source of small files, which makes system operation and maintenance difficult and the cause of small files difficult to trace, further increasing system operation and maintenance costs.
[0070] The present application provides a solution, which realizes automatic monitoring of small files in the HFDS system by presetting small file analysis reports and application monitoring, so that the causes of small file anomaly generation can be further analyzed based on the small file anomaly detection results, and small files are optimized for the causes of small file anomaly generation. Compared with the existing file management method, the technical problems of high operation and maintenance difficulty and difficulty in tracing the causes of small files in the existing file management method of Hadoop file system can be solved, and the operation and maintenance difficulty of file management of Hadoop file system can be effectively reduced.
[0071] It should be noted that the execution subject of this embodiment may be a file management system, or 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 a file management device capable of realizing the above functions, etc. The following takes the file management system as an example to illustrate this embodiment and the following embodiments.
[0072] Based on this, the present application embodiment provides a file management method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the file management method of this application.
[0073] In this embodiment, the file management method includes steps S110 to S130:
[0074] Step S110, based on the preset small file analysis report and application monitoring of the Hadoop file system, anomaly detection is performed on the small file to obtain anomaly detection results, wherein the small file refers to a file whose file size is smaller than the block size of the Hadoop file system;
[0075] It should be noted that the Hadoop file system is the Hadoop Distributed File System (HDFS). The preset small file analysis report and application monitoring are functions that are developed and set in advance by developers or operation and maintenance personnel in the Hadoop file system to optimize the management of small files in HDFS. They can realize automatic abnormal monitoring of small files in HDFS. Small files refer to files whose size is smaller than the block size of the Hadoop file system. Blocks are the basic unit of data storage in the Hadoop file system (HDFS) and are used to store file content. The block size varies in different versions of the Hadoop file system. In Hadoop 1.X, the default block size is 64M, and in Hadoop 2.X, the default block size is 128M.
[0076] It is understandable that since the technical solution proposed in this application is actually applied to the Hadoop file system, step S110 is required to perform anomaly detection of small files through the preset small file analysis report and application monitoring in the file management system, so as to facilitate the subsequent anomaly management of HDFS small files and realize file optimization management.
[0077] In a feasible implementation, step S110 may include: based on the preset small file analysis report and application monitoring of the Hadoop file system, performing anomaly detection on small files according to the preset small file parameter threshold, and obtaining anomaly detection results. Among them, the preset small file parameter threshold is set to limit the number and / or size of HDFS small files generated under different levels of path directories and / or different user groups and / or different business needs and / or different running applications, and can be the experience value of relevant personnel. It should be pointed out that the preset small file parameter threshold can be obtained not only for the above-mentioned scenarios, but also for other general HDFS small file indicators, such as the number of new small files, the number of empty small files, the number of idle small files and other small file indicators.
[0078] Specifically, the file management system can monitor the running status of running applications through the application monitoring function to understand the number of small files and file size and other information generated by each running application. At the same time, through the small file analysis report, it can understand the number of small files and file size and other information under different levels of path directories and / or different user groups and / or different business needs. According to the preset small file parameter threshold, it can easily detect whether there is a small file anomaly, that is, the number and / or size of small files under different levels of path directories and / or different user groups and / or different business needs and / or different running applications exceeds the threshold.
[0079] Step S120, based on the anomaly detection result, combined with the preset small file analysis report and application monitoring, data analysis is performed to determine the cause of the small file anomaly generation;
[0080] Specifically, through the anomaly detection results, we can understand the small file information whose indicators such as the number and / or size of small files exceed the limit threshold, that is, the level path directory and / or user group and / or business demand associated with the small file anomaly. At the same time, combined with the preset small file analysis report and application monitoring, we can further understand how the small files under the abnormal level path directory and / or user group and / or business demand are generated, whether it is an abnormality of existing small files or original files, or the associated small file anomaly caused by improper application parameter settings, or the small file anomaly caused by too many Map / Reduce tasks in the file management system, or the small file anomaly caused by other reasons.
[0081] It should be noted that stock files refer to files that have been calculated and stored in HDFS, and original files are original HDFS files or other external source files that have not been calculated.
[0082] Step S130: optimizing the management of small files based on the reasons for abnormal generation of small files.
[0083] In a first feasible implementation, the Hadoop file system includes a cluster side and a user side, the method is applied to the cluster side, and step S130 may include steps S1301 to S1303:
[0084] It should be noted that the cluster described in this application is a Hadoop cluster, which is usually a cluster specially provided for big data services and includes multiple components, such as MapReduce service and Spark service for computing services, HDFS service for storage, Yarn service for resource scheduling services, and Hive for structured library and table query services.
[0085] Step S1301, classifying the causes of abnormal generation of small files to obtain a cause classification result;
[0086] Specifically, the cause of abnormal small file generation is analyzed to confirm whether the cause of abnormal small file generation is related to the original file, and then the cause classification result is obtained. When the cause of abnormal small file generation is related to the original file, the cause classification result is the first classification result; when the cause of abnormal small file generation is not related to the original file, the cause classification result is the second classification result.
[0087] Step S1302: When the cause classification result is the first classification result, sending an alarm message to the user side;
[0088] Step S1303: When the cause classification result is the second classification result, small files are optimized and managed according to a preset file optimization management solution, and an alarm message is sent to the user side.
[0089] Specifically, when the cause classification result is the first classification result, the file management system directly sends alarm information about the HDFS small file exception to the user side, including the directory path where the HFDS small file exception occurs, the number and / or size of the abnormal small files, the cause of the small file exception, etc.; when the cause classification result is the second classification result, the file management system will optimize the management of the abnormal HFDS small files according to the preset file optimization management plan, and send alarm information to the user side at the same time.
[0090] It is understandable that when the cause classification result is the second classification result, the file management system will send a message of successful exception handling to the user side after successfully handling the small file exception according to the preset file optimization management solution.
[0091] It should be noted that the preset file optimization management plan is pre-set by relevant developers in the file management system. It is an optimized governance plan to deal with known common HDFS small file anomalies, including but not limited to cleaning up small files that have been idle for too long, cleaning up empty small files, merging or cleaning up existing small files, etc.
[0092] It is understandable that when using the preset file optimization management solution to optimize the management of small files, there may be situations where the small files cannot be abnormally processed. At this time, it is also necessary to feedback the progress and results of the small file optimization processing to the user side.
[0093] The present embodiment provides a file management method, which performs anomaly detection on small files based on a preset small file analysis report and application monitoring of the Hadoop file system to obtain anomaly detection results, wherein the small file refers to a file whose file size is smaller than the block size of the Hadoop file system; based on the anomaly detection results, data analysis is performed in combination with the preset small file analysis report and application monitoring to determine the cause of the abnormal generation of small files; based on the cause of the abnormal generation of small files, optimized management of small files is performed.
[0094] Through the above scheme, this embodiment realizes automatic monitoring of small files in the HFDS system by presetting small file analysis reports and application monitoring, so that the causes of small file anomaly generation can be further analyzed based on the small file anomaly detection results, and small files are optimized for the causes of small file anomaly generation. Compared with the existing file management method, it can solve the technical problems of high operation and maintenance difficulty and difficulty in tracing the causes of small files in the existing file management method of Hadoop file system, and effectively reduce the operation and maintenance difficulty of file management of Hadoop file system.
[0095] 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 2 Before step S110, the file management method further includes steps S210 to S230:
[0096] Step S210, obtaining the FSImage metadata file from the Hadoop file system;
[0097] Step S220, parsing the FSImage metadata file to obtain a FSImage parsed file;
[0098] Step S230, based on the FSImage parsing file, data analysis and processing are performed according to preset file indicators to generate a small file analysis report of the Hadoop file system for automatic small file monitoring.
[0099] It should be understood that the FSImage file data is a file system image in HDFS, which stores metadata information of the HDFS file system. In order to obtain preset small file analysis reports and realize automated small file monitoring, it is necessary to obtain the FSImage metadata file from the Hadoop file system.
[0100] In order to avoid the FSImage file parsing process affecting the NameNode master node, the FSImage file is parsed in the NameNodeStandBy node. After parsing, the parsed CSV file is uploaded to the ClickHouse database. At the same time, the data is processed, the original path of the metadata information is split, and the path is divided into 10 levels according to the path hierarchy to obtain the FSImage parsed file for subsequent real-time statistical queries.
[0101] Finally, based on the FSImage parsing file, relevant personnel customized the preset file indicators, performed data statistical analysis, and generated small file analysis reports for the Hadoop file system for automated small file monitoring.
[0102] It should be noted that common preset file indicators include: the number of small files in HDFS, the number of empty files in HDFS, the number of small files newly added in HDFS per week / month, the number of idle files in HDFS, the number of small files newly added in Hive tables per week / month, and the number of idle Hive tables / partitions. For detailed descriptions of the above preset file indicators, refer to the following:
[0103] Number of small files in HDFS: The small file number indicator mainly counts the number of files smaller than 12.8M in the HDFS space occupied by the statistical room group, so as to help developers query the existing small files and process the existing small files according to the actual situation, such as deleting and merging.
[0104] Number of HDFS empty files: The empty file number indicator mainly counts the number of files with a file size of 0 in the HDFS space occupied by the statistical room group. An empty file is an extremely small file and is handled in the same way as above.
[0105] Number of new small files added to HDFS per week / month: The new small file number indicator mainly counts the number of small files added by the room group on a weekly / monthly basis. This indicator mainly targets incremental files to help developers locate currently running applications / scripts for optimized management, so as to achieve management of the source of small file generation.
[0106] Number of idle files in HDFS: The idle file number indicator mainly counts files that have not been accessed within three months to avoid an increase in the number of files due to developers' omissions or failure to set TTL.
[0107] Number of small files newly added to Hive tables weekly / monthly: Statistics on small files newly added to Hive tables are similar to statistics on small files newly added to HDFS, but the statistical granularity is changed from room group to table level. The table can more easily locate applications / SQL and optimize governance.
[0108] Number of Hive idle tables / partitions: Idle tables / partitions mainly count tables / partitions that have not been accessed for more than three months. Similar to HDFS idle files, this mainly counts the number of files that increase due to the failure to set TTL for tables / partitions.
[0109] The present embodiment provides a file management method, which includes obtaining an FSImage metadata file from a Hadoop file system; parsing the FSImage metadata file to obtain an FSImage parsed file; based on the FSImage parsed file, performing data analysis and processing according to preset file indicators to generate a small file analysis report of the Hadoop file system to perform automatic small file monitoring; based on the preset small file analysis report and application monitoring of the Hadoop file system, performing anomaly detection on small files to obtain anomaly detection results, wherein the small file refers to a file whose file size is smaller than the block size of the Hadoop file system; based on the anomaly detection results, performing data analysis in combination with the preset small file analysis report and application monitoring to determine the cause of the abnormal generation of small files; and performing optimized management of small files based on the cause of the abnormal generation of small files.
[0110] Through the above scheme, this embodiment parses the FSImage metadata file and performs data processing according to preset file indicators to generate a preset small file analysis report to achieve automatic monitoring of small files in the HFDS system, so that the causes of abnormal small file generation can be further analyzed based on the small file anomaly detection results, and small files can be optimized according to the causes of abnormal small file generation. Compared with the existing file management method, the file management method proposed in this application can achieve automatic small file monitoring and small file cause tracing, and effectively reduce the operation and maintenance difficulty of file management of the Hadoop file system.
[0111] Based on the second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the above-mentioned second embodiment can refer to the above introduction, and will not be repeated in the following. Figure 3 Before step S110, the file management method further includes steps S310 to S330:
[0112] Step S310, collecting Hive server logs and parsing them to obtain application execution logs;
[0113] Specifically, Hive performs structured library and table queries based on the Hadoop file system, that is, HDFS files are structured in the form of libraries and tables. When querying data on the Hive server, small HDFS files may be generated during data loading or processing.
[0114] It should be understood that the application execution log can be filtered out by collecting Hive server logs and parsing them. Among them, Hive server logs refer to the operation information of Hive executing HQL statements to query data, and application execution logs refer to the execution information of data processing applications written by relevant personnel to process and analyze data through Hive.
[0115] Step S320, based on the application execution log, obtain the corresponding number of Maps and the number of Reduces;
[0116] Step S330, based on preset Map and Reduce thresholds, monitor the number of Maps and the number of Reduces of the application to achieve application monitoring.
[0117] Specifically, by further parsing the application execution log, the application ID and the corresponding number of Maps and Reduces, and the related HDFS small file information can be obtained.
[0118] It is understandable that in order to avoid the generation of a large number of small HDFS files and reduce the performance of the HDFS system, the number of Maps and Reduces of the application can be limited by presetting the Map and Reduce thresholds to prevent too many Map tasks and Reduce tasks from being generated during the application execution. The number of Maps and Reduces of the application can be monitored to achieve application monitoring.
[0119] It should be noted that the preset Map and Reduce thresholds can be set by relevant personnel based on experience, or the file management system can count and analyze the number of Map and Reduce applications to understand the execution status and performance characteristics of different applications, so as to dynamically adjust the thresholds of Reduce tasks based on historical data.
[0120] The present embodiment provides a file management method, which collects Hive server logs and parses them to obtain application execution logs; based on the application execution logs, obtains the corresponding Map quantity and Reduce quantity; based on preset Map and Reduce thresholds, monitors the Map quantity and Reduce quantity of the application to achieve application monitoring; based on the preset small file analysis report and application monitoring of the Hadoop file system, performs anomaly detection on small files to obtain anomaly detection results, wherein the small file refers to a file whose file size is smaller than the block size of the Hadoop file system; based on the anomaly detection results, performs data analysis in combination with the preset small file analysis report and application monitoring to determine the cause of the abnormal generation of small files; based on the cause of the abnormal generation of small files, performs optimized management of small files.
[0121] This embodiment uses the above solution to collect hive server logs and monitor running applications according to preset Map and Reduce thresholds, thereby effectively avoiding the generation of a large number of HDFS small files and improving the performance of the HDFS system; at the same time, it further realizes the automatic monitoring of small files in the HFDS system, so that the reasons for the abnormal generation of small files can be further analyzed based on the small file anomaly detection results, and the small files are optimized for the reasons for the abnormal generation of small files. Compared with the existing file management method, the file management method proposed in this application can realize automatic small file monitoring, application monitoring, and small file cause tracing, effectively reducing the operation and maintenance difficulty of file management of the Hadoop file system.
[0122] Based on the first embodiment and / or the second embodiment and / or the third embodiment of the present application, in the fourth embodiment of the present application, the same or similar contents as those in the first, second and third embodiments above can be referred to the above description and will not be described in detail later. Figure 4, the step 1303: when the cause classification result is the second classification result, optimizing the management of small files according to the preset file optimization management scheme, and sending an alarm message to the user side includes:
[0123] Step S410: When the abnormal generation of small files is caused by too many Maps and / or Reduces on the Hive server, adjust the parameter settings of the server, optimize the management of small files, and send an alarm message to the user side;
[0124] Specifically, when the reason for the abnormal generation of small files is that the number of Maps and / or Reduces on the Hive server in the second classification result is too large, the optimization management of small files is completed by adjusting the parameter settings of the hive server on the cluster side of the file management system, that is, the server side, and at the same time, the user needs to be informed of the reason for the abnormal generation of small files, as well as the progress and results of the abnormal processing. Among them, the parameters of the hive server can include the average file size triggered by the merge, the file merge parameters in the map stage, the file merge parameters in the reduce stage, the maximum output file size of a single merge task, the maximum number of Map / Reduce creation, etc.
[0125] In this embodiment, for example, to address the excessive output of small files due to an excessive number of Maps and / or Reduces, the small file merging parameter is enabled on the hive side, and the average size of small files is set to 128M (block size); to address the excessive number of Maps due to small file fragments, MapFile merging is enabled; to address the excessive number of Reduces, the maximum number of Ruduce is limited, and other operations.
[0126] Step S420: When the abnormal generation of small files is caused by improper application parameter configuration, parameters are adjusted according to preset application default parameters, small files are optimized and managed, and an alarm message is sent to the user side;
[0127] It should be understood that the data processing on the hive side is based on the Hadoop Map / Reduce computing framework by default. In order to avoid generating too many Map and Reduce tasks, data processing can also be performed through other computing frameworks, such as Spark and Flink.
[0128] Specifically, if the application parameters of the data processing applications developed by relevant developers are improperly configured when using different computing frameworks, it may cause too many HDFS small files to be generated during the application operation, resulting in small file exceptions.
[0129] Therefore, when the reason for the abnormal generation of small files is improper configuration of application parameters in the second classification result, the file management system adjusts the parameters configured by the application by presetting the application default parameters to avoid the generation of a large number of HDFS small files during the operation of the application, thereby achieving optimized management of small files. At the same time, the user needs to be informed of the reason for the generation of small file anomalies, as well as information such as the progress and results of the anomaly handling.
[0130] Among them, the preset application default parameters are set by relevant developers based on experience or default reference values of application parameters.
[0131] Step S430: When the abnormal generation of small files is caused by a large number of existing small files, a cold data partition detection is performed on the small files in the Hadoop file system;
[0132] Step S440: perform automatic data merging processing on the cold data partition and send an alarm message to the user side.
[0133] Specifically, when the reason for the abnormal generation of small files is that there are many small files in the second classification result, the small files in the Hadoop file system are detected for cold data partitions to obtain cold data partitions in the small files. It should be noted that cold data refers to data in HDFS that is not frequently accessed or used. Cold data is often used for specific purposes such as backup, compliance with legal regulations or offline analysis.
[0134] Then, the cold data partitions in the detected existing small files are automatically merged according to the preset processing rules. At the same time, the user needs to be informed of the reasons for the generation of small file anomalies, as well as the progress and results of the anomaly processing.
[0135] In this embodiment, when the reason for the abnormal generation of small files is the large number of existing small files, the cold data partition in the aforementioned existing small files is set to the partition with the largest number of top 1000 small files among all small file partitions that have not been accessed within 7 days.
[0136] For partitions that have not been accessed within 7 days, the first 1,000 partitions with the largest number of small files are taken out and the small files are automatically merged by data rewriting. It should be noted that the data rewriting operation is a more efficient merging operation for the case of a large number of small files. First, set the small file merging parameters, such as setting the map phase file merging parameters, setting the average file size triggered by the merge, etc., and then directly overwrite the partition data through the insert overwrite statement to complete the corresponding merge operation.
[0137] Furthermore, when cold data partitions are detected in the existing small files and some cold data partitions still need to be stored, the cold data partitions can be stored on low-cost storage devices based on the HDFS cold data tiered storage strategy to ensure data processing efficiency and speed.
[0138] It is understandable that when the abnormal generation of small files is caused by other reasons, the file management system will perform some common file processing on the abnormal HDFS small files, such as setting small file merging parameters, etc. At the same time, it is necessary to synchronously inform the user of the cause of the abnormal generation of small files, as well as the progress and results of the abnormal processing.
[0139] The present embodiment provides a file management method, which performs anomaly detection on small files based on a preset small file analysis report and application monitoring of a Hadoop file system to obtain an anomaly detection result, wherein the small file refers to a file whose file size is smaller than the block size of the Hadoop file system; based on the anomaly detection result, data analysis is performed in combination with the preset small file analysis report and application monitoring to determine the cause of the abnormal generation of small files; the cause of the abnormal generation of small files is classified to obtain a cause classification result; when the cause classification result is a first classification result, an alarm message is sent to a user side; when the cause of the abnormal generation of small files is that the number of Maps and / or the number of Reduces on a Hive server is too large, the parameter setting of the server is adjusted to optimize the management of small files, and an alarm message is sent to the user side; when the cause of the abnormal generation of small files is improper configuration of application parameters, the parameters are adjusted according to preset application default parameters, the small files are optimized, and an alarm message is sent to the user side; when the cause of the abnormal generation of small files is that there are many existing small files, cold data partition detection is performed on small files in the Hadoop file system; automatic data merging processing is performed on the cold data partition, and an alarm message is sent to the user side.
[0140] Through the above scheme, this embodiment performs different optimization management for common causes of abnormal small file generation, not only realizing automated small file monitoring, application monitoring, and small file cause tracing, but also realizing automated operation and maintenance of small file optimization management, effectively reducing the operation and maintenance cost of file management of the Hadoop file system and alleviating the operation and maintenance pressure of operation and maintenance personnel.
[0141] Based on the first embodiment and / or the second embodiment and / or the third embodiment of the present application, in the fifth embodiment of the present application, the same or similar contents as those in the first, second and third embodiments above can be referred to the above description and will not be described in detail later. Figure 5The Hadoop file system includes a server side and a user side. The file management method is applied to the user side. The step 130: optimizing the management of small files based on the abnormal generation reason of small files, further includes:
[0142] Step S510, receiving alarm information sent by the cluster side;
[0143] Step S520, receiving a user input instruction;
[0144] Specifically, after the file management system further analyzes the small file anomaly detection results to obtain the cause of the small file anomaly generation, the cluster side optimizes the management of small files according to the preset file optimization management solution based on the cause of the small file anomaly generation, and sends an alarm message to the user side.
[0145] After the user side of the file management system receives the alarm information sent by the cluster side, the user can understand the cause of the small file exception, the directory path where the HFDS small file exception occurred, the number and / or size of the abnormal small files, the progress and results of the exception handling, and other information.
[0146] Then the user can select various platform tools integrated on the user side according to the reasons for abnormal generation of small files, input the instructions for file optimization management, and perform operations such as cleaning or merging abnormal small files. At the same time, the file management system receives the instructions for file optimization management input by the user.
[0147] Step S530: Based on the user input instruction, call the corresponding platform tool to perform optimization management of small files.
[0148] Specifically, according to the received user input instruction, the corresponding platform tool is called to perform automatic optimization processing of small files.
[0149] In a feasible implementation, the platform tools include one or more of a concatenate file merging tool, a table rewriting file merging tool, a Hive table survival time TTL setting tool, a visual file detail query and deletion tool, and an application parameter adjustment tool.
[0150] It should be noted that the concatenate file merging tool refers to: for Hive tables in ORC and RCFile formats, it provides a concatenate file merging function, directly locates the HDFS small files that need to be processed through the cluster name, library name, table name, and partition, and supports multi-partition configuration, so that relevant developers can quickly merge multiple partition small files at one time, saving operation time and learning costs.
[0151] The table rewrite file merge tool refers to: for Hive tables that are not in ORC and RCFile format, it provides a generalized merge function based on table rewrite tasks. For different data scenarios, two types of rewrite modes are designed, namely overwrite mode and temporary table mode.
[0152] When the hive table contains a small amount of data or idle data, the table rewrite file merge adopts the overwrite mode. The overwrite mode is to overwrite the original table / partition by writing data over (insert over write). Before triggering the write, specify the corresponding merge parameters, and the small file merge can be completed after rewriting. At the same time, two types of merges are provided for tables and partitions.
[0153] For Hive tables with large data volumes and high data usage frequency, users are recommended to use the temporary table mode. The temporary table mode creates a new table and inserts the original table data into the new table. Before data insertion, specific small file merging parameters are also set. After the data is written, the table name is changed to complete the table data rewriting and the small file merging.
[0154] The Hive table TTL (Time To Live) setting tool refers to: Since the Hive end does not provide table life cycle attributes by default, the maintenance of historical data needs to be completed manually or by writing programs, which is cumbersome and error-prone, resulting in high development and maintenance costs. Therefore, this application uniquely provides a Hive table TTL setting tool that supports two table types: external tables and internal tables. Users can visually configure the Hive table TTL, and the file management system will automatically delete historical data for tables with set TTL attributes. Among them, an internal table means that when the data is deleted, the data in HDFS will be deleted at the same time; an external table means that when the data is deleted, the data in HDFS will not be deleted, and only the relevant information of the external table will be deleted.
[0155] The visual file detail query and deletion tool means: the file management system provides a visual file statistics detail query tool, which can be used to query the specific paths of small files, idle files, and empty files in the room group, and simultaneously provide users with file deletion options. If there is no need to retain them, the corresponding files can be deleted directly through the file deletion operation.
[0156] The application parameter adjustment tool is used when users configure data processing applications. When improper parameter configuration may cause HDFS small file exceptions, after users receive the alarm information sent by the cluster side and confirm that the cause of the small file exception is improper application parameter configuration, they can use the application parameter adjustment tool to appropriately adjust the application parameters related to the exception.
[0157] The present embodiment provides a file management method, which performs anomaly detection on small files based on a preset small file analysis report and application monitoring of a Hadoop file system to obtain an anomaly detection result, wherein the small file refers to a file whose file size is smaller than the block size of the Hadoop file system; based on the anomaly detection result, data analysis is performed in combination with a preset small file analysis report and application monitoring to determine the cause of the abnormal generation of small files; the cause of the abnormal generation of small files is classified to obtain a cause classification result; when the cause classification result is a first classification result, an alarm message is sent to a user side; when the cause classification result is a second classification result, optimization management of small files is performed according to a preset file optimization management solution, and an alarm message is sent to the user side; the alarm message sent by the cluster side is received; a user input instruction is received; and based on the user input instruction, a corresponding platform tool is called to perform optimization management of small files.
[0158] Through the above scheme, this embodiment receives the alarm information sent by the cluster side and receives the user input instructions, and automatically optimizes the small files through multiple integrated platform data processing tools on the user side, thereby effectively reducing the operation and maintenance cost of file management of the Hadoop file system, reducing the difficulty of file management of the Hadoop file system for developers, and alleviating the operation and maintenance pressure of operation and maintenance personnel.
[0159] For example, to help understand the implementation process of the file management method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 6 , Figure 6 A brief schematic diagram of the architecture of a file management system is provided, specifically:
[0160] First, the file management system automatically parses HDFS metadata (i.e., automatically parses FSImage metadata files), performs metadata information statistics, and performs indicator analysis to obtain preset small file anomaly analysis reports, generates reports on the cluster side, and implements automated small file monitoring in combination with preset application monitoring.
[0161] Then, according to the preset small file anomaly analysis report and application monitoring, anomaly detection is performed on small files to obtain anomaly detection results. Based on the anomaly detection results, combined with the preset small file analysis report and application monitoring, further data analysis is performed to determine the cause of small file anomalies. Common causes of small file anomalies are large number of existing small files, too many Map / Reduces on the hive side, improper application parameter configuration, too many original files, and other reasons.
[0162] Then, according to the different reasons for abnormal generation of small files, different small file optimization management is performed according to the preset governance plan. For example, if there are many small files in stock, you can use the automatic cleaning tool on the cluster side; if there are too many Map / Reduce on the hive side, you can adjust the server parameters; if the application parameters are improperly configured, you can also use the server parameters to adjust the application parameters to the preset application default parameters; if there are too many original files, it is necessary to send an alarm message to the user side to notify the user to perform customized processing. Because the original files are usually uploaded by the user or stored in HDFS, the user's operation permissions are required to perform the corresponding data processing.
[0163] On the user side, based on the alarm information, different platform tools, including application parameter adjustment tools, are used to perform corresponding small file optimization management.
[0164] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the file management method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0165] The present application provides a file management device, which includes: 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 file management method in the above-mentioned implementation example.
[0166] Reference below Figure 7 , which shows a schematic diagram of the structure of a file management device suitable for implementing the embodiment of the present application. The file management device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, 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 7 The file management device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0167] like Figure 7As shown, the file management device 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. In RAM1004, various programs and data required for the operation of the file management device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the file management device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a file management device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0168] 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.
[0169] The file management device provided by the present application adopts the file management method in the above embodiment, which can solve the technical problems of high operation and maintenance difficulty and difficulty in tracing the cause of small files in the existing file management method in HDFS. Compared with the prior art, the beneficial effects of the file management device provided by the present application are the same as the beneficial effects of the file management method provided by the above embodiment, and the other technical features in the file management device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0170] 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.
[0171] 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.
[0172] 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 file management method in the above-mentioned embodiment.
[0173] 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.
[0174] The computer-readable storage medium may be included in the file management device; or may exist independently without being assembled into the file management device.
[0175] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the file management device, the file management device: performs anomaly detection on small files based on the preset small file analysis report and application monitoring of the Hadoop file system to obtain anomaly detection results; performs data analysis based on the anomaly detection results in combination with the preset small file analysis report and application monitoring to determine the cause of the abnormal generation of small files; and optimizes the management of small files based on the cause of the abnormal generation of small files.
[0176] 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).
[0177] 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.
[0178] 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.
[0179] 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 file management method, and can solve the technical problems of high operation and maintenance difficulty and difficulty in tracing the causes of small files in the existing file management method in HDFS. 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 file management method provided by the above-mentioned embodiment, which will not be repeated here.
[0180] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned file management method when executed by a processor.
[0181] The computer program product provided by this application can solve the technical problems of high operation and maintenance difficulty and difficulty in tracing the cause of small files in the existing file management method in HDFS. 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 file management method provided by the above embodiment, which will not be repeated here.
[0182] 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 file management method, characterized in that: The method is applied to the Hadoop file system, and the method comprises: Based on the preset small file analysis report and application monitoring of the Hadoop file system, anomaly detection is performed on small files to obtain anomaly detection results, wherein the small file refers to a file whose file size is smaller than the block size of the Hadoop file system; Based on the anomaly detection results, combined with the preset small file analysis report and application monitoring, data analysis is performed to determine the cause of the small file anomaly generation; Based on the reasons for abnormal generation of small files, optimized management of small files is performed.
2. The method according to claim 1, characterized in that Before the step of performing anomaly detection on small files and obtaining anomaly detection results based on the preset small file analysis report and application monitoring of the Hadoop file system, the following steps are also included: Get the FSImage metadata file from the Hadoop file system; Parsing the FSImage metadata file to obtain a FSImage parsed file; Based on the FSImage parsed file, data analysis and processing are performed according to preset file indicators to generate a small file analysis report for the Hadoop file system for automated small file monitoring.
3. The method according to claim 2, characterized in that The Hadoop file system includes a Hive server. Before the step of performing anomaly detection on the preset small file analysis report and application monitoring of the Hadoop file system to obtain anomaly detection results of small files, the step further includes: Collect Hive server logs and parse them to obtain application execution logs; Based on the application execution log, obtain the corresponding number of Maps and Reduces; Based on the preset Map and Reduce thresholds, the number of Maps and Reduces of the application is monitored to achieve application monitoring.
4. The method according to claim 1, characterized in that The Hadoop file system includes a cluster side and a user side. The method is applied to the cluster side. The step of optimizing the management of small files based on the abnormal generation reasons of small files includes: Classifying the causes of abnormal generation of small files to obtain a cause classification result; When the cause classification result is the first classification result, sending an alarm message to the user side; When the cause classification result is the second classification result, small files are optimized and managed according to a preset file optimization management solution, and an alarm message is sent to the user side.
5. The method according to claim 4, characterized in that When the cause classification result is the second classification result, the step of optimizing the management of small files according to the preset file optimization management solution and sending an alarm message to the user side includes: When the abnormal generation of small files is caused by too many Maps and / or Reduces on the Hive server, adjust the parameter settings of the server to optimize the management of small files and send an alarm message to the user side; When the abnormal generation of small files is caused by improper application parameter configuration, the parameters are adjusted according to the preset application default parameters, the small files are optimized and managed, and an alarm message is sent to the user side; When the abnormal generation of small files is caused by a large number of small files in stock, a cold data partition detection is performed on the small files in the Hadoop file system; Automatically merge the cold data partitions and send warning information to the user.
6. The method according to claim 4, characterized in that The Hadoop file system includes a server side and a user side. The method is applied to the user side. The step of optimizing the management of small files based on the abnormal generation reasons of small files includes: Receive alarm information sent by the cluster side; Receive user input instructions; Based on the user input instruction, the corresponding platform tool is called to perform optimized management of small files.
7. The method according to claim 6, characterized in that The platform tools include one or more of a concatenate file merging tool, a table rewriting file merging tool, a Hive table survival time TTL setting tool, a visual file detail query and deletion tool, and an application parameter adjustment tool.
8. A file management device, 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 file management method according to any one of claims 1 to 7.
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 file management method according to any one of claims 1 to 7 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 file management method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Application exception analysis method and generation method
CN110647451A
File management method and device under distributed file system architecture
CN112328550A
Data merging method and device, electronic equipment, storage medium and program product
CN112948330A
HDFS (Hadoop Distributed File System) data monitoring analysis system, method, equipment and medium
CN116991666A
HDFS (Hadoop Distributed File System) small file optimization and analysis processing method and device
CN117520270A
