Installation solr7.2 under Solr Centos6.5

Stand-alone deployment configuration solr

1. solr-7.2.0 / server / solr-webapp webapp copied to the inside of the webapps tomcat, rename solr

 
 
cp -r solr-7.2.1/server/solr-webapp/webapp/ /data/soft/tomcat/webapps/
mv webapp/ solr

 
 
 

2. Copy solr-7.2.1 \ under server \ lib \ jar package and the lib directory under ext gmetric4j-1.0.7.jar, to jar package at the beginning of metrics copied to tomcat \ webapps \ solr project WEB-INF \ lib under

 
 
cd solr-7.2.1/server/lib/ext/
cp * /data/soft/tomcat/webapps/solr/WEB-INF/lib/
cp gmetric4j-1.0.7.jar metrics-* /data/soft/tomcat/webapps/solr/WEB-INF/lib/

 
 
 

3. Copy solr-7.2.0 \ solr file in the server folder to the other non-Chinese directory, rename solrhome, I build to the next / data / soft

 cd solr-7.2.1/server/
 cp -r solr /data/soft/solrhome
 

blob.png

4. Modify /data/soft/tomcat/webapps/solr/WEB-INF\web.xml, find the following code, the blue portion, / put / your / solr / home / here to your path of solrhome, I was / data / soft / solrhome path.

   vim /data/soft/tomcat/webapps/solr/WEB-INF/web.xml, remove the comments, and written into solrhome directory location:

 
 
<!--
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/put/your/solr/home/here</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
-->

 
 
 

As shown below:

 blob.png

5 .. copy solr7.2.1 \ server \ log4j.properties under the resources to / data / soft / tomcat / webapps / solr / WEB-INF \ classes, if no classes under WEB-INF file then create a classes folder

 
 
mkdir -p /data/soft/tomcat/webapps/solr/WEB-INF/classes
cp solr-7.2.1/server/resources/log4j.properties  /data/soft/tomcat/webapps/solr/WEB-INF/classes/

 
 
 

6. Start tomcat, access requires the full path, I was http://192.168.241.131:8080/solr/index.html#/

blob.png

 Look at the log, if the log has the following styles will be successful.

blob.png

 curl in the machine and found 403, it is estimated that page, too, as shown below.

blob.png

blob.png

 7. Note: If the 403 error occurs map, photo editing web.xml screenshot position, find the following code, which you can comment.

blob.png

 Add comments below:

blob.png

 Refresh your browser again, the page will appear the following figure.blob.png

Solr configuration of the core (core)
1. Click Core Admin, and then click Add Core this problem occurs after the end point, but it will automatically create a new-core directory.

blob.png

2.报错,提示缺少配置文件:Error CREATEing SolrCore 'new_core': Unable to create core [new_core] Caused by: Can't find resource 'solrconfig.xml' in classpath or '/data/soft/solrhome/new_core'

Solution: conf file copy server / solr / configsets / _default / folder to the solrhome / new_core folder

 
 
cp -r solr-7.2.1/server/solr/configsets/_default/conf  /data/soft/solrhome/new_core/

 
 
 

3. Click on Add Core, The Add success .

 

blob.png

 4, the configuration analyzer Chinese

1. Copy dist folder in the solr-dataimporthandler-7.2.0.jar
 
 
cp  solr-7.2.1/dist/solr-dataimporthandler-7.2.1.jar /data/soft/tomcat/webapps/solr/WEB-INF/lib/

 
 
 

2. Copy lucene-libs folder in the Chinese analyzer jar package

 
 
cp  solr-7.2.1/contrib//analysis-extras/lucene-libs/* /data/soft/tomcat/webapps/solr/WEB-INF/lib/

 
 
 
 
 
 vim solrhome/new_core/conf/managed-schema



<!-- ChineseAnalyzer -->
<fieldType name="text_ik" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="org.apache.lucene.analysis.cn.smart.HMMChineseTokenizerFactory"/> </analyzer> <analyzer type="query"> <tokenizer class="org.apache.lucene.analysis.cn.smart.HMMChineseTokenizerFactory"/> </analyzer> </fieldType>
 

As shown below:

blob.png

4. Custom Search Business Domain

 
 
<field name="item_title" type="text_ik" indexed="true" stored="true"/> <field name="item_sell_point" type="text_ik" indexed="true" stored="true"/> <field name="item_price" type="plong" indexed="true" stored="true"/> <field name="item_image" type="string" indexed="false" stored="true" /> <field name="item_category_name" type="string" indexed="true" stored="true" /> <field name="item_desc" type="text_ik" indexed="true" stored="false" /> <field name="item_keywords" type="text_ik" indexed="true" stored="false" multiValued="true"/> <copyField source="item_title" dest="item_keywords"/> <copyField source="item_sell_point" dest="item_keywords"/> <copyField source="item_category_name" dest="item_keywords"/> <copyField source="item_desc" dest="item_keywords"/>

 
 
 

As shown below:

blob.png

5. Restart tomcat, you can find custom fields have emerged

blob.png

6. Test segmentation effect

blob.png

 

 Reprinted from https://blog.51cto.com/12889016/2103167

Guess you like

Origin www.cnblogs.com/Transkai/p/11018775.html