一、源文件编译及转移
1.先将sparkler-ui目录下的进行打包
在/opt/git/sparkler/sparkler-ui目录下执行:
mvn clean package
如果出现mvn偶尔出现不能用的情况,可尝试使用如下命令
source /etc/profile
2.将整个sparkler项目进行打包
然后再在/opt/git/sparkler目录下执行:
mvn clean install -DskipTests
-DskipTests表示跳过测试
3.将各个文件移到solr的相应目录下
cp -r /opt/git/sparkler/sparkler-ui/sparkler-dashboard /opt/git/solr-6.5.1/server/solr-webapp/
cp -r /opt/git/sparkler/conf/solr/sparkler-jetty-context.xml /opt/git/solr-6.5.1/server/contexts/
cp -rv /opt/git/sparkler/conf/solr/crawldb /opt/git/solr-6.5.1/server/solr/configsets/
cp -r /opt/git/solr-6.5.1/server/solr/configsets/crawldb /opt/git/solr-6.5.1/server/solr/
二、启动服务执行该项目
1.启动solr
/opt/git/solr-6.5.1目录下
bin/solr start -force
2.add Core
浏览器访问http://localhost:8983/solr/#/~cores/
新增(add Core) ————》name和instanceDir两个字段值都为crawldb
3.
浏览器访问:http://localhost:8983/banana/#/dashboard
点击右上角的文件图标(第三个小图标)
选择文件---》~/sparkler/sparkler/sparkler-ui/dashboard/Sparkler-Dashboard-Basic
点击右上角保存图标(第四个小图标)
点击 Set as Browser Default选项
4.
进入到sparkler源码根目录
cd /opt/git/sparkler/
bin/sparkler.sh inject -su http://www.sina.com.cn/
#执行会返回一个jobId值,请记录它(将这个值放在-id 后面)
bin/sparkler.sh crawl -id -m local[*] -i 1
i属性代表迭代次数
可以通过访问http://localhost:8983/banana/#/dashboard看到数据了
结果如图:
c