TagCloud

Friday, January 4, 2013

solr install and configuration with tomcat

solr 4.0 install and configuration with tomcat ( CentOS 6.3 x64 )


1. solr 4.0 download , tar
wget  http://apache.mirror.cdnetworks.com/lucene/solr/4.0.0/apache-solr-4.0.0.tgz
tar -xvzf apache-solr-4.0.0.tgz
cp -Rf /srv/src/apache-solr-4.0.0/example/solr /srv # copy solr home
mkdir /srv/solr/data # solr(lunene) index dataDir


2. configure solr.xml
vi /srv/solr/solr.xml

  <cores adminPath="/admin/cores" defaultCoreName="luvu" host="${host:}" hostPort="${jetty.port:}" hostContext="${hostContext:}" zkClientTimeout="${zkClientTimeout:15000}">
    <core name="luvu" instanceDir="core/luvu" />
  </cores>

mv /srv/solr/collection1 /srv/solr/core/luvu # core collection directory
3. solrconfig.xml configuration
vi /srv/solr/core/luvu/conf/solrconfig.xml

${solr.data.dir:/srv/solr/data/luvu/} # solr(lucene) data directory

4. schema.xml configuration
vi /srv/solr/core/luvu/conf/schema.xml

<schema name="luvu" version="1.5"> # schema name , 이하 설정은 필요에 따라 작성하며 한글 형태소분석기 등도 여기에서 설정해야함
# 불필요할 경우 solrconfig.xml에서 아래의 예제 requestHandler 삭제  
<--requestHandler name="/browse" class="solr.SearchHandler">


5. copy solr webapp to tomcat
cp /srv/src/apache-solr-4.0.0/dist/apache-solr-4.0.0.war /srv/tomcat/webapps/solr.war



6. context.xml configuration tomcat
vi /srv/tomcat/conf/Catalina/localhost/solr.xml 
<Environment name="solr/home" type="java.lang.String" value="/srv/solr" override="true"/> 

7. tomcat URI Charset cofig
vi /srv/tomcat/conf/server.xml # add URIEncoding="UTF-8"
<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" 
                URIEncoding="UTF-8" />


8. check solr
http://solr01:8080/solr/




















Reference :
http://wiki.apache.org/solr/SolrTomcat
http://wiki.apache.org/solr/SolrResin