搭建Solr7.3单机版

原博客  https://blog.csdn.net/yiqing_summer/article/details/79934584

 1、Solr下载:http://mirror.bit.edu.cn/apache/lucene/solr/7.3.0/,并复制到CentOS下

2、在新建/usr/local/solr文件夹,并拷贝将Tomcat拷贝到这个文件夹下并改名为tomcat8

 [root@localhost Desktop]# mkdir /usr/local/solr
 [root@localhost Desktop]# cp /usr/java/apache-tomcat-8.0.50 -r /usr/local/solr/tomcat8

  

3、将solr解压缩到/usr/local/solr文件夹下

[root@localhost Desktop]# tar -zxvf solr-7.3.0.tgz -C /usr/local/solr/
 

4、将solr部署到tomcat中(将对应文件夹拷贝到tomcat的webapps下并改名为solr)

[root@localhost Desktop]# cp /usr/local/solr/solr-7.3.0/server/solr-webapp/webapp -r /usr/local/solr/tomcat8/webapps/solr

5、拷贝日志相关jar包及其他包:

[root@localhost Desktop]# cp /usr/local/solr/solr-7.3.0/server/lib/ext/* /usr/local/solr/tomcat8/webapps/solr/WEB-INF/lib/
 
 [root@localhost Desktop]# cp /usr/local/solr/solr-7.3.0/server/lib/gmetric4j-1.0.7.jar /usr/local/solr/tomcat8/webapps/solr/WEB-INF/lib/ 
[root@localhost Desktop]# cp /usr/local/solr/solr-7.3.0/server/lib/metrics* /usr/local/solr/tomcat8/webapps/solr/WEB-INF/lib/

 

6、创建solrhome

[root@localhost Desktop]# cp /usr/local/solr/solr-7.3.0/server/solr -r /usr/local/solr/solrhome

 

 

7、修改web.xml告诉solr服务solrhome的位置

vi /usr/local/solr/tomcat8/webapps/solr/WEB-INF/web.xml
 

找到下面代码去注释,并改为solrhome路径(保存退出)

<env-entry>
  <env-entry-name>solr/home</env-entry-name>
  <env-entry-value>/usr/local/solr/solrhome</env-entry-value>
  <env-entry-type>java.lang.String</env-entry-type> 
</env-entry>

 

8、拷贝log4j.properties

[root@localhost Desktop]# mkdir /usr/local/solr/tomcat8/webapps/solr/WEB-INF/classes
 
[root@localhost Desktop]# cp /usr/local/solr/solr-7.3.0/server/resources/log4j.properties /usr/local/solr/tomcat8/webapps/solr/WEB-INF/classes/

 

9、修改端口号为8983

[root@localhost ~]# vim /usr/local/solr/tomcat8/conf/server.xml 
 

10、将8983端口添加到防火墙例外并重启

 
firewall-cmd --zone=public --add-port=8080/tcp --permanent
 
 
 
firewall-cmd --reload

 

11、不做这一步会出现403错误:

进入下面的web.xml中将下列代码注释:

 

[root@localhost ~]# vim /usr/local/solr/tomcat8/webapps/solr/WEB-INF/web.xml 
 
<!--<security-constraint>
 
<web-resource-collection>
 
<web-resource-name>Disable TRACE</web-resource-name>
 
<url-pattern>/</url-pattern>
 
<http-method>TRACE</http-method>
 
</web-resource-collection>
 
<auth-constraint/>
 
</security-constraint>-->

 

11、启动tomcat

[root@localhost Desktop]# /usr/local/solr/tomcat8/bin/startup.sh 
 

12、

在CentOS的浏览器下访问:127.0.0.1:8983/solr/index.html

Windows下访问:CentOSIP:8983/solr/index.html

其中CentOSIP用ifconfig可以查看

--------------------- 本文来自 煺罟哏 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/yiqing_summer/article/details/79934584?utm_source=copy 

posted on 2018-09-27 16:24  博客园197  阅读(153)  评论(0编辑  收藏  举报