爬取data數(shù)據(jù) → java-api(數(shù)據(jù)清洗、轉(zhuǎn)換成document) → 上傳es分布式集群(倒排索引) → 搜索
1、爬蟲,來獲取網(wǎng)站的html數(shù)據(jù)
nutch,Python(主流),wget(c語言)
安裝:yum install wget
堵塞運(yùn)行:wget -o /tmp/wget.log -P /root/data --no-parent --no-verbose -m -D news.cctv.com -N --convert-links --random-wait -A html,HTML,shtml,SHTML http://news.cctv.com
動態(tài)查看:tail -f /tmp/wget.log
2、數(shù)據(jù)抽?。簭木W(wǎng)頁中抽取數(shù)據(jù)
news.cctv.com/2017/10/06/ARTIZbHyClb2f7DMTDr1uDO9171006.shtml
3、把抽取出來的數(shù)據(jù)同ES建立索引
4、搜索
拿到網(wǎng)頁不是馬上做倒排索引,先把無用數(shù)據(jù)去掉
集群安裝ik分詞器
1.關(guān)閉es集群
2.共享模式下`hadoop`用戶在`plugins`下創(chuàng)建同步創(chuàng)建 `ik目錄`
3.把ik分詞器壓縮包(2.2.1),上傳到node002 的`ik`目錄
4.使用`hadoop`用戶解壓 unzip -d
5.修改ik插件描述符的配置 `vi plugin-descriptor.properties`,版本變?yōu)?.2.1 (/version 搜索)
# plugins with the incorrect elasticsearch.version.
elasticsearch.version=2.2.1
6.將ik分發(fā)給別的節(jié)點:[hadoop@node002 plugins]~ scp -r ik/ hadoop@node003:`pwd`
7.重啟動集群
對中文進(jìn)行分詞
ik分詞器和es版本有嚴(yán)格要求

