被围观了 972 次

 

Apache solr

 

Installation & Configuration of Apache Solr

Before start with the installation of apache solr. Let's understand the working of apache solr. In this article, I am going to demonstrate the installation and integration part of solr with Magento.

Apache Solr:

  • Apache Solr is an open source application use for the search index.
  • Apache Solr is basically working as Full-text Search engine.
  • Solr provides the XML interface and JSON API with which search application can be work.
  • Solr is written on Java Platform.
  • It is very stable and reliable application when you need any application for the search index.
  • Apache Solr running on default port 8983.

Apache solr can be used or integrate with multiple platforms like Magento, drupaletc. In this article, we will see the integration of apache solr with Magento platform.

You need to install below packages on the server.

  • Apache Solr 3.6.X
  • JAVA 7.x or 8

We have using solr 3.6 version. Reason to use this version is because it is a stable solr version and compatible with Magento platform. We are tried using latest version with Magento but it will not compatible with Magento. I have personally recommended you to use Solr version 3.6 series.

I have divided this article into two parts,

  • Installation
  • Integration

Installation of Apache Solr

Step 1: Download Apache Solr

Download the below link on the server under the “/opt/ directory. Download this link using wget command.

  • cd /opt/
  • sudo wget https://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.zip
  • sudo unzip apache-solr-3.6.2.zip
  • sudo mv apache-solr-3.6.2 apache-solr

Step 2: Install Java

Here you need to install java version 7 or higher. Java supports to run apache solr.

Follow below simple steps to install java.

  • sudo apt-get update
  • sudo apt-get install openjdk-7-jdk
  • sudo java -version
    java version "1.7.0_101"
    
    OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1)
    
    OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

Step 3: Run Apache Solr

Now you need to run apache solr process in the background with below java command. Go to the “/opt/apache-solr/example” and run java command onstart.jar file.

  • cd /opt/apache-solr/example
  • java -jar start.jar & [ & symbol use to run application in background]

Press “Enter” to come out of the process and open the new terminal window.
Check process is running with ps command & netstat command,

  • ps aux | grep java
root 10980 0.0 0.0 89568 4560 pts/8 S 13:36 0:0 sudo java -jar start.jar
  • netstat -tunlp | grep 8983
tcp  0  0  0.0.0.0:8983  0.0.0.0:*   LISTEN  9074/java

You can also setup init script to start,stop & restart the apache solr instead of running solr in the background. Check out below link for Apache solr Init script.

Read: Init Script to start,stop,restart apache Solr service.

Step 4: Check Solr panel

Now run the below URL to check Solr admin panel on the browser.

http://192.168.3.39:8983/solr/admin/
Apache solr

Installation part is completed. Now we move to our integration part which explains you configuration with Magento.

Integration of Apache Solr with Magento

Step 1 : Download Apache Solr module

Download the module from GitHub repo link and sync this code with your Magento code.

Don’t worry it will only sync the module files with code which need to run solarium on Magento.

  • git clone https://github.com/jeroenvermeulen/magento-solarium.git
  • rsync -avzP magento-solarium/*   yourcodedirectory/

Step 2: Copy solrconfig.xml and schema.xml

Now copy solrconfig.xml & schema.xml file from solarium to the apache-solr directory. Follow below steps to copy files in the exact location.

Follow below steps to copy files in the exact location.

sudo cp ./app/code/community/JeroenVermeulen/Solarium/docs/schema.xml   /opt/apache-solr-3.6.2/example/solr/conf/

sudo cp ./app/code/community/JeroenVermeulen/Solarium/docs/schema.xml   /opt/apache-solr-3.6.2/example/solr/conf/

Step 3: Restart Solr Server

If you do not yet install init script then you need to kill the solr process and run again in the background.

  • ps aux | grep java
  • Kill -9 PID   [stop service]
  • cd /opt/apache-solr/example
  • sudo java -jar start.jar  [start service]

Step 4 : Configuration Solr in Magento panel

Now open Magento admin panel in the browser. Go to the “System → Configuration → Catalog → Solarium”.

Once you open configuration window use same settings which show in below image. After filling all the configuration settings click on “Test Connection” & “Self Test” button.

magento-admin3

Once you get the success message on clicking Test Connection then your configuration is successfully completed.

Step 5 : Reindex the Catalog Search

Once configuration part compete you need to run catalog indexing which helps to build the solr search. After reindexing open website and search in the search box you will get the search result.

Apache solr

I hope you like the article if you find any difficulties while installing apache solr with magento then please do comment your queries or problem via the comment section, till then stay tuned to techthings.org for more such valuable articles.

 
目前有0条回应
Comment
Trackback
你目前的身份是游客,请输入昵称和电邮!

Verify Code   If you cannot see the CheckCode image,please refresh the page again!