一、环境准备:


系统环境:centos 6.5

         tomcat 7.0.47

         jdk-7u9

         solr-4.7.0

首先将软件包上传到/tmp目录下

1、  jdk安装

[root@svn-server /]# cd /tmp/

[root@svn-server /]#tar zxvf  jdk-7u9-linux-x64.tar.gz

[root@svn-server /]#mv  jdk1.7.0_09 /usr/

[root@svn-server /]#vi  /etc/profile

在最后一行复制以下代码添加如下内容:

JAVA_HOME=/usr/jdk1.7.0_09/

CLASSPATH=.:$JAVA_HOME/lib/tools.jar

PATH=$JAVA_HOME/bin:$PATH

export JAVA_HOME CLASSPATH PATH

保存退出(:wq!)后,执行下面命令生效:

source /etc/profile

2、  tomcat安装

将tomcat包减压到tmp目录下:

[root@svn-server tmp]tar zxvf apache-tomcat-7.0.47.tar.gz

将tomcat包移动到/usr/local/tomcat 下:

[root@svn-server tmp]mv apache-tomcat-7.0.47  /usr/local/tomcat

二、安装solr

1、解压solr

[root@svn-server tmp]tar -zxvf solr-4.7.0.tgz

2、将solr包移动到opt目录下:

[root@svn-server tmp]mv /tmp/solr-4.7.0   /opt/solr

3、把exmaple/webapps中的solr.war复制到tomcat

[root@svn-server tmp]makdir  -p /opt/tomcat/webapps

[root@svn-server tmp]cp /opt/solr/example/webapps/solr.war  /opt/tomcat/webapps/

[root@svn-server tmp]vi  /usr/local/tomcat/conf/server.xml

<Host name="localhost"  appBase="/opt/tomcat/webapps"

unpackWARs="true" autoDeploy="true">

如图将webapps改为/opt/tomcat/webapps 即可;

4、启动tomcat,solr.war 自动解压,修改solr项目下的web.xml

[root@svn-server tmp]cd /usr/local/tomcat/bin/

[root@svn-server bin]./startup.sh

[root@svn-server bin]vi /opt/tomcat/webapps/solr/WEB-INF/web.xml

5、修改solr home配置(注意:要把这段内容的注释去掉,否则不生效):

<env-entry>

<env-entry-name>solr/home</env-entry-name>

<env-entry-value>/opt/solr/example/solr</env-entry-value>

<env-entry-type>java.lang.String</env-entry-type>

</env-entry>

6、复制solr/example/lib/ext下的jar包到/tomcat/../solr/WEB-INF/lib/下:

[root@svn-server tmp]cp /opt/solr/example/lib/ext/*.jar  /opt/tomcat/webapps/solr/WEB-INF/lib/

7、在tomcat solr下创建classpath,并把example/resources/log4j.properties复制到classpath中:

[root@svn-server tmp]mkdir -p /opt/tomcat/webapps/solr/classpath

[root@svnserver tmp]cp/opt/solr/example/resources/log4j.properties /opt/tomcat/webapps/solr/classpath/

8、配置完成重启tomcat

/usr/local/tomcat/bin/shutdown.sh

/usr/local/tomcat/bin/startup.sh

9、浏览器输入http://192.168.1.196:8080/solr/进入solr admin画面

四、简单的安装完毕!

五、安装分词工具:IK Analyzer 2012FF_hf1

1)把下载好的IKAnalyzer2012FF_u1.jar 上传到/opt/tomcat/webapps/solr/WEB-INF/lib

[root@localhost lib]# pwd

/opt/tomcat/webapps/solr/WEB-INF/lib

2)设置IKAnalyzer中文分词

修改/opt/solr/example/solr/collection1/conf 中的schema.xml,在<type></types>中增加如下                内容:

<!-- IKAnalyzer 中文分词 -->

<fieldType name="text" class="solr.TextField">

<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer">

</analyzer>

</fieldType>

六、接下来重启tomcat 即可:

[root@localhost yuanxiaoku]# /usr/local/tomcat/bin/shutdown.sh

[root@localhost yuanxiaoku]# /usr/local/tomcat/bin/start.sh

以上内容亲自测试N遍 !没有一点问题的哦!!!!欢迎大家评论

七、公司需求新建Core :

点击Add Core 名称命名完毕后会报错的

这个问题找了好久的原因 ,通过日志分析,可能是找不要源路径,路径匹配不对,该如何解决呢,版主有如下思路即可解决此问题:

[root@localhost solr]# pwd

/opt/solr/example/solr

看到以上的路径在solr下 将 collection1 目录里的文件copy 到你新建的Core 里(注:不需要拷贝data目录)

我以我的yuanxiaoku 为例:

[root@localhost solr]# ll

total 24

drwxr-xr-x. 2 root root 4096 Feb 18  2014 bin

drwxr-xr-x. 4 root root 4096 Nov  8 10:55 collection1

-rw-r--r--. 1 root root 2473 Feb 18  2014 README.txt

-rw-r--r--. 1 root root 1715 Feb 18  2014 solr.xml

drwxr-xr-x. 2 root root 4096 Nov  8 13:28 yuanxiaoku

-rw-r--r--. 1 root root  501 Feb 18  2014 zoo.cfg

[root@localhost solr]# cd collection1/

[root@localhost collection1]# ll

total 16

drwxr-xr-x. 6 root root 4096 Nov  8 10:49 conf

-rw-r--r--. 1 root root   16 Feb 18  2014 core.properties

drwxr-xr-x. 4 root root 4096 Nov  8 10:55 data

-rw-r--r--. 1 root root 2146 Feb 18  2014 README.txt

[root@localhost collection1]# cp -r conf ../yuanxiaoku/

[root@localhost collection1]#

[root@localhost collection1]#

[root@localhost collection1]# cp -r README.txt ../yuanxiaoku/

将conf 和 README.txt 拷贝到 yuanxiaoku 目录下即可;

[root@localhost solr]# cd yuanxiaoku/

[root@localhost yuanxiaoku]# ll

total 24

drwxr-xr-x. 6 root root 4096 Nov  8 13:31 conf

-rw-r--r--. 1 root root  133 Nov  8 11:00 core.properties

drwxr-xr-x. 4 root root 4096 Nov  8 13:33 data

-rw-r--r--. 1 root root 2146 Nov  8 13:32 README.txt

-rw-------. 1 root root 6447 Nov  8 10:51 server.xml

看到以上的结果,我们就可以重启tomcat 了!!激动人心的时刻到了

[root@localhost yuanxiaoku]# /usr/local/tomcat/bin/shutdown.sh

[root@localhost yuanxiaoku]# /usr/local/tomcat/bin/start.sh

现在通过访问:http://192.168.250.105:8080/solr/

看到yuanxiaoku 的Core 已经可以正常调用数据库了!到了现在说明我们所做的已经成功了!

备注:大家一定要注意防火墙!!!添加默认允许端口就可以,或者是内网直接关闭防火墙即可

[root@solr-server ~]# service iptables stop

转载于:https://blog.51cto.com/cgc243652136qq/1743470

Centos下部署Solr 搜索引擎相关推荐

  1. Centos下部署NTP时间服务器同步环境

    Centos下部署NTP时间服务器同步环境记录 我是在购买的3A平台购买的服务器进行测试. 服务端部署 安装所需软件包 [root@test ~]# yum -y install ntp ntpdat ...

  2. ubuntu下部署solr

    ubuntu下部署solr IKAnalyzer linliangyi2007.javaeye.com http://code.google.com/p/ik-analyzer reference: ...

  3. CentOS下部署web2py服务器

    本文的应用场景是要在centos下部署一个web2py服务器. 笔者的环境是Windows7 +VMare10 +CentOS v7 +SSH,全部是64位. 以可以从主机的浏览器访问到服务器的服务作 ...

  4. Mac下搭建solr搜索引擎与PHP扩展开发(上)

    首先需要安装jdk,前往 https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html 自 ...

  5. 《Centos下部署ThinkPHP》

    Centos 7服务器版下部署ThinkPHP 部署条件 : 1,首先要安装Centos 7服务器版,我的博客中有如何安装,希望对大家有帮助:http://blog.csdn.net/self_rea ...

  6. 1.跟我学solr---在tomcat下部署solr

    准备工作:tomcat : apache-tomcat-7.0.47 solr : solr-4.6.0 1.把下载的solr包解压后,拷贝dist目录下的solr-4.6.0.war到tomcat ...

  7. centos下部署NTP时间服务器同步环境记录

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 ...

  8. CentOS下部署Hadoop高性能集群

    目录: •Hadoop 概述 •实战1:部署Hadoop高性能集群 Hadoop是什么 Hadoop是Lucene创始人Doug Cutting,根据Google的相关内容山寨出来的分布式文件系统和对 ...

  9. CAS - CentOS下部署CAS服务器及简单使用

    下载CAS并打成War包:https://github.com/apereo/cas-overlay-template 然后在服务器上安装Tomcat,如果运行多个Tomcat,需要修改Tomcat配 ...

最新文章

  1. SpringCloud 微服务架构,适合接私活(附源码)
  2. 原创 | 从智慧交通、智慧安防、智能电网三大应用场景看我国智慧城市建设现状...
  3. rn项目 假如cocoapods_在项目中集成 RN
  4. 字典-字典的增删改查常用操作
  5. 操作系统(13)-操作系统中的死锁及其预防、避免、检测与解除
  6. 服务器用户设置备份,用户配置文件状态变成“备份”
  7. 新款iPhone SE预购好于预期,新款iPhone SE Plus可能要因此延迟了
  8. osg+ActiveQT嵌入ie64位
  9. Huber Loss function
  10. jsp购物车(session版)
  11. signature=c31ee9b23a444aeb59534b250024e5ac,Assembling unit for tube components
  12. 伪原创内容来源的八个渠道
  13. execute immediate
  14. 【字符集五】c++标准库<locale>
  15. 启动日志中出现The APR based Apache Tomcat Native library which allows optimal performance in production env
  16. 固态电容和电解电容性能比较
  17. python画钢铁侠标志_pyecharts绘制复联超级英雄战斗力
  18. TcaplusDB君 · 行业新闻汇编(11月04号)
  19. windows环境安装lzo和python-lzo
  20. 【软考备战·希赛网每日一练】2023年5月12日

热门文章

  1. Linux下模拟RAID5实现磁盘损坏,数据自动切换到备份磁盘上
  2. 03-Java的基础语法
  3. EXP6 信息搜集与漏洞扫描
  4. 36.intellij idea 如何一键清除所有断点
  5. 苹果应用商店逾千款iOS应用存安全漏洞
  6. python: how to delete a given item if it exist in the list
  7. 【Unity】使用Resources类管理资源
  8. jquery插件-表单验证插件-提示信息中文化与定制提示信息
  9. socks5   代理
  10. Utilize Sql Tuning Advisor from Script