Solr tomcat setup

In the production env, we need to create sponge account to do below steps.
for now, just use solr as example.
Server is SOLRMASTER

1. Install JDK or JRE(1.6)

2. Download the Solr and tomcat binary.
You can get it from here.
[solr@SOLRMASTER ~]$ pwd
/home/solr
[solr@SOLRMASTER ~]$ ls -lrt
total 91372
-rw-r--r-- 1 root root 1261 Apr 23 11:05 id_dsa_2048_a.pub
-rw-r--r-- 1 solr clouduser 86744700 May 11 01:02 apache-solr-3.6.0.tgz
-rw-r--r-- 1 solr clouduser 6697806 May 21 23:31 apache-tomcat-6.0.35.tar.gz

3. untar the tomcat and solr and rename tomcat
[solr@vm-c179-e1f7 ~]$tar -xvf apache-solr-3.6.0.tgz
[solr@vm-c179-e1f7 ~]$tar -xvf apache-tomcat-6.0.35.tar.gz
[solr@vm-c179-e1f7 ~]$mv apache-tomcat-6.0.35 tomcat

~/tomcat -- this is $CATALINA_HOME

4 create solr related dirs
$cd ~
$mkdir -p ~/sponge/solr -- this is $SOLR_HOME
$mkdir -p ~/sponge/solrData -- this is for solr index data

5 copy the Solr example/solr to ~/sponge/solr
[solr@vm-c179-e1f7 example]$ pwd
/home/solr/apache-solr-3.6.0/example
[solr@vm-c179-e1f7 example]$ cp -r ./solr ~/sponge/


6 change the index data dir for solr, the file is $SOLR_HOME/conf/solrconfig.xml
<dataDir>${solr.data.dir:/home/solr/sponge/solrData}</dataDir>

7 copy the solr war to the solr home
[solr@vm-c179-e1f7 dist]$ pwd
/home/solr/apache-solr-3.6.0/dist
[solr@vm-c179-e1f7 dist]$ cp ./apache-solr-3.6.0.war ~/sponge/solr/solr.war

8 Create a Tomcat Context fragment to point docBase to the $SOLR_HOME/solr.war file and solr/home to $SOLR_HOME:
<?xml version="1.0" encoding="utf-8"?>
<Context docBase="/home/solr/sponge/solr/solr.war" debug="0" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/home/solr/sponge/solr" override="true"/>
</Context>
place the file in $CATALINA_HOME/conf/Catalina/localhost/solr.xml

9 URI Charset Config $CATALINA_HOME/conf/server.xml
<Server ...>
<Service ...>
<Connector ... URIEncoding="UTF-8"/>
...
</Service>
</Server>

10 start tomcat server
$cd $CATALINA_HOME/bin
$export JAVA_OPTS="$JAVA_OPTS -Xms512M -Xmx1024M -Dfile.encoding=UTF8"
$./startup.sh

11 To use the indexing examples in the Solr Tutorial, use the -Durl parameter, e.g.
$cd ~/apache-solr-3.6.0/example/exampledocs
$java -jar -Durl=http://localhost:8080/solr/update post.jar solr.xml monitor.xml

12 check whether the index is built into solr.
http://SOLRMASTER:8080/solr/select/?q=id:SOLR1000
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值