Solr+tomcat
一、安装tomcat:
(1)、安装jdk:
http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u3-download-1501626.html
[root@localhost java]# mkdir -p /usr/java
[root@localhost java]# tar zxvf jdk-7u3-linux-x64.tar.gz -C /usr/java/
[root@localhost java]# vi /etc/profile
JAVA_HOME="/usr/java/jdk1.7.0_03"
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
Export ………JAVA_HOME CLASSPATH
[root@localhost java]# source /etc/profile
[root@localhost java]# java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)
一、
安装tomcat、solr:
Tomcat
下载:
http://tomcat.apache.org/
Solr
下载:
http://apache.etoak.com//lucene/solr/
(1)安装配置SOLR:
[root@nagios home]# unzip apache-solr-3.5.0.zip
[root@nagios home]# mkdir -p /usr/local/solr_all/
[root@nagios home]# mv apache-solr-3.5.0 /usr/local/solr_all/3c_solr
[root@nagios home]# mv apache-solr-3.5.0 /usr/local/solr_all/tc_solr
[root@nagios home]# cd /usr/local/solr_all/3c_solr/
[root@nagios 3c_solr]# ls
CHANGES.txt client contrib dist docs example LICENSE.txt NOTICE.txt README.txt
[root@nagios 3c_solr]# cd example/
[root@nagios example]# mv ./webapps/solr.war ./solr/
[root@nagios example]# mv ./solr/ ../
[root@nagios 3c_solr]# ls
CHANGES.txt client contrib dist docs example LICENSE.txt NOTICE.txt README.txt solr
(2)安装配置tomcat(单独):
# tar zxvf apache-tomcat-7.0.26.tar.gz -C /usr/local/
# cd /usr/local/
# mkdir -p /usr/local/tomcat_all
# mv apache-tomcat-7.0.26 /usr/local/tomcat_all/
# mv apache-tomcat-7.0.26 tomcat
# mkdir –p /usr/local/tomcat_all/3c
# mkdir –p /usr/local/tomcat_all/tc
# cd /usr/local/tomcat_all/tomcat
[root@nagios tomcat]# cp -r conf logs temp ../3c/
[root@nagios 3c]# vi ./conf/server.xml
maxThreads="500" minSpareThreads="50" maxSpareThreads="100"
enableLookups="false" redirectPort="9440" acceptCount="100"
connectionTimeout="200" disableUploadTimeout="true" URIEncoding="UTF-8" />
protocol="HTTP/1.1" enableLookups="false" redirectPort="9440" />
unpackWARs="true" autoDeploy="true"
xmlValidatio="falsh" xmlNamespaceAware="falsh">
[root@nagios 3c]# mkdir ./conf/Catalina/localhost
[root@nagios 3c]# cd ./conf/Catalina/localhost/
[root@nagios localhost]# vi solr.xml
[root@nagios localhost]# cd /usr/local/tomcat_all/tomcat/bin/
[root@nagios bin]# vi start_3c.sh
export CATALINA_HOME=/usr/local/tomcat_all/tomcat
export CATALINA_BASE=/usr/local/tomcat_all/3c
$CATALINA_HOME/bin/startup.sh -D catalina.sh
[root@nagios bin]# vi stop_3c.sh
export CATALINA_HOME=/usr/local/tomcat_all/tomcat
export CATALINA_BASE=/usr/local/tomcat_all/3c
$CATALINA_HOME/bin/shutdown.sh -D catalina.sh
[root@localhost tomcat]# vi ./bin/catalina.sh
---------------------
JAVA_OPTS="-Xms3072m -Xmx3072m -Xss1024K -XX:PermSize=128m -XX:MaxPermSize=512m"
# OS specific support. $var _must_ be set to either true or false.
统一tomcat配置:
[root@localhost tomcat]# vi ./conf/server.xml
maxThreads="500" minSpareThreads="50" maxSpareThreads="100"
enableLookups="false" redirectPort="9443" acceptCount="100"
connectionTimeout="200" disableUploadTimeout="true" URIEncoding="UTF-8" />
protocol="HTTP/1.1" enableLookups="false" redirectPort="9443" />
unpackWARs="true" autoDeploy="true"
xmlValidatio="falsh" xmlNamespaceAware="falsh">
maxThreads="500" minSpareThreads="50" maxSpareThreads="100"
enableLookups="false" redirectPort="9445" acceptCount="100"
connectionTimeout="200" disableUploadTimeout="true" URIEncoding="UTF-8"/>
protocol="HTTP/1.1" enableLookups="false" redirectPort="9445" />
unpackWARs="true" autoDeploy="true"
xmlValidatio="falsh" xmlNamespaceAware="falsh">
maxThreads="500" minSpareThreads="50" maxSpareThreads="100"
enableLookups="false" redirectPort="9444" acceptCount="100"
connectionTimeout="200" disableUploadTimeout="true" URIEncoding="UTF-8" />
protocol="HTTP/1.1" enableLookups="false" redirectPort="9444" />
unpackWARs="true" autoDeploy="true"
xmlValidatio="falsh" xmlNamespaceAware="falsh">
maxThreads="500" minSpareThreads="50" maxSpareThreads="100"
enableLookups="false" redirectPort="9447" acceptCount="100"
connectionTimeout="200" disableUploadTimeout="true" URIEncoding="UTF-8"/>
protocol="HTTP/1.1" enableLookups="false" redirectPort="9447" />
unpackWARs="true" autoDeploy="true"
xmlValidatio="falsh" xmlNamespaceAware="falsh">
maxThreads="500" minSpareThreads="50" maxSpareThreads="100"
enableLookups="false" redirectPort="9446" acceptCount="100"
connectionTimeout="200" disableUploadTimeout="true" URIEncoding="UTF-8"/>
protocol="HTTP/1.1" enableLookups="false" redirectPort="9446" />
unpackWARs="true" autoDeploy="true"
xmlValidatio="falsh" xmlNamespaceAware="falsh">
maxThreads="500" minSpareThreads="50" maxSpareThreads="100"
enableLookups="false" redirectPort="9448" acceptCount="100"
connectionTimeout="200" disableUploadTimeout="true" URIEncoding="UTF-8"/>
protocol="HTTP/1.1" enableLookups="false" redirectPort="9448" />
unpackWARs="true" autoDeploy="true"
xmlValidatio="falsh" xmlNamespaceAware="falsh">
maxThreads="500" minSpareThreads="50" maxSpareThreads="100"
enableLookups="false" redirectPort="9449" acceptCount="100"
connectionTimeout="200" disableUploadTimeout="true" URIEncoding="UTF-8"/>
protocol="HTTP/1.1" enableLookups="false" redirectPort="9449" />
unpackWARs="true" autoDeploy="true"
xmlValidatio="falsh" xmlNamespaceAware="falsh">
[root@localhost tomcat]# cd conf/
[root@localhost conf]# ls
3c
Catalina clothing logging.properties techan
baike
catalina.policy context.xml muying tomcat-users.xml
beauty catalina.properties jiaju
server.xml web.xml
[root@localhost conf]# vi ./3c/localhost/solr.xml
[root@localhost tomcat]# ./bin/startup.sh
[root@localhost tomcat]# ./bin/shutdown.sh
如果报错:
http://wiki.apache.org/solr/SolrTomcat (官网错误)
[root@nagios 3c_solr]# vi /usr/local/solr_all/3c_solr/solr/conf/solrconfig.xml
将
${solr.velocity.enabled:true}"/修改为${solr.velocity.enabled:false}"/