Linux configuration Tomcat7 + solr4.9 (cont.)---Multi-core index configuration

Source: Internet
Author: User
Tags solr server port tomcat server

In the previous article (see http://www.cnblogs.com/bxljoy/p/3850263.html), we have described the configuration of the TOMCAT+SOLR Index Server, but the server created in this article can only support storing a single index, in many cases , we need to create indexes on multiple tables or groups of different data, and if there is no need to create an index library, it is obviously not advantageous to deploy a suite of SOLR services, so this article introduces the advanced application of SOLR and configures the multi-core index on the same server.

Go to our extracted Solr file directory:

cd/home/hadoop2/solr/example/multicorelscore0  core1  exampledocs  README.txt  solr.xml  zoo.cfg

Copy everything under this folder to the home directory of our SOLR server as follows:

CP -R  *  /home/hadoop2/solrhomelsbin  collection1  Controller  CORE0  core1  logs  README.txt  solrindex  solr.xml  zoo.cfg

The contents of the Solr.xml configuration file are as follows:

&LT;SOLR persistent="false"> <!--Adminpath:requesthandler path to manage cores. If'NULL'(or absent), cores'll is not being manageable via request handler-<cores adminpath="/admin/cores"host="${host:}"hostport="6688"hostcontext="${HOSTCONTEXT:SOLR}"> <core name="core0"Instancedir="core0"/> <core name="Core1"Instancedir="Core1"/>
<core name= "Controller" instancedir= "Controller"/>
<shardhandlerfactory name="shardhandlerfactory " class= " Httpshardhandlerfactory"> <str name="urlscheme">${urlscheme:} </str> </shardHandlerFactory> </cores> </solr>

Where the Scarlet Letter section needs to be noted: The port needs to be changed to match the Tomcat server port of its own configuration, this article is 6688, and the following Red character core property is a custom index folder, in the Solrhome directory corresponding to CORE0, Core1 and controller index folders, which contain configuration files and index data files:

ls /home/hadoop2/solrhome/controller/conflogs  schema.xml  solrconfig.xmlls / home/hadoop2/solrhome/core0/conflogs  schema.xml  solrconfig.xmlls /home/hadoop2/ solrhome/core1/conflogs  schema.xml  solrconfig.xml

There is no need to modify solrconfig.xml, as long as you modify Schema.xml:

<schema name="Example Core Zero"version="1.1"> <fieldtype name="string"class="SOLR. Strfield"sortmissinglast="true"omitnorms="true"/> <fieldtype name="Long"class="SOLR. Trielongfield"precisionstep="0"positionincrementgap="0"/> <!--General--<field Name="ID"Type="string"Indexed="true"Stored="true"Multivalued="false"Required="true"/> <field name="type"Type="string"Indexed="true"Stored="true"Multivalued="false"/> <field name="name"Type="string"Indexed="true"Stored="true"Multivalued="false"/> <field name="core0"Type="string"Indexed="true"Stored="true"Multivalued="false"/> <field name="_version_"Type="Long"Indexed="true"Stored="true"/> <!--field to determine and enforce document uniqueness. -<uniqueKey>ID</uniqueKey> <!--Field forThe Queryparser to a explicit FieldName is absent--<defaultsearchfield>name</defaultsearchfield& Gt <!--Solrqueryparser configuration:defaultoperator="And|or"-<solrqueryparser defaultoperator="OR"/></schema>

The system default UniqueKey is the ID, if necessary, we can modify the UniqueKey, and add the index field we need to create, as follows:

<schema name="Example Core Zero"version="1.1"> <fieldtype name="string"class="SOLR. Strfield"sortmissinglast="true"omitnorms="true"/> <fieldtype name="Long"class="SOLR. Trielongfield"precisionstep="0"positionincrementgap="0"/> <!--General-<!--<field name= "id" type= "string" indexed= "true" stored= "true" multivalued= "false" required= "true" />--><field name="type"Type="string"Indexed="true"Stored="true"Multivalued="false"/> <field name="name"Type="string"Indexed="true"Stored="true"Multivalued="false"/> <field name="core0"Type="string"Indexed="true"Stored="true"Multivalued="false"/> <field name="_version_"Type="Long"Indexed="true"Stored="true"/> <!--field to determine and enforce document uniqueness. -<uniqueKey>rowkey</uniqueKey><field name="Rowkey"Type="string"Indexed="true"Stored="true"Multivalued="false"Required="true"/> <field name=" One"Type="string"Indexed="true"Stored="true"Multivalued="false"/> <field name=" Both"Type="string"Indexed="true"Stored="true"Multivalued="false"/> <field name="three"Type="string"Indexed="true"Stored="true"Multivalued="false"/><!--Field forThe Queryparser to a explicit FieldName is absent--<defaultsearchfield>name</defaultsearchfield& Gt <!--Solrqueryparser configuration:defaultoperator="And|or"-<solrqueryparser defaultoperator="OR"/></schema>

In the above configuration file, we will modify the UniqueKey to Rowkey and comment out the definition of the ID field, or modify the required property of the ID field to Fasle, and then we add the fields that need to be indexed.

Previously described in the configuration file modification, we need to do in Core0, Core1 and controller three folders, according to the need to establish three different indexes, configure different UniqueKey and index fields. Then reboot the Tomcat server to access the URL:HTTP://10.1.5.242:6688/SOLR of the corresponding SOLR server, and you will see the page:

Click on the Core admin option in the left menu bar to see the status page for multiple indexes, such as:

By clicking on the controller, CORE0, and core1 Middle menu bar, you can toggle the index status interface to view specific information about the index.

The multi-core index configuration steps for the SOLR server are as follows, and I'll cover basic operations such as creating, updating, and deleting indexes using SOLR's Java API.

Reprint Please specify source: http://www.cnblogs.com/bxljoy/p/3861003.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.