Solr

De MochilaWiki
Ir para navegaçãoIr para pesquisar

No debian wheezy é possível instalar assim

apt-get install solr-tomcat

mas a versão padrão é 3.6.0, bem antiga, pois atualmente está na versão 4.10.3

outra forma de instalação

apt-get install openjdk-7-jre-headless tomcat7 tomcat7-admin
curl http://archive.apache.org/dist/lucene/solr/4.10.3/solr-4.10.3.tgz | tar xz
cp ~/solr-4.10.3/example/lib/ext/* /usr/share/tomcat7/lib/
cp ~/solr-4.10.3/dist/solr-4.10.3.war /var/lib/tomcat7/webapps/solr.war
cp -R ~/solr-4.10.3/example/solr /var/lib/tomcat7
chown -R tomcat7:tomcat7 /var/lib/tomcat7/solr

acrescente em antes de </tomcat-users> em /etc/tomcat7/tomcat-users.xml

<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="your_username" password="your_password" roles="manager-gui,admin-gui,solr-gui"/>

altere your_username e your_password

acrescente antes de </web-app> no arquivo /var/lib/tomcat7/webapps/solr/WEB-INF/web.xml

<security-constraint>
  <web-resource-collection>
    <web-resource-name>Solr GUI Authentication</web-resource-name>
    <url-pattern>/*</url-pattern>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
  </web-resource-collection>
  <auth-constraint>
    <role-name>solr-gui</role-name>
  </auth-constraint>

  <user-data-constraint>
    <transport-guarantee>NONE</transport-guarantee>
  </user-data-constraint>
</security-constraint>

<login-config>
  <auth-method>BASIC</auth-method>
</login-config>

reinicie o tomcat

service tomcat7 start

acesse em http://192.168.0.13:8080/solr

Como configurar no crontab para indexar o Solr automáticamente

crontab -e

e insira

0 */6  * * * curl http://seuservidor/solr/nome_do_core/nome_do_core?command=full-import

fonte http://dtelaroli.org/2014/08/como-configurar-crontab-para-indexar-solr-automaticamente-2