Install SolrCloud under CentOS7

 

Build solrCloud--pseudo-distributed IP address: 192.168.25.154

         1. At least three zookeeper nodes are required

         2. Four tomcat nodes are required

        Schematic:

        Build a zookeeper cluster

        Step 1: You need to install the jdk environment.
        Step 2: Upload the compressed package of zookeeper to the server.
        Step 3: Unzip.
        Step 4: Copy zookeeper three times.
        [root @localhost ~]# mkdir /usr/local/solr-cloud
        [root @localhost ~]# cp -r zookeeper-3.4.6 /usr/local/solr-cloud/zookeeper01
        [root @localhost ~]# cp - r zookeeper-3.4.6 /usr/local/solr-cloud/zookeeper02
        [root @localhost ~]# cp -r zookeeper-3.4.6 /usr/local/solr-cloud/zookeeper03
        Step 5: In each zookeeper directory Create a data directory under.
        Step 6: Create a myid file in the data directory, the file name is called "myid". The content is the id of each instance. eg 1, 2, 3
        [root @localhost data]# echo 1 >> myid (or use vim)
        Step 7: Modify the configuration file. Rename the zoo_sample.cfg file in the conf directory to zoo.cfg

        

        Step 8: Start each zookeeper instance.
        Start bin/zkServer.sh start

        Check the status of zookeeper:
        bin/zkServer.sh status

        Note: After all zookeepers are started, the node status will not be displayed until the leader is elected

        The construction of the stand-alone version of solr

        Solr is developed in java.
        jdk needs to be installed.
        Installation environment Linux.
        Tomcat needs to be installed.

        step:

        Step 1: Upload the solr compressed package to the Linux system
        Step 2: Unzip solr.

            contrib:solr extension package

            docs: solr documentation

            dist: destination file save directory

            Example: Solr example
        Step 3: Install Tomcat and unzip it.
        Step 4: Deploy solr to Tomcat. Copy the solr.war in the dist directory to the
        webAPP : Unzip the war package. Start Tomcat and extract it. Copy tomcat to the /usr/local/solr directory
        Step 6: Add all the jar packages in the /root/solr-4.10.3/example/lib/ext directory to the solr project.
        [root@localhost ext]# pwd
        /root/solr-4.10.3/example/lib/ext
        [root@localhost ext]# cp * /usr/local/solr/tomcat/webapps/solr/WEB-INF/lib/
        Step 7: Create a solrhome. The /example/solr directory is a solrhome. Copy this directory to
        /usr/local/solr/solrhome
        [root@localhost example]# pwd
        /root/solr-4.10.3/example
        [root@localhost example]# cp -r solr /usr/local/solr/solrhome
        Step 8: Associate solr and solrhome. The web.xml file of the solr project needs to be modified.


        Step 9: Start Tomcat
http://192.168.25.154:8080/solr/

        Build a Solr cluster

        Step 1: Create four tomcat instances. Each tomcat runs on a different port. 8180 , 8280, 8380, 8480 The
        second step: deploy the war package of solr. Copy the stand-alone version of the solr project to the tomcat in the cluster.
        Step 3: Create a corresponding solrhome for each solr instance. Use the stand-alone version of solrhome to make four copies.
        Step 4: You need to modify the web.xml file of solr. Associate solrhome.
        Step 5: Configure solrCloud related configuration. There is a solr.xml under each solrhome, and configure the ip and port number in it.


      Step 6: Let zookeeper manage the configuration files uniformly. You need to upload the solrhome/collection1/conf directory to zookeeper. Upload any configuration file in solrhome.

     Upload the configuration file using the tool: /root/solr-4.10.3/example/scripts/cloud-scripts/zkcli.sh

./zkcli.sh -zkhost 192.168.25.154:2181,192.168.25.154:2182,192.168.25.154:2183 -cmd upconfig -confdir /usr/local/solr-cloud/solrhome01/collection1/conf -confname myconf

        View the configuration file on zookeeper:
        Use the bin/zkCli.sh command in the zookeeper directory to view the configuration file on zookeeper:
        [root@localhost bin]# ./zkCli.sh 
        [zk: localhost:2181(CONNECTED) 0] ls /
        [configs, zookeeper]
        [zk: localhost:2181(CONNECTED) 1] ls /configs
        [myconf]
        [zk: localhost:2181(CONNECTED) 2] ls /configs/myconf
 [admin-extra.menu-top.html, currency.xml, protwords.txt, mapping-FoldToASCII.txt, _schema_analysis_synonyms_english.json, _rest_managed.json, solrconfig.xml, _schema_analysis_stopwords_english.json, stopwords.txt, lang, spellings.txt, mapping-ISOLatin1Accent.txt, admin-extra.html, xslt, synonyms.txt, scripts.conf, update-script.js, velocity, elevate.xml, admin-extra.menu-bottom.html, clustering, schema.xml]
[zk: localhost:2181(CONNECTED) 3] 
退出:
[zk: localhost:2181(CONNECTED) 3] quit


Use the following command to connect to the specified zookeeper service:
./zkCli.sh -server 192.168.25.154:2183

      Step 7: Modify the catalina.sh file in the tomcat/bin directory to associate solr and zookeeper.
      Add this configuration to the configuration file:
        JAVA_OPTS="-DzkHost=192.168.25.154:2181,192.168.25.154:2182,192.168.25.154:2183"

        

        Step 8: Start each tomcat instance. To wrap the zookeeper cluster is the startup state.
        Step 9: Access the cluster

        

        Step 10: Create a new Collection for fragmentation processing.

http://192.168.25.154:8180/solr/admin/collectionsaction=CREATE&name=collection2&numShards=2&replicationFactor=2
 


 
        Step 11: Delete unused Collections.
http://192.168.25.154:8180/solr/admin/collections?action=DELETE&name=collection1

 

The above are the steps to build SolrCloud, please correct them!
 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325059945&siteId=291194637