如何配置 Magento Enterprise 以使用 Solr 作为主要搜索引擎? [英] How to configure Magento Enterpise to use Solr as the main search engine?

查看:26
本文介绍了如何配置 Magento Enterprise 以使用 Solr 作为主要搜索引擎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图寻找文档,但它非常稀疏.我编写了以下指南,希望它可以为某人节省 2-3 小时的安装、设置和配置时间.
与 MySQL 全文搜索标准设置相比,使用 Solr 的性能提升非常惊人.绝对值得花时间在您的 Magento 安装中使用它.

解决方案

Magento - Solr 安装 &配置

  1. 确保安装了 Java JDK:

    1. sudo add-apt-repository ppa:sun-java-community-team/sun-java6
    2. sudo apt-get 更新
    3. sudo apt-get install sun-java6-jre sun-java6-jdk

  2. 安装 &配置Tomcat:

    • 安装:
      sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user
    • 配置:
      vi/etc/tomcat6/tomcat-users.xml
    • 将以下角色和用户添加到配置中.

      <role rolename="manager"/><user username="tomcat" password="password" roles="admin,manager"/>

    • 重启服务器:/etc/init.d/tomcat6 重启

      如果一切顺利,转到http://hostname:8080

  3. 安装 Solr:

    • 在此处查看最新发行版.. http://apache.rediris.es/lucene/solr/
    • 下载版本http://apache.rediris.es/lucene/solr/3.3.0/apache-solr-3.3.0.zip
    • 安装 &配置

      1. 解压 apache-solr-3.3.0.zip
      2. mkdir/usr/share/tomcat6/webapps
      3. cp apache-solr-3.3.0/dist/apache-solr-3.3.0.war/usr/share/tomcat6/webapps/solr.war
      4. cp -r apache-solr-3.3.0/example/solr/usr/share/tomcat6/solr
      5. vi/etc/tomcat6/Catalina/localhost/solr.xml

        <前><环境名称="solr/home" type="java.lang.String"value="/usr/share/tomcat6/solr" override="true"/>

      6. chown -r tomcat6.tomcat6/var/lib/tomcat6
      7. /etc/init.d/tomcat6 restart

    • 您应该会在 Tomcat 管理员/管理器页面上看到 Solr 访问权限 (http://hostname:8080/manager/html)

  4. 配置 Magento 以使用 Solr:

    1. 用 Magento conf 文件替换原来的 Solr conf 目录.诀窍是从 Magento 复制目录,并替换 Solr 中的目录.而已!

      • 在 Magento 中,该文件夹位于:[magento-instance-root]/lib/Apache/Solr/conf.
      • 在 Solr 中,该文件夹位于 [Solr-instance-root]/example/solr/conf.

    2. 在 Magento 中配置 Solr:在管理员中,转到系统 -> 配置 -> 目录 -> 目录搜索

<小时>

疑难解答:

确保所有配置文件都属于 tomcat6:tomcat6
chown -r tomcat6.tomcat6 ...

  • /var/lib/tomcat6/conf/Catalina/localhost
  • /usr/share/tomcat6/solr/conf

I tried looking for documentation but it is quite sparse. I wrote the following guide hoping that it might save someone 2-3 hours dealing with installations, setup and configuration.
The performance gains from using Solr are quite spectacular compared to the MySQL fulltext search standard setup. It is definitely worth the time to get this working in your Magento installation.

解决方案

Magento - Solr Installation & Configuration

  1. Make sure the Java JDK is installed:

    1. sudo add-apt-repository ppa:sun-java-community-team/sun-java6
    2. sudo apt-get update
    3. sudo apt-get install sun-java6-jre sun-java6-jdk

  2. Install & Configure Tomcat:

    • Installation:
      sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user
    • Configuration:
      vi /etc/tomcat6/tomcat-users.xml
    • Add the following roles and user to the configuration.

      <role rolename="admin"/>
      <role rolename="manager"/>
      <user username="tomcat" password="password" roles="admin,manager"/>
      

    • Restart the server: /etc/init.d/tomcat6 restart

      If all goes well, goto http://hostname:8080

  3. Install Solr:

    • Check for the latest distro here.. http://apache.rediris.es/lucene/solr/
    • Download release http://apache.rediris.es/lucene/solr/3.3.0/apache-solr-3.3.0.zip
    • Install & Configure

      1. unzip apache-solr-3.3.0.zip
      2. mkdir /usr/share/tomcat6/webapps
      3. cp apache-solr-3.3.0/dist/apache-solr-3.3.0.war /usr/share/tomcat6/webapps/solr.war
      4. cp -r apache-solr-3.3.0/example/solr /usr/share/tomcat6/solr
      5. vi /etc/tomcat6/Catalina/localhost/solr.xml

        <Context docBase="/usr/share/tomcat6/webapps/solr.war" debug="0" 
        privileged="true" allowLinking="true" crossContext="true">
        <Environment name="solr/home" type="java.lang.String" 
        value="/usr/share/tomcat6/solr" override="true" />
        </Context>
        

      6. chown -r tomcat6.tomcat6 /var/lib/tomcat6
      7. /etc/init.d/tomcat6 restart

    • You should see Solr access on your Tomcat admin/manager page (http://hostname:8080/manager/html)

  4. Configure Magento to use Solr:

    1. Replace the original Solr conf directory with the Magento conf files. The trick is just to copy the directory from Magento, and replace the one in Solr. That's it!

      • In Magento, the folder is located in: [magento-instance-root]/lib/Apache/Solr/conf.
      • In Solr, the folder is located in [Solr-instance-root]/example/solr/conf.

    2. Configure Solr in Magento: In admin, goto System -> Configuration -> Catalog -> Catalog Search


Troubleshooting:

Make sure all configuration files belong to tomcat6:tomcat6
chown -r tomcat6.tomcat6 ...

  • /var/lib/tomcat6/conf/Catalina/localhost
  • /usr/share/tomcat6/solr/conf

这篇关于如何配置 Magento Enterprise 以使用 Solr 作为主要搜索引擎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆