solr7 Build
SOLR7 Build Download Decompression build Chinese word breaker database import in cloud mode start SOLR common commands
Download Decompression
wget http://archive.apache.org/dist/lucene/solr/7.2.1/solr-7.2.1.zip Build Chinese word breaker Locate the Lucene-analyzers-smartcn-7.2.1.jar and copy it to the WebApp Lib directory
[Root@localhost ~]# cd/usr/local/solr-7.2.1/contrib/analysis-extras/lucene-libs/
[root@localhost ~]# CP Lucene-analyzers-smartcn-7.2.1.jar/usr/local/solr-7.2.1/server/solr-webapp/webapp/web-inf/lib
Modify Managed-shchema
[Root@localhost ~]# cd/usr/local/solr-7.2.1/server/solr/configsets/_default/conf
At the end add the following configuration
<!--chineseanalyzer-->
<fieldtype name= "Solr_cnanalyzer" SOLR. TextField "positionincrementgap=" >
<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>
Database ImportBack up the _default folder
[Root@localhost solr-7.2.1]# cd/usr/local/solr-7.2.1/server/solr/configsets/
[root@localhost configsets]# CP- R _default _default-old
Modify _default/conf/solrconfig.xml
[Root@localhost configsets]# vim _default/conf/solrconfig.xml
added as follows:
<requesthandler name= "/dataimport" class= "Org.apache.solr.handler.dataimport.DataImportHandler" >
<lst name= "Defaults" >
<str Name= "config" >db-data-config.xml</str>
</lst>
</requestHandler>
Conf directory to create a db-data-config.xml file
<!--transformer format conversion: Htmlstriptransformer index ignores HTML tags---> <!--query: Query database tables conform to record data---> <!-- Deltaquery: Incremental index query primary key ID Note This only returns the ID field---> <!--deltaimportquery: Incremental index query imported data---> <!--deletedpkqu Ery: Incremental Index Delete primary Key ID query Note This only returns the ID field---> <dataConfig> <datasource driver= "Com.mysql.jdbc.Driver" url= jdbc:
Mysql://localhost:3306/taotao "user=" root "password=" "/> <document> <entity name=" Bless "
query= "select A.id,a.title,a.sell_point,a.price,a.image,b. ' Name ' Category_name,c.item_desc from Tb_item a Left join Tb_item_cat b on a.cid = b.ID left join Tb_item_desc c on a.id = c.item_id WHERE A. ' STA
Tus ' = 1 "deltaquery=" SELECT ID from Tb_item where created > ' ${dataimporter.last_index_time} ' "> <field column= "Item_title" name= "title"/> <field "column=" Item_sell_point "Name=" /> <fiEld column= "Item_price" name= "Price"/> <field "column=" item_image "image" name=
Eld column= "Item_price" name= "Price"/> <field "column=" Item_category_name "Name=" CategoryName <field column= "Item_desc" name= "Itemdesc"/> </entity> </document> </dataconfig& Gt
Find Dist/solr-dataimporthandler-7.2.1.jar and your project MySQL driver package copied to Solr-7.2.1/server/solr-webapp/webapp/web-inf/lib
start in cloud modeFound./SOLR start-e Cloud after the error./SOLR start-e Cloud-force
[Root@localhost solr-7.2.1]# CD bin [root@localhost bin]#./SOLR start-e Cloud to the Welcome Solrcloud
This interactive session would help you launch a solrcloud cluster on your local workstation. To begin, how many SOLR nodes would are you like to run in your local cluster? (Specify 1-4 nodes)
[2]: Ok, let's start up 2 SOLR nodes for your example Solrcloud cluster. Please enter the port for Node1 [8983]: [Return] Please enter the port for Node2 [7574]: [Enter] creating SOLR home Directory/ USR/LOCAL/SOLR-7.2.1/EXAMPLE/CLOUD/NODE1/SOLR Cloning/usr/local/solr-7.2.1/example/cloud/node1 into/usr/local/ Solr-7.2.1/example/cloud/node2 starting up SOLR on port 8983 using command: "/USR/LOCAL/SOLR-7.2.1/BIN/SOLR" Start-cloud -P 8983-s "/USR/LOCAL/SOLR-7.2.1/EXAMPLE/CLOUD/NODE1/SOLR" Warning:starting SOLR as the root user is a security risk a nd not considered best practice.
Exiting. Please consult the Reference Guide.
To override this check, start with argument '-force '
error:failed to start SOLR using command: "/USR/LOCAL/SOLR-7.2.1/BIN/SOLR" Start-cloud-p 8983-s/usr/local/solr-7.2. 1/EXAMPLE/CLOUD/NODE1/SOLR "Exception:org.apache.commons.exec.ExecuteException:Process exited with a error:1 (Exit V
ALUE:1) [root@localhost bin]#./SOLR start-e Cloud-force to the Welcome Solrcloud
This interactive session would help you launch a solrcloud cluster on your local workstation. To begin, how many SOLR nodes would are you like to run in your local cluster? (Specify 1-4 nodes)
[2]: [Enter] Ok, let's start up 2 SOLR nodes for your example Solrcloud cluster. Please enter the port for Node1 [8983]: [Return] Please enter the port for Node2 [7574]: [Enter] SOLR home directory/usr/local
/SOLR-7.2.1/EXAMPLE/CLOUD/NODE1/SOLR already exists.
/usr/local/solr-7.2.1/example/cloud/node2 already exists. Starting up SOLR on port 8983 using command: "/USR/LOCAL/SOLR-7.2.1/BIN/SOLR start-cloud-p 8983-s"/usr/local/solr-7.2
.1/EXAMPLE/CLOUD/NODE1/SOLR "-forceWaiting up to 180 seconds to-to-do running on port 8983 [\] started SOLR server on port 8983 (pid=8058).
Happy searching! Starting up SOLR on port 7574 using command: "/USR/LOCAL/SOLR-7.2.1/BIN/SOLR start-cloud-p 7574-s"/usr/local/solr-7.2
.1/EXAMPLE/CLOUD/NODE2/SOLR "-Z localhost:9983-force waiting up to 180 seconds to-to-do running on port 7574 [|] Started SOLR server on port 7574 (pid=8251).
Happy searching! Info-2018-02-19 21:43:23.535; Org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider;
Cluster at localhost:9983 ready now create a new collection for indexing documents in your 2-node Cluster. Please provide a name for your new collection: [gettingstarted] taotao[Enter name and enter] How many shards, you like to split t Aotao into? [2] [carriage return] how many replicas per shard would as to create? [2] [Return] Please choose a configuration for the TAOtao collection, available options are: _default or Sample_techproducts_configs [_default] [Enter] Created collection ' Taota O ' with 2 shard (s), 2 replica (s) with Config-set ' Taotao ' enabling Auto Soft-commits with MaxTime 3 using the Config API POSTing request to Config api:http://localhost:8983/solr/taotao/config {"Set-property": {" UpdateHandler.autoSoftCommit.maxTime ":" 3000 "}} successfully set-property UpdateHandler.autoSoftCommit.maxTime to
3000 Solrcloud example running, please VISIT:HTTP://LOCALHOST:8983/SOLR
SOLR Common Commands
Start Start BIN/SOLR start-help view start Help BIN/SOLR start stand-alone version bin/solr start-f foreground start BIN/SOLR start-p 8984 Specify port boot BIN/SOLR start-cloud start the distributed version BIN/SOLR Start-e CLOUD-NOPROMPT-E indicates that an existing example is to be launched, with the example name Clou D,cloud This example is a Solrcloud-initiated BIN/SOLR Restart Restart project created if it is a stand-alone version to create the core, if it is distributed to create collection BIN/SOLR Create-help View Create help BIN/SOLR create-c ABC abc is the core or collection name, depending on whether SOLR is a stand-alone or cloud version; Refresh HTTP://LOCALHOST:8983/SOLR to
To see the location of a more than one ABC abc directory in the core selector create a post submit data generation index in Solr.solr.home (default is SOLR SERVER/SOLR directory) directory bin/post-c ABC docs/ Submit data to core or collection named ABC, data source deleted in docs/directory BIN/SOLR delete-c ABC delete a core or collection delete index bin/post-c ABC- D "<delete><id>/home/matthewi/software/solr-5.4.1/docs/solr-morphlines-core/allclasses-noframe.html </id></delete> "re-executing the search to see the number of search results is less than one: Numfound column bin/post-c abc-d" <delete><query>*:* </query></delete> "Delete all data stop soLR BIN/SOLR stop-all State BIN/SOLR Status