一種基于大數據架構的地震科普資源庫的設計和開發
「當今時代,愈發龐大的數據難以有效處理運用和管理,需要一種更加合適的資源獲取處理方式。該文基于大數據架構結合網絡爬蟲、數據清洗、信息檢索等前沿技術,設計開發了地震科普知識資源庫系統。其中運用了J2EE、Python、Hadoop、Elasticsearch、MySQL等技術。通過網絡爬蟲和人工上傳的方式采集地震科普相關信息資源,經過數據清洗轉換后對信息資源進行自動分類,最后將資源上傳至資源庫hdfs分布式文件系統并將文件信息保存至Elasticsearch分布式文件索引系統,由此實現大數據架構下的全文檢索。同時,建立資源庫的后臺管理系統,用于網站的日常管理和維護。相比以前的集群文件系統更加高速便捷、更加的安全穩定。(2023-2-25)」
關鍵詞:大數據 Hadoop Elasticsearch MySQL Python
Abstract: In today's era, the increasingly large data is difficult to effectively handle the application and management, and a more appropriate resource acquisition and processing method is needed. Based on the big data architecture combined with web reptile, data cleaning, information retrieval and other cutting-edge technologies, this paper designs and develops the seismic science knowledge resource database system. It uses technologies such as J2EE, Python, Hadoop, Elasticsearch, and MySQL. The seismic science related information resources are collected by means of web crawling and manual uploading, and the information resources are automatically classified after data cleaning and conversion, and finally the resources are uploaded to the resource library hdfs ,distributed file system, and the file information is saved to the Elasticsearch ,distributed file index. So the system enables full-text retrieval under the big data architecture. At the same time, the background management system of the resource library is established for daily management and maintenance of the website. It is more convenient and safer than the previous cluster file system.
1 科普知識資源庫的建設現狀
1.1 資源庫數據時效性低
一些資源在采集時沒有考慮到數據資源的不斷更新性特征,數據資源缺乏時代性和建設性,造成數據庫的資源質量低[1]。
1.2 資源庫數據利用率低
由于資源庫的建設缺乏先進的理念和技術架構,造成各類資源庫分散在不同的系統中,數據資源的整合缺乏層次性和規律性,整體上體現出綜合性差。在使用搜索功能時,一切與搜索目標相關的資源都會呈現出來,但是這些資源,衡量的標準、規劃的層次不統一,造成實際應用中的搜索難度大,利用率低。
1.3 資源庫數據冗雜質量低
為了提高資源庫的可用性和有效性,在資源庫的建設中,往往采用大批量、大規模資源采購的方式,希望能夠提高資源的應用水平。但是在實際應用中,這些采購的資源觀點重復、模式相仿、形式單一,甚至有些存在明顯的學術性錯誤,資源庫的整體數量較多但是質量較低,無法有效地服務于用戶。
2 地震科普資源庫的架構
地震科普資源庫是通過網絡爬蟲和人工上傳兩種方式進行數據采集并將記錄保存至數據庫中,然后對采集到的數據進行數據清洗,清洗之后根據既有分類標準將資源劃分到對應的類別,最后,將文件上傳至HDFS中,同時將資源信息保存至Elasticsearch中,以便用戶進行全文檢索和資源下載,資源庫的整體架構如圖1所示。
3 地震科普資源庫的功能模塊
3.1 數據采集
數據采集分人工上傳和網絡爬蟲兩種,使用爬蟲抓取數據可以提高數據采集的效率。網絡爬蟲會根據給定網址進行爬取,通過spiderkeeper對爬蟲進行管理。該文運用spiderkeeper配合scrapyd管理爬蟲,支持一鍵式部署、定時爬取任務、啟動、暫停等一系列的操作。
3.2 數據處理
由于爬取的數據或上傳的數據存在重復或不符合資源庫的需求等問題,因此需要對資源進行清洗,將不符合要求的資源過濾掉。該文通過計算文本內容的相關度,將那些內容相關度低的資源過濾掉。數據清洗整體流程如圖2所示。
(Ob9c)
Abstract: In today's era, the increasingly large data is difficult to effectively handle the application and management, and a more appropriate resource acquisition and processing method is needed. Based on the big data architecture combined with web reptile, data cleaning, information retrieval and other cutting-edge technologies, this paper designs and develops the seismic science knowledge resource database system. It uses technologies such as J2EE, Python, Hadoop, Elasticsearch, and MySQL. The seismic science related information resources are collected by means of web crawling and manual uploading, and the information resources are automatically classified after data cleaning and conversion, and finally the resources are uploaded to the resource library hdfs ,distributed file system, and the file information is saved to the Elasticsearch ,distributed file index. So the system enables full-text retrieval under the big data architecture. At the same time, the background management system of the resource library is established for daily management and maintenance of the website. It is more convenient and safer than the previous cluster file system.
1 科普知識資源庫的建設現狀
1.1 資源庫數據時效性低
一些資源在采集時沒有考慮到數據資源的不斷更新性特征,數據資源缺乏時代性和建設性,造成數據庫的資源質量低[1]。
1.2 資源庫數據利用率低
由于資源庫的建設缺乏先進的理念和技術架構,造成各類資源庫分散在不同的系統中,數據資源的整合缺乏層次性和規律性,整體上體現出綜合性差。在使用搜索功能時,一切與搜索目標相關的資源都會呈現出來,但是這些資源,衡量的標準、規劃的層次不統一,造成實際應用中的搜索難度大,利用率低。
1.3 資源庫數據冗雜質量低
為了提高資源庫的可用性和有效性,在資源庫的建設中,往往采用大批量、大規模資源采購的方式,希望能夠提高資源的應用水平。但是在實際應用中,這些采購的資源觀點重復、模式相仿、形式單一,甚至有些存在明顯的學術性錯誤,資源庫的整體數量較多但是質量較低,無法有效地服務于用戶。
2 地震科普資源庫的架構
地震科普資源庫是通過網絡爬蟲和人工上傳兩種方式進行數據采集并將記錄保存至數據庫中,然后對采集到的數據進行數據清洗,清洗之后根據既有分類標準將資源劃分到對應的類別,最后,將文件上傳至HDFS中,同時將資源信息保存至Elasticsearch中,以便用戶進行全文檢索和資源下載,資源庫的整體架構如圖1所示。
3 地震科普資源庫的功能模塊
3.1 數據采集
數據采集分人工上傳和網絡爬蟲兩種,使用爬蟲抓取數據可以提高數據采集的效率。網絡爬蟲會根據給定網址進行爬取,通過spiderkeeper對爬蟲進行管理。該文運用spiderkeeper配合scrapyd管理爬蟲,支持一鍵式部署、定時爬取任務、啟動、暫停等一系列的操作。
3.2 數據處理
由于爬取的數據或上傳的數據存在重復或不符合資源庫的需求等問題,因此需要對資源進行清洗,將不符合要求的資源過濾掉。該文通過計算文本內容的相關度,將那些內容相關度低的資源過濾掉。數據清洗整體流程如圖2所示。
(Ob9c)