The first is the zookeeper cluster structures:
1. New folder / usr / local / solrcloud
2. The decompressed zookeeper three copies of the above solrcloud folder zookeeper01, zookeeper02, zookeeper03
Creating a data / myid under 3.zookeeper01 directory, myid write 1 (02 write write 2,03 3)
4. Configuration zookeeper01-zookeeper03 port
The / usr / local / solr-cloud / zookeeper01 / conf inside zoo_sample.cfg copy zoo.cfg [and so on]
Modify the configuration file zoo.zfg [and so on]
Path: dataDir = / usr / local / Solr-Cloud / zookeeper01 / Data / [and so on]
Port: clientPort = 2181 [and so on]
Added at the end:
server.1=192.168.2.128:2881:3881
server.2=192.168.2.128:2882:3882
server.3=192.168.2.128:2883:3883
5. start, there is a bin / zkServer.sh start to start the service under zookeeper directory
Close, bin / STOP zkServer.sh
Check the service status: ./zkServer.sh Status
Then Solr Cluster Setup
1. Copy 4 to solrcloud tomcat folder , tomcat01-tomcat04 , modify its port. 8080-8083
2 : decompression solr-4.10.3.tar.gz compressed . Copied from the archive solr.war to each tomcat the webapp lower.
3 : Start tomcat extract the war package . The solr-4.10.3 directory example on the log-related directory jar package to solr project.
4 : In solrcloud (create yourself, there are three zookeeper, four Tomcat ) created in four solrhome . Modify each tomcat in the web.xml to specify the corresponding solrhome location.
E.g. vim tomcat04 / webapps / solr-4.10.3 / WEB-INF / web.xml
5 Let zookeeper integrated management configuration file. Need to solrhome / collection1 / conf directory to upload to ZooKeeper .
Upload any solrhome configuration file. ( Make sure zookeeper has been started)
cd /root/solr-4.10.3/example/scripts/cloud-scripts/zkcli.sh
Three zookeep server content to be the same, so had to have three myconf
./zkcli.sh -zkhost 192.168.2.128:2181,192.168.2.128:2182,192.168.2.128:2183 -cmd upconfig -confdir /usr/local/solrcloud/solrhome1/collection1/conf -confname myconf |
6. Check whether a successful upload, use zookeeper 's zkCli.sh , then ls / configs / myconf
7. To tell each tomcat zookeeper positions, in each tomcat 's bin of catalina.sh
Add the following location the JAVA_OPTS : [Note ip address and port number]
we /usr/local/solrcloud/tomcat04/bin/catalina.sh
# Uncomment the following line to make the umask available when using the
# org.apache.catalina.security.SecurityListener
#JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.security.SecurityListener.UMASK=`umask`"
JAVA_OPTS="-DzkHost=192.168.2.128:2181,192.168.2.128:2182,192.168.2.128:2183"
- Start all tomcat
- Access http://192.168.52.129:8081/solr/#/~cloud, to see whether all active [green], and there is a black [Leader]
- The default first on the go just to build a good collection index Library is one , that is, Three equipment ( 4 Ge solr server )
We then entered in a browser URL created a new index base address ( meet our project requirements .)
Create a new Collection fragmented process.
http://192.168.2.128:8080/solr/admin/collections?action=CREATE&name=collection2&numShards=2&replicationFactor=2
remove unused Collection .
http://192.168.25.111:8081/solr/admin/collections?action=DELETE&name=collection1
we first collection1 delete , and then add a new index library collection1.