设为首页 收藏本站
查看: 1090|回复: 0

[经验分享] 基于apache lucene的solr站内搜索引擎搭配手记之2

[复制链接]

尚未签到

发表于 2015-7-17 13:22:33 | 显示全部楼层 |阅读模式
[table][tr][/tr][tr][td]
[/td][td]

        基于apache lucene的solr站内搜索引擎搭配手记之2
   [ 预备警员.10078 @ 2009-03-23 17:16:37 ]

2.2.2
为solr找个home目录,如果将solr作为web一个子目录,我自己觉得不妥,于是就创建了一个solr的home目录:

shell>mkdir -p /opt/bin/solr
shell>mkdir -p /opt/webroot/solr

通过对get started的阅读,我发现solr不单单是做一个页面供查询就可以了, 后续的会有搜索数据的存储维护和管理,所以在这里,单独成项就是为了相对独立于WEB Server一些, 如果不做这个,在下面的配置中,将solr.home的默认将是 webserver_home/webapp/solr .

第二个目录是,solr以后扩展用的,也是为了通过 http://www.example.com/solr/能够访问到而做的。

有了这个目录之后,参考(http://wiki.apache.org/solr/SolrInstall):

Setup
?Stop your servlet container

?From the solr distribution, copy the solr war to the webapps directory of your servlet container as solr.war

?From the solr distribution, copy the example solr home example/solr as a template for your solr home.

?Start the servlet container, passing the location of your solr home. This may be done in a number of ways:

?Set the java system property solr.solr.home to your solr home.

?Configure the servlet container such that a JNDI lookup of "java:comp/env/solr/home" by the solr webapp will point to the solr home.

?The default solr home is "solr" under the JVM's current working directory ($CWD/solr), so start the servlet container in the directory containing ./solr

?Go to the solr admin page to verify that the installation is working. It will be at  http://localhost:8080/solr/admin

?The servlet container may have started on a port other than 8080... check the servlet containers documentation if you don't know what this is.

?If there is already a servlet container running at that port, yours may fail to start. Shut down the other one or change the port that yours is running at.

For information on working with more then one index, or more then one instance of Solr, please see MultipleIndexes.


我的webapp的目录是 /opt/bin/resin-2.1/webapps
我的做法是:

shell>cp /opt/src/apache-solr-1.3.0/example/webapps/solr.war /opt/bin/resin-2.1/webapps/

有了这步之后,resin一般会自动重启(如果没自动restart,手工restart一下),resin会展开 solr.war, 并在启动时加载,这些都是自动的,顺便了解了一下 war -- In computing, a WAR file (which stands for "web application archive" [1]) is a JAR file used to distribute a collection of JavaServer Pages, servlets, Java classes, XML files, tag libraries and static Web pages (HTML and related files) that together constitute a Web application. (http://en.wikipedia.org/wiki/WAR_file)

等resin重启后,会在resin的 webapps子目录的上一级,也就是与webapps 同级的目录,生成一个叫做 solr的子目录,oka,此时,将resin下的整个 solr子目录mv到 之前专门为 solr做的目录下 /opt/bin/solr

shell> mv /opt/bin/resin/solr/* /opt/webroot/solr
shell> mv /opt/bin/resin/webapps/solr.war /opt/webroot/solr/
shell> cp -rf /opt/src/apache-solr-1.3.0/example/solr/* /opt/bin/solr

后一步骤是将solr.war也从resin/webapps 移出,免得再自动展开。经过这个操作,solr就没了,resin不知道去哪里加载它。 此时开始做第三步:

2.2.3
修改solr, web appserver的配置文件,让它能找到 solr并随resin一起动。

2.2.3.1
需要在 /opt/bin/resin-2.1/conf/resin.conf 中增加:

         
                 /opt/webroot/solr
                 none
                 
                 
                         solr/home
                         java.lang.String
                         /opt/bin/solr
                 
                 
                  
                         /update/*

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-87703-1-1.html 上篇帖子: Solr在Tomcat中的部署 下篇帖子: Apache Solr配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表