Template-based distributed Internet big data acquisition system and method
Through a template-based distributed Internet big data acquisition system, combined with proxy management and Docker deployment, the problem of insufficient security, stability and flexibility of Internet big data acquisition is solved, and more efficient and flexible data acquisition is achieved, reducing the Risk of ban.
Patent Information
- Application Number
- CN202211669718.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-25
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2042-12-25
AI Technical Summary
The existing technology has problems with insufficient security, stability and flexibility in Internet big data collection, especially the flexibility and scalability of dynamic web pages and deep web page data collection, and is easily reverse crawling by websites. Test ban.
Adopt a template-based distributed Internet big data acquisition system, including template management, proxy management and task execution units, improve collection flexibility and security through template nesting and proxy request interval settings, and use Docker technology to deploy data storage and acquisition nodes to Improve portability and network access performance.
It improves the security and stability of data acquisition, enhances the flexibility and scalability of acquisition, reduces the probability of being blocked, and improves the system's portability and network access performance.
Smart Images

Figure CN115967607B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of big data technology, and in particular relates to a distributed Internet big data acquisition system and method, which can be used for artificial intelligence, big data, and the Internet of Things. Background Art
[0002] In recent years, the development of artificial intelligence, blockchain, Internet of Things and other technologies requires the support of big data, and the Internet is full of a large amount of data. How to accurately collect the available data on the Internet is a challenging problem. Traditional network data collection is based on web crawler technology. Web crawler is an automated program that can crawl, extract and collect data on the Internet. It usually automatically accesses websites, crawls data on websites, and stores it on local computers. Web crawler technology mainly realizes three functions: obtaining web page information and collecting data; parsing web page data and extracting data; saving the extracted data to a suitable database. The data captured by the crawler program needs to be stored on the local computer for subsequent processing and analysis.
[0003] At present, crawler technology is mainly concentrated in three aspects: first, distributed crawler technology that focuses on collection efficiency. Distributed crawler is a distributed system that can decompose a crawler task into multiple subtasks and assign them to different machines for execution. Distributed crawler technology can improve the efficiency and throughput of crawlers and avoid the problem of single point failure; second, dynamic web crawler technology that focuses on collection content. Dynamic web crawler is a special crawler that can handle the crawling and extraction of dynamic web pages. Dynamic web crawlers usually use browser simulators to simulate the behavior of real users to crawl data on dynamic web pages; third, deep crawler technology that focuses on the depth of data collection. The collection depth of deep crawler technology is deeper than that of general web crawlers, and it can mine more web page information and collect in depth according to the structure of the website. This technology usually continues to collect all linked pages in a certain web page until the deepest level of the website is collected. Deep crawler technology can obtain more web page information and can analyze the structure of the website more comprehensively.
[0004] The patent document with publication number CN110489698A discloses a system and method for automatically collecting web page data. The system adds a script engine module and a process control module based on an embedded browser to realize the automatic collection of web page data. However, this system does not limit the access frequency of the target website and does not use a proxy. The website's anti-crawling mechanism will detect the access frequency and IP address. When the website detects a large number of requests from the same IP address in a short period of time, it will regard these requests as machine behavior and prohibit these requests from accessing the web page data, thereby failing to collect data.
[0005] Patent document with publication number CN110442766A discloses a web page data collection method, device, equipment and storage medium. The method presets different script templates for different data collection requirements, but the website structure changes with each passing day. Once the web page structure changes, all related templates need to be modified, making subsequent maintenance difficult.
[0006] In addition, although the above-mentioned technical solutions can obtain dynamic web page data and collect web page depth data, the collected content is limited to the current web page or continues to collect link data existing in the current web page, and the flexibility and scalability of the collected content are not high. Summary of the invention
[0007] The purpose of the present invention is to provide a template-based distributed Internet big data collection system and method to solve the above-mentioned problems of the prior art, improve the security and stability of collected data, and enhance the flexibility and scalability of collection.
[0008] To achieve the above object, the technical solution of the present invention is as follows:
[0009] 1. A template-based distributed Internet big data acquisition system, characterized by: comprising a system function management unit and a task execution unit
[0010] The system function management unit includes:
[0011] Template management module is used to manage various acquisition templates in the system, including adding, deleting, modifying, importing and exporting, and provides template testing and template nesting functions;
[0012] The agent management module is used for agent management required for collection tasks, including agent creation, deletion, import and export, and setting of agent request intervals;
[0013] The task management module is used to generate and save data collection tasks according to the existing data and related settings of the template management module and the agent management module;
[0014] Node management module, used for overall node settings management, node information monitoring, and data collection and browsing;
[0015] The task execution unit comprises:
[0016] The main logic processing module is used to execute the tasks generated by the task management module according to relevant settings;
[0017] The exception handling module includes a proxy exception handling submodule and a template exception handling submodule, which are used to enter different exception handling branches for processing according to different exception types when problems occur during the processing of the main logic processing module;
[0018] The post-processing module is used to process and save the subsequent collected data when the main logic processing sub-module executes without exception.
[0019] Furthermore, the template management module performs template testing, first creates, imports or modifies a template, and configures the variables required for template operation; then passes the configured template information to the main logic processing module, and the main logic processing module performs data collection tasks; after the main logic processing module is finished running, the running result is returned to the template management module, and the template management module performs a simple display: if the execution is successful, the template management module will display the collected data information; if the execution fails, the template management module will display abnormal information, modify the template again, and repeat the whole process until the template can collect the expected content, and then save the template for use.
[0020] Furthermore, the template management module performs template nesting settings when creating a new template, that is, calling the current template and the existing template to share task variable settings, and configuring different collection URLs between templates to achieve multi-website joint collection of data content.
[0021] Furthermore, the proxy management module sets the request interval for the proxy by setting a specific access time interval for each access request based on a given number of requests per second, so that all requests issued in a single collection task obey the Poisson distribution and the request interval obeys the exponential distribution. The specific operation is to first calculate the average request time interval based on the number of requests per second, and construct an exponential distribution curve with this interval as the expectation; then perform random sampling on this curve and set a specified access time interval for each request.
[0022] Furthermore, the data collection logic of the task executed by the main logic processing module is the main process of the collection task, that is, according to the task template and its variable information, the agent configured by the task is used to execute the template task according to the set execution time and agent request access frequency.
[0023] 2. A method for collecting big data using the above system, characterized in that it comprises the following steps:
[0024] S1) Based on Docker technology, run the system deployment script file and deploy the data collection system:
[0025] Use the deployment script to deploy basic Docker services;
[0026] Run the data storage node image of the data acquisition system on this basic Docker service to generate the corresponding container to deploy the data storage node;
[0027] Run the collection node image of the data collection system, generate the corresponding container, and deploy the collection node.
[0028] S2) Log in to the data acquisition system, that is, after the data acquisition system is deployed, enter the system management interface and perform corresponding operations through all modules of the system function management unit:
[0029] S2a) Template management module, create a new data collection template or import an existing template, and choose to perform template testing after the template is created;
[0030] S2b) Proxy management module, create or import a proxy server, and set the number of requests per second for the proxy;
[0031] S2c) Task management module, selects the collection template to be executed and the agent to be used, sets the task running time, configures the task running variables, runs the collection task after the configuration is completed, and sends the task information to the task execution unit;
[0032] S3) The task execution unit executes the data collection task:
[0033] After receiving the collection task information, the main logic processing module executes the collection task according to the relevant configuration of the task, and performs different operations according to the execution situation during the entire execution process:
[0034] If the whole process is executed normally, the collected data is processed and saved through the post-processing module;
[0035] Otherwise, the exception problem is handled through the exception handling module, and the data collection task is re-executed after the exception handling is completed;
[0036] S4) The task execution unit transmits the collected data to the node management module, which displays the task execution log, the node information of the task execution process and all the collected data.
[0037] Compared with the prior art, the present invention has the following advantages:
[0038] First, the system of the present invention can provide a template test function because its template management module can directly display the test results, which is convenient for relevant personnel to troubleshoot template problems, improves the work efficiency of relevant personnel, and reduces maintenance costs; at the same time, because the module performs template nesting settings when creating templates, it not only improves the flexibility of collecting content in a single collection task, but also expands the collection scope of the collection task compared to the traditional data collection template that can only collect content from the same website in a single collection task;
[0039] Second, since the system of the present invention provides a time interval setting method that obeys exponential distribution through the proxy management module, it can more accurately simulate the network data access request under normal circumstances, avoid the sent request being detected by the anti-pickpocketing mechanism of the target website, reduce the probability of being blocked by the target website, and improve the security and stability of the collection system;
[0040] Third, since the present invention uses a deployment script based on Docker technology to deploy data storage nodes and collection nodes, it can obtain support from all platforms that can run Docker, greatly improving the portability of the system;
[0041] Fourthly, when deploying a data acquisition system, the method of the present invention deploys the data storage nodes and the acquisition nodes on the intranet server and the public network server respectively, which not only can achieve higher data accessibility at a lower cost, but also can obtain better network access performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a block diagram of the template-based distributed Internet big data acquisition system of the present invention;
[0043] Figure 2 yes Figure 1 Template test operation flow chart of template management module;
[0044] Figure 3 This is a flow chart of the distributed Internet big data collection method based on templates of the present invention;
[0045] Figure 4 It is a schematic diagram of a data acquisition system deployed in the method of the present invention. DETAILED DESCRIPTION
[0046] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.
[0047] Reference Figure 1 The system of the present invention includes a system function management unit 1 and a task execution unit 2.
[0048] The system function management unit 1 is mainly used to manage templates and agents, configure data collection tasks and display node-related information, and includes a template management module 11, an agent management module 12, a task management module 13 and a node management module 14.
[0049] The template management module 11 is mainly used for managing the collection templates in the system. The module supports the basic operations of creating, deleting, modifying and querying templates, and supports exporting the template information in the node to a text file. Other nodes can import this template text file through the template import function, which is very convenient for migrating and using the template. Since the website structure often changes, the collection template of the corresponding website will also become invalid from time to time. In order to facilitate the relevant staff to test the availability of the template more conveniently and improve work efficiency, the template management module provides a quick template testing function. In order to solve the problem that the collection content of a single collection of traditional data collection tasks is limited to a single website, this module also provides a template nesting function, that is, the template management module performs template nesting settings when creating a new template, first adds an execution step to be set in the current template, and then selects the template nesting function in this step setting. The template nesting function provides a list of existing templates, and finally selects a template from the list for nesting, so as to realize calling another template in one template, so that the current template and the existing template share the task variable settings at runtime, and the templates realize multi-website joint collection by configuring different collection URLs, thereby expanding the scope of collection content.
[0050] The proxy management template 12 is mainly used to manage the proxies required for the collection tasks. Operations include creation and deletion, import and export. At the same time, in order to better use the proxy to simulate normal network requests, the proxy management module supports setting a request time interval that obeys an exponential distribution. The setting of the request time interval is based on a given number of requests per second. A specific access time interval is set for each access request, so that all requests issued in a single collection task obey the Poisson distribution and the request interval obeys the exponential distribution. The specific operation is to first calculate the average request time interval based on the number of requests per second, and construct an exponential distribution curve with this interval as the expectation; then perform random sampling on this curve and set a specified access time interval for each request.
[0051] The task management module 13 is mainly used to configure the collection template, select the task agent, specify the template variables, and set the task execution time. Its specific implementation is: according to the template in the template management module, configure the relevant variables required by the template; select the available agent in the agent management module for the collection task, set the execution time to single execution or periodic execution, and finally generate and save the data collection task.
[0052] The node management module 14 is mainly used for overall node setting management and monitoring node information, including disk information, network information, executor information, task execution log information and all collected data. It specifically displays hardware information such as CPU usage, memory usage, and node bandwidth occupancy during node operation, as well as system software information such as the number of successful task executions and the total number of collected data within a period of time. It also provides a browsing function for all collected data to facilitate query and screening based on time periods, collection task names, and keywords.
[0053] The task execution unit 2 is mainly used to execute tasks, and includes a main logic processing module 21 , an exception handling module 22 and a post-processing module 23 .
[0054] The main logic processing module 21 is used to execute the data collection task transmitted from the task management module 13. It is the main process of the collection task. It uses the agent configured by the task according to the template of the task and its variable information, and executes the template task according to the set execution time and agent request access frequency.
[0055] The exception handling module 22 includes an agent exception handling submodule 221 and a template exception handling submodule 222, which are used to enter different exception handling branches according to different exception types when problems occur during the processing of the main logic processing module 21. Among them, the agent exception handling submodule 221 is to replace a new available agent for the current task when an agent connection problem occurs, and then perform a periodic agent connection test on the agent with the problem: if the agent is available, the agent status is updated for subsequent use; if the agent is still unusable after a long period of testing, the agent is discarded and a corresponding prompt message is given; the template exception handling submodule 222 is to determine whether it is an agent problem when no data can be collected: if it is an agent problem, it is processed through the agent exception handling submodule 221, and if it is determined not to be an agent problem, an exception log is output to remind relevant personnel to modify the template.
[0056] The post-processing module 23 is used to perform subsequent data processing such as data cleaning, data formatting and the like when the main logic processing module executes without exception, and to save the collected data.
[0057] Reference Figure 2 The template management module 11 performs the template test as follows:
[0058] First, create, import or modify a template and configure the variables required for the template to run;
[0059] Then, the configured template information is passed to the main body logic processing module 21, and the main body logic processing module 21 performs the data collection task;
[0060] Finally, after the main logic processing module 21 is finished running, the running result is returned to the template management module 11, and the template management module performs a simple display according to the execution status: if the execution is successful, the template management module will display the collected data information; if the execution fails, the template management module will display abnormal information and the template can be modified again;
[0061] Repeat the whole process until the template can collect the expected content, and then save the template for later use.
[0062] Reference Figure 3 The present invention uses the above system to collect big data, and the implementation steps are as follows:
[0063] Step 1: Based on Docker technology, run the system deployment script file to deploy the data collection system.
[0064] Docker is a software developed using the Go language launched by Google. It encapsulates and isolates processes based on the Linux kernel and is a virtualization technology at the operating system level. Docker's image provides a complete runtime environment except for the kernel, ensuring the consistency of the application runtime environment. It is easy to migrate applications running on one platform to another without worrying about changes in the runtime environment causing the application to not run properly. Using Docker, you can achieve continuous integration, continuous delivery, and deployment by customizing application images.
[0065] Reference Figure 4 , the implementation of this step is as follows:
[0066] 1.1) Use the deployment script to deploy basic Docker services;
[0067] 1.2) Run the data storage node image of the data acquisition system on this basic Docker service to generate the corresponding container to deploy the data storage node. A data acquisition system can contain one or more data storage nodes, which contain various storage services and are mostly deployed using intranet servers to achieve higher data accessibility at a lower cost;
[0068] 1.3) Run the collection node image of the data collection system, generate the corresponding container, and deploy the collection node. A data collection system can contain one or more collection nodes. Each collection node in the system can run different parts of the same task or directly run different tasks. The collection node is generally deployed in a public network server such as a cloud server to obtain better network access performance.
[0069] Data storage nodes and collection nodes can also be deployed simultaneously on an intranet or public network machine to expand system usage scenarios.
[0070] Step 2: Configure the data collection task.
[0071] After the data acquisition system is deployed, enter the system management interface and perform corresponding operations through all modules of the system function management unit 1:
[0072] 2.1) Prepare data collection template: Create a new data collection template or import an existing template through the template management module 11. After the template is created, you can choose to use the template test;
[0073] 2.2) Prepare the acquisition task agent: through the agent management module 12, create or import a proxy server and set the number of requests per second of the agent;
[0074] 2.3) Configure data collection tasks: through the task management module 13, select the collection template to be executed and the agent to be used, set the task running time, configure the task running variables, run the collection task after the configuration is completed, and send the task information to the task execution unit 2;
[0075] Step 3: The task execution unit 2 executes the data collection task.
[0076] After receiving the collection task information, the main logic processing module 21 executes the collection task according to the relevant configuration of the task, and performs different operations according to the execution situation during the entire execution process:
[0077] If the whole process is executed normally, the collected data is processed and saved by the post-processing module 23;
[0078] Otherwise, the exception problem is handled by the exception handling module 22, and the data collection task is re-executed after the exception handling is completed;
[0079] Step 4: View the task execution information.
[0080] The task execution unit 2 transmits the collected data to the node management module 14, which displays the task execution log, the node information of the task execution process and all the collected data.
[0081] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the art within the technical scope disclosed in the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A template-based distributed Internet big data acquisition system, characterized by: It includes a system function management unit (1) and a task execution unit (2); The system function management unit (1) comprises: The template management module (11) is used for the management of various acquisition templates in the system, including adding, deleting, modifying, querying, importing and exporting, and provides template testing function and template nesting function; The template management module (11) performs template testing by first creating, importing or modifying a template and configuring the variables required for the template to run; then passing the configured template information to the subject logic processing module to perform the data collection task; after the subject logic processing module runs, the running result is returned to the template management module, and the template management module then performs a simple display: If the execution is successful, the template management module will display the collected data information; If the execution fails, the template management module will display an exception message, modify the template again, and repeat the whole process until the template management module collects the expected content and saves the template for future use; The template management module (11) performs template nesting settings when creating a new template, that is, calling the current template and the existing template to share task variable settings, and configuring different collection URLs between templates to achieve multi-website joint collection of data content; An agent management module (12) is used for agent management required for collection tasks, including creation, deletion, import and export of agents, and setting request intervals for agents; The proxy management module (12) sets the request interval for the proxy by setting a specific access time interval for each access request based on a given number of requests per second, so that all requests issued in a single collection task obey the Poisson distribution and the request interval obeys the exponential distribution. The implementation steps are: firstly calculating the average request time interval based on the number of requests per second, and constructing an exponential distribution curve based on this interval as an expectation; then performing random sampling on this curve and setting a specified access time interval for each request; A task management module (13), used to generate and save data collection tasks according to the existing data and related settings of the template management module and the agent management module; A node management module (14) is used for overall node configuration management, node information monitoring, and data collection and browsing; The task execution unit (2) comprises: The main logic processing module (21) is used to execute the tasks generated by the task management module according to relevant settings; An exception handling module (22), comprising an agent exception handling submodule (221) and a template exception handling submodule (222), for entering different exception handling branches for processing according to different exception types when a problem occurs during processing by the main logic processing module; The post-processing module (23) is used to process and save subsequent collected data when the main logic processing module executes without exception.
2. The system according to claim 1, characterized in that: The data collection task constructed by the task management module (13) includes configuring a collection template, specifying template variables, and setting a task execution time.
3. The system according to claim 1, characterized in that: The node information monitored by the node management module (14) includes disk information, network information, executor information, task execution log information and collected data.
4. The system according to claim 1, characterized in that The data collection logic of the task executed by the main logic processing module (21) is the main process of the collection task, that is, according to the template of the task and its variable information, using the agent configured by the task, the data collection task is executed according to the set execution time and agent request access frequency.
5. The system according to claim 1, characterized in that The proxy exception handling submodule (221) is to replace a new available proxy for the current task when a proxy connection problem occurs, and then perform a periodic proxy connection test on the problematic proxy: If the proxy is available, update the proxy status for subsequent use; If the proxy still cannot be used after a long period of testing, the proxy will be discarded and a corresponding prompt message will be given.
6. The system according to claim 1, characterized in that The template exception handling submodule (222) determines whether it is a proxy problem when no data can be collected: If it is a proxy problem, it will be handled through the proxy exception handling module (221). If it is determined that it is not a proxy problem, an exception log will be output to remind relevant personnel to modify the template.
7. A method for big data collection by a template-based distributed Internet big data collection system running in the template-based distributed Internet big data collection system of claim 1, characterized in that: The following steps are involved: S1) Based on Docker technology, run the system deployment script file and deploy the data collection system: Use the deployment script to deploy basic Docker services; Run the data storage node image of the data acquisition system on this basic Docker service to generate the corresponding container to deploy the data storage node; Run the collection node image of the data collection system, generate the corresponding container, and deploy the collection node; S2) Log in to the data collection system. After the data collection system is deployed, enter the system management interface and perform corresponding operations through all modules of the system function management unit (1): S2a) Template management module (11), creating a new data collection template or importing an existing template, and optionally performing a template test after the template is created; S2b) Proxy management module (12), creating or importing a proxy server, and setting the number of requests per second for the proxy; S2c) Task management module (13), selects the collection template to be executed and the agent to be used, sets the task running time, configures the task running variables, runs the collection task after the configuration is completed, and sends the task information to the task execution unit (2); S3) Task execution unit (2) executes data collection tasks: After receiving the collection task information, the main logic processing module (21) executes the collection task according to the relevant configuration of the task, and performs different operations according to the execution situation during the entire execution process: If the whole process is executed normally, the collected data is processed and saved by the post-processing module (23); Otherwise, the exception problem is handled by the exception handling module (22), and the data collection task is re-executed after the exception handling is completed; S4) The task execution unit (2) transmits the collected data to the node management module (14), which displays the task execution log, the node information of the task execution process and all the collected data.
