centos6.9 搭建Solr服务器
程序员文章站
2022-07-09 15:21:28
...
Sorl版本:solr-4.10.3
一、环境准备
- Centos 6.9
- JDK1.7 或以上版本
- Tomcat7 或以上版本
[aaa@qq.com developer]# ll
total 321632
drwxr-xr-x. 9 root root 4096 Aug 28 20:00 apache-tomcat-8.0.45
-rwxr--r--. 1 root root 9344843 Aug 28 19:58 apache-tomcat-8.0.45.tar.gz
-rwxr--r--. 1 root root 169983496 Aug 28 19:53 jdk-8u131-linux-x64.rpm
drwxr-xr-x. 8 root root 4096 Aug 28 19:59 solr-4.10.3
-rwxr--r--. 1 root root 150010621 Aug 28 19:57 solr-4.10.3.tgz.tgz
二、搭建步骤
1、安装好JDK
2、把tomcat复制一份到指定路径
[aaa@qq.com developer]# mkdir /usr/local/solr
[aaa@qq.com developer]# cp -r apache-tomcat-8.0.45 /usr/local/solr/tomcat
3、把solr的war包部署到tomcat的webapps目录下
[aaa@qq.com developer]# cd solr-4.10.3/dist/
[aaa@qq.com dist]# ll *.war
-rw-r--r--. 1 root root 29741796 Dec 10 2014 solr-4.10.3.war
[aaa@qq.com dist]# cp solr-4.10.3.war /usr/local/solr/tomcat/webapps/solr.war
4、加压war包(启动tomcat自动解压),解压后关闭tomcat
[aaa@qq.com dist]# cd /usr/local/solr/tomcat/bin
[aaa@qq.com bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/solr/tomcat
Using CATALINA_HOME: /usr/local/solr/tomcat
Using CATALINA_TMPDIR: /usr/local/solr/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/solr/tomcat/bin/bootstrap.jar:/usr/local/solr/tomcat/bin/tomcat-juli.jar
Tomcat started.
[aaa@qq.com bin]# ./shutdown.sh
Using CATALINA_BASE: /usr/local/solr/tomcat
Using CATALINA_HOME: /usr/local/solr/tomcat
Using CATALINA_TMPDIR: /usr/local/solr/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/solr/tomcat/bin/bootstrap.jar:/usr/local/solr/tomcat/bin/tomcat-juli.
5、把tomcat的webapps下的war包删除
[aaa@qq.com bin]# cd ../webapps/
[aaa@qq.com webapps]# ll
total 29072
drwxr-xr-x. 14 root root 4096 Aug 28 20:04 docs
drwxr-xr-x. 6 root root 4096 Aug 28 20:04 examples
drwxr-xr-x. 5 root root 4096 Aug 28 20:04 host-manager
drwxr-xr-x. 5 root root 4096 Aug 28 20:04 manager
drwxr-xr-x. 3 root root 4096 Aug 28 20:04 ROOT
drwxr-xr-x. 8 root root 4096 Aug 28 20:06 solr
-rw-r--r--. 1 root root 29741796 Aug 28 20:06 solr.war
[aaa@qq.com webapps]# rm -f solr.war
6、进入到/developer/solr-4.10.3/example/lib/ext/,把ext下的jar包复制到/usr/local/solr/tomcat/webapps/solr/WEB-INF/lib/下
[aaa@qq.com webapps]# cd /developer/solr-4.10.3/example/lib/ext/
[aaa@qq.com ext]# ll
total 552
-rw-r--r--. 1 root root 16515 Feb 6 2014 jcl-over-slf4j-1.7.6.jar
-rw-r--r--. 1 root root 4959 Feb 6 2014 jul-to-slf4j-1.7.6.jar
-rw-r--r--. 1 root root 489884 May 26 2012 log4j-1.2.17.jar
-rw-r--r--. 1 root root 28688 Feb 6 2014 slf4j-api-1.7.6.jar
-rw-r--r--. 1 root root 8869 Feb 6 2014 slf4j-log4j12-1.7.6.jar
[aaa@qq.com ext]# cp * /usr/local/solr/tomcat/webapps/solr/WEB-INF/lib/
7、创建solrhome并修改配置文件
[aaa@qq.com ext]# cd ..
[aaa@qq.com example]# cp -r solr /usr/local/solr/solrhome
[aaa@qq.com example]# cd /usr/local/solr/tomcat/webapps/solr/WEB-INF
[aaa@qq.com WEB-INF]# vim web.xml
8、找到<env-entry>节点,去掉注释,并把<env-entry-value>节点修改为/usr/local/solr/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>
9、启动tomcat,访问http://服务器IP地址:8080/solr
上一篇: 【IDEA】如何设置类头注释和方法注释
下一篇: Solr 高亮显示