Centos 7.5 + SOLR 7.4 (jetty boot) +mysql 5.7

Source: Internet
Author: User
Tags solr

1. Installing the JDK 1.8 environment
1.1 Download JDK 1.8 installation Package jdk-8u181-linux-x64.rpm
: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
1.2 Installation
RPM-IVH jdk-8u181-linux-x64.rpm
1.3 Testing
# java-version
Java Version "1.8.0_181"
(You can return the correct JDK version number to indicate that the installation was successful)

2. Yum Install MySQL 5.7
2.1 Configuring the MySQL Yum source
#wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm--no-check-certificate
# yum Localinstall mysql57-community-release-el7-8.noarch.rpm
# Ls/etc/yum.repos.d/| grep MySQL
Mysql-community.repo
Mysql-community-source.repo
2.2 Installing MySQL and booting
#yum Install Mysql-community-server–y
#systemctl Start mysqld
#systemctl Enable Mysqld
2.3 Modifying the MySQL root password
#grep "Password"/var/log/mysqld.log (view the default password generated when MySQL starts)
2018-07-23t01:55:00.619594z 1 [Note] A temporary password is generated for[email protected]: TEF7EOVCXK;;
# mysql-u Root–p
Enter Password: (Enter the password you just found)
mysql> SET PASSWORD = PASSWORD (' Your new PASSWORD ');
Mysql> ALTER USER ' root ' @ ' localhost ' PASSWORD EXPIRE never;
mysql> flush Privileges;
2.4 Creating a database and importing data
mysql> CREATE DATABASE TEST_SOLR;
mysql> use TEST_SOLR;
Mysql> Source/opt/solr/article.sql;
3. Installing SOLR 7.4
3.1 Modifying the number of files opened by the system
Modify the/etc/sysctl.conf file to add the last line
Fs.file-max = 655350
Modify the/etc/security/limits.conf file to add the last line
* Soft Nproc 65535
* Hard Nproc 65535
* Soft Nofile 65535
* Hard Nofile 65535
Restart the system when you are finished modifying
3.2 Download SOLR installation package solr-7.4.0.tgz
: http://mirrors.hust.edu.cn/apache/lucene/solr/7.4.0/solr-7.4.0.tgz
3.3 Installing SOLR
#mkdir/USR/LOCAL/SOLR
#tar XF SOLR-7.4.0.TGZ–C/USR/LOCAL/SOLR/SOLR
3.4 Modifying the SOLR time zone and the available memory size (configured in the/usr/local/solr/solr/bin/solr.in.sh file)
# Cat/usr/local/solr/solr/bin/solr.in.sh | Grep-v ' # ' | Grep-v ^$
Solr_java_mem= "-xms4096m-xmx4096m"
Solr_timezone= "Asia/shanghai"
3.5 Start SOLR
#/usr/local/solr/solr/bin/solr start-p 8081–force
Access Test 192.168.64.100:8081/SOLR

4. Finding data using SOLR
4.1 Adding Test_core
4.1.1 Creating the Test_core directory:
Create a directory under the/usr/local/solr/solr/server/solr/directory
#mkdir Test_core
4.1.2 Copying a configuration file
Copy the Conf directory under/usr/local/solr/solr/server/solr/configsets/_default to
/usr/local/solr/solr/server/solr/test_core under
# cd/usr/local/solr/solr/server/solr/configsets/_default/
#cp –r conf/usr/local/solr/solr/server/solr/test_core/
4.1.3 Adding Test_core


When you click Add Core, the/usr/local/solr/solr/server/solr/test_core directory will appear
Core.properties File and Data directory
4.2 Importing data from the database into the SOLR Test_core
4.2.1 Creating a Data-config.xml file
Add File Data-config.xml in/usr/local/solr/solr/server/solr/test_core/conf, as follows:
# Cat Data-config.xml
<?xml version= "1.0" encoding= "UTF-8"?>
<dataConfig>
<datasource name= "Source1" type= "Jdbcdatasource"
Driver= "Com.mysql.jdbc.Driver"
Url= "JDBC:MYSQL://192.168.64.100:3306/TEST_SOLR"
User= "Root"
Password= "[email protected]"
Batchsize= "-1"/>
<document>
<entity name= "article" datasource= "Source1"
query= "Select Pmid,article_title,author_list,abstract_text,keywords,pmcid,pub_med_pub_date,journal_issue,serch_ Text from article ">
<field column= "PMID" name= "PMID"/>
<field column= "Article_title" name= "Article_title"/>
<field column= "author_list" name= "Author_list"/>
<field column= "Abstract_text" name= "Abstract_text"/>
<field column= "keywords" name= "description"/>
<field column= "Pmcid" name= "Pmcid"/>
<field column= "Pub_med_pub_date" name= "Pub_med_pub_date"/>
<field column= "journal_issue" name= "Journal_issue"/>
<field column= "Serch_text" name= "Serch_text"/>
</entity>
</document>
</dataConfig>
4.2.2 Modifying Solrconfig.xml files
Modify/usr/local/solr/solr/server/solr/test_core/conf/solrconfig.xml, in <requesthandler name= "/select" class= "SOLR. Searchhandler "> Add the following code
<requesthandler name= "/dataimport" class= "Org.apache.solr.handler.dataimport.DataImportHandler" >
<lst name= "Defaults" >
<str name= "config" >data-config.xml</str>
</lst>
</requestHandler>
<requesthandler name= "/select" class= "SOLR. Searchhandler "> #在这一行上面添加
4.2.3 Modifying Managed-schema files
Modify/usr/local/solr/solr/server/solr/test_core/conf/managed-schema to add something:
<field name= "_version_" type= "Plong" indexed= "false" stored= "false"/>
<field name= "_root_" type= "string" indexed= "true" stored= "false" docvalues= "false"/>
<field name= "_text_" type= "Text_general" indexed= "true" stored= "false" multivalued= "true"/>
#以下为添加的内容:
<field name= "PMID" type= "string" indexed= "true" stored= "true"/>
<field name= "Article_title" type= "string" indexed= "true" stored= "true"/>
<field name= "Author_list" type= "string" indexed= "true" stored= "true"/>
<field name= "Abstract_text" type= "string" indexed= "true" stored= "true"/>
<field name= "keywords" type= "string" indexed= "true" stored= "true"/>
<field name= "Pmcid" type= "string" indexed= "true" stored= "true"/>
<field name= "Pub_med_pub_date" type= "string" indexed= "true" stored= "true"/>
<field name= "Journal_issue" type= "string" indexed= "true" stored= "true"/>
<field name= "Serch_text" type= "string" indexed= "true" stored= "true"/>
4.2.4 Download the jar package that connects the database and imports the data Mysql-connector-java-8.0.11.jar
: Http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.11/mysql-connector-java-8.0.11.jar
4.2.5 Configuration Data Import Dependency package
The Mysql-connector-java-8.0.11.jar and/usr/local/solr/solr/dist directories just now.
Solr-dataimporthandler-extras-7.4.0.jar, Solr-dataimporthandler-7.4.0.jar
These three jar packages are copied together into the/usr/local/solr/solr/server/solr-webapp/webapp/web-inf/lib directory
#cd/usr/local/solr/solr/server/solr-webapp/webapp/web-inf/lib
# ls | Grep-e ' (solr-dataimporthandler-*|mysql*) '
Mysql-connector-java-8.0.11.jar
Solr-dataimporthandler-7.4.0.jar
Solr-dataimporthandler-extras-7.4.0.jar
4.2.6 Importing Data


4.3 Search data

5. Reference Documentation:
81037279
Https://www.cnblogs.com/jorzy/p/8455519.html
49002141
80374884

Centos 7.5 + SOLR 7.4 (jetty boot) +mysql 5.7

Related Article

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.