从Solr官方网站(http://lucene.apache.org/solr/ )下载Solr4.10.3,根据Solr的运行环境,Linux下需要下载lucene-4.10.3.tgz,windows下需要下载lucene-4.10.3.zip。
Solr使用指南可参考:https://wiki.apache.org/solr/FrontPage。
相关包下载: http://mirror.bit.edu.cn/apache/lucene/
或者 http://archive.apache.org/dist/lucene/
1.solr安装及配置
需要把solr服务器安装到linux环境:
第一步:安装linux、jdk、tomcat。
[[email protected] ~]# ll
total 8044
-rw-r--r--. 1 root root 8234674 Oct 27 2013 apache-tomcat-7.0.47.tar.gz
[[email protected] ~]# tar -zxf apache-tomcat-7.0.47.tar.gz
[[email protected] ~]# ll
total 8048
drwxr-xr-x. 9 root root 4096 Sep 10 17:55 apache-tomcat-7.0.47
-rw-r--r--. 1 root root 8234674 Oct 27 2013 apache-tomcat-7.0.47.tar.gz
[[email protected] ~]# mkdir /usr/local/solr
[[email protected] ~]# cp apache-tomcat-7.0.47 /usr/local/solr/tomcat
cp: omitting directory `apache-tomcat-7.0.47'
[[email protected] ~]# cp apache-tomcat-7.0.47 /usr/local/solr/tomcat -r
[[email protected] ~]# cd /usr/local/solr/
[[email protected] solr]# ll
total 4
drwxr-xr-x. 9 root root 4096 Sep 10 17:56 tomcat
[[email protected] solr]#
第二步:把solr的压缩包上传到服务器。并解压。
第三步:把/root/solr-4.10.3/dist/solr-4.10.3.war包部署到tomcat下。并改名为solr.war
[[email protected] dist]# cp solr-4.10.3.war /usr/local/solr/tomcat/webapps/solr.war
第四步:解压war包。启动tomcat自动解压。关闭tomcat。删除solr.war.
第五步:把/root/solr-4.10.3/example/lib/ext 目录下所有的jar包复制到solr工程中。
[[email protected] ext]# cp * /usr/local/solr/tomcat/webapps/solr/WEB-INF/lib/
第六步:创建solrhome。Solrhome是存放solr服务器所有配置文件的目录。
[[email protected] example]# pwd
/root/solr-4.10.3/example
[[email protected] example]# cp -r solr /usr/local/solr/solrhome
[[email protected] example]#
第七步:告诉solr服务器solrhome的位置,去掉原来的注释!。
需要修改solr工程的web.xml文件(在/usr/local/solr/tomcat/webapps/solr/WEB-INF/目录下)。
第八步:手动启动tomcat(命令在/usr/local/solr/tomcat/bin目录下)
第九步:在浏览器输入localhost:8080/solr/#/查看solr启动结果
第十步:Eclipse代码测试solr如下图,注意导入相关jar包
solr后台查询如下图:
2.solr常用操作
详情: https://blog.csdn.net/qq_37334135/article/details/76862508