solr6.6+jetty+centos+mysql

Installation steps (solr6.6+jetty+centos+mysql)

(Use the jetty in solr as the server) p>

1. Download solr: http://www.apache.org/dyn/closer.lua/lucene/solr/6.6.0

2. Throw it to the server and decompress it with commands, for example The path I finally extracted is

/data/solr/solr-6.6.0

3. Go to the root directory of the installation cd /data/solr/solr-6.6.0< strong>(All operations below are based on this folder)

4. Start bin/solr start (for Use this command to start solr when a dedicated account is assigned)

bin/solr start -force (if no account is assigned to solr, you must add the following -force to force start)

5. Port 8983 is occupied by default

Then the access address is ip:8983

eg: http://192.168.1.1:8983

Summary:

Seeing the online tutorials is basically no problem here, and it is basically gone until the start, but the mysql data I want most is imported. No, hey kidney injury;

How to create a core

Method 1 (Basically useless, students who are doing research can see it, if you only use it, please see Method 2 directly)

1. First use the command to create bin/solr create -c This name is your own Take whatever you like

2. Then execute the command bin/post -c example/exampledocs/*.xml (The purpose of this sentence is to copy the included example Come and have a look)

3. When you refresh the page, you can see the core you named yourself

Method two (Create a core that can import mysql data)

1. First export the solr-6.6.0/server/solr/configsets/data_driven_schema_configs folder to the local test

2 .Place the folder copied above to solr-6.6.0/server/solr (rename the folder yourself, depending on what name you like, for example, mine is thj_solr_core)

3. Go Use the add core function on the page to add the folder you just copied

(A core that can be used to import mysql data is created here)

4. Add the mysql driver (I use mysql-connector-java-5.1.42.jar here) and put the mysql jar package directly into the solr-6.6.0/dist folder.

5. Configuration data

5.1 Add dependency Add two lines of dependency in solr-6.6.0/server/solr/thj_solr_core/conf/solrconfig.xml file

Add to the middle of this tag


5.2 Restart solr (load new dependencies)

bin/solr restart

5.3 Configure mysql< /p>

5.3.1 For example, I have a mysql database named thj_db

There is a table named food_t in the thj_db database

There is a table in the food_t table Four Fields ft_id ,ft_name ,ft_mome, ft_updateTime

5.3.2 Create a data-config.xml in the solr-6.6.0/server/solr/thj_solr_core/conf folder

Content As follows(The name of the primary key must use id)

 


  

query="select * from food_t"
deltaImportQuery="select * from food_twhere ft_id= '${dataimporter.delta.ft_id}'"
deltaQuery="select lha_id from food_t where ft_updateTime>'${dataimporter.last_index_time}'">

   







   
  

5.3.3 Continue to modify solr-6.6.0/server/solr/thj_solr_core/conf/solrconfig.xml

5.3.3.1 Locate to

5.3.3.2 Add data configuration above this line

< requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler"> 
 
  data-config .xml
 

 

5.3.4 Modify solr-6.6.0/server/solr/thj_solr_core/conf/managed-schema

5.3.4.1 First locate Go to

Because this is a copy, so you have to change it here, and replace it with the table name. The effect is as follows

5.3.4.2 Continue positioning to

Add a field below this line

 










5.4 Restart solr (It seems to work without restarting)

bin/solr restart

5.5 to page

Note:

Be sure to read the modification details of the two files data-config.xml and managed-schema

Otherwise you will I wonder why the configuration looks the same, and why the data just can’t make it through. Anyway, I was stuck for two days before finding out

Leave a Comment

Your email address will not be published.