SOLR cluster environment setup
A. Prepare
1. Download:
solr-4.4.0.zip SOLR installation package
apache-tomcat-7.0.47.tar.gz Tomcat installation package
2. Description:
Where the cluster environment using nginx for distribution (also can use Apache),nginx installation is no longer introduced here. We have a total of four machines, respectively, as follows
10.10.42.164
10.10.42.165
10.10.42.166
10.10.42.167
where 10.10.42.164 as the main node installation nginx,SOLR Master node, the remaining three installed SOLR slave node.
two. Installation
1. Tomcat Installation
CP apache-tomcat-7.0.47.tar.gz/opt
Cd/opt
TAR-ZXVF apache-tomcat-7.0.47.tar.gz
MV apache-tomcat-7.0.57 Tomcat
Start Tomcat
Opt/tomcat /bin/startup.sh
Visit http://127.0.0.1:8080to see Tomcat 's launch welcome page to prove that Tomcat is configured correctly
(1) Start the Tomcat service:
#/opt/tomcat/bin/startup.sh
#/opt/tomcat/bin/catalina.sh Start
(2) Close the Tomcat service:
#/opt/tomcat/bin/shutdown.sh
#/opt/tomcat/bin/catalina.sh stop
2. SOLR Installation
1. Unzip the SOLR and, under solr-4.4.0 \example\webapps , have a solr.war copy it to Tomcat/webapps directory, remember not to change the name of the War package
2. Add the slf4j,commons-loggin.jar to the apache-tomcat-7.0.42\webapps\solr\web-inf\lib . The 2 jar packages are missing from Solr 's own war package
3. Configure Solr.home. add such a section to Web. XML below apache-tomcat-7.0.42\webapps\solr\web-inf
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/opt/solr/home</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
Change the E:\solr_home to your own directory, and then copy the solr-4.4.0 \EXAMPLE\SOLR to your ${solr_home}
4. do the same for all nodes.
5. Modify the ${solr_home}/solr/conf/solrconfig.xml of the master node (10.10.42.164)
<requesthandler name= "/replication" class= "SOLR. Replicationhandler ">
<lst name= "Master" >
<str name= "Replicateafter" >commit</str>
<str name= "Replicateafter" >startup</str>
<str name= "Conffiles" >schema.xml,stopwords.txt</str>
</lst>
<str name= "Maxnumberofbackups" >3</str>
</requestHandler>
6. Modify the slave node
<requesthandler name= "/replication" class= "SOLR. Replicationhandler ">
<str name= "Maxnumberofbackups" >8</str>
<lst name= "Slave" >
<str name= "MasterUrl" >http://10.10.42.164:8080/solrmaster/replication</str>
<str name= "PollInterval" >00:00:60</str>
</lst>
</requestHandler>
three. Configure Nginx
Modify nginx_home/nginx.conf
Add the following content
Upstream mango_solr{
Ip_hash;
Server 10.10.42.165:8080 max_fails=2 fail_timeout=5s;
Server 10.10.42.166:8080 max_fails=2 fail_timeout=5s;
Server 10.10.42.167:8080 max_fails=2 fail_timeout=5s;
}
location/solr{
Proxy_pass HTTP://MANGO_SOLR;
}
Four. Access Address
Five Master node:
http://10.10.42.164:8080/solrMaster/
From node (nginx distribution):
http://10.10.42.164/solr/
From node:
http://10.10.42.165:8080/solr/
http://10.10.42.166:8080/solr/
http://10.10.42.167:8080/solr/
Index Creation Address:
http://10.10.42.164:8080/hotelSolr/
SOLR Cluster Environment Setup