solr-4.6.0 for Dovecot 2.2.9+

Quick and dirty how to for SOLR. This is a draft. So please give me feedback. Thanks


The following steps are tested on Gentoo.

Download solr-4.6.0.tgz from official website and save to /usr/local/src (or wherever you prefer)

Install a java JRE, for example:

USE="-X -alsa -cjk -cups -doc -examples -nsplugin -source"
emerge dev-java/icedtea-bin

USE-flags for dovecot that I use:

USE="bzip2 caps imapc ipv6 maildir managesieve mbox mdbox mysql pam pop3c sdbox sieve solr sqlite ssl suid tcpd zlib -cydir -doc -kerberos -ldap -lucene -postgres -selinux -static-libs -vpopmail"

Setting up solr stuff:


cd /opt
tar xvzf /usr/local/src/solr-4.6.0.tgz
cd /opt/solr/example/solr/collection1/conf
mv schema.xml schema.xml-dist
cp /usr/share/doc/dovecot-2.2.9/solr-schema.xml.bz2 schema.xml.bz2
bunzip2 schema.xml.bz2
cd /etc/local.d/

vi solr.start:


# Start Solr
cd /opt/solr-4.6.0/example/
nohup java -jar start.jar &


chmod +x solr.start
./solr.start

lsof -Pni :8983
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 28262 root 117u IPv6 7906545 0t0 TCP *:8983 (LISTEN)

cd /etc/dovecot/conf.d

vi 90-plugin.conf:


plugin {
fts = solr
fts_solr = break-imap-search url=http://localhost:8983/solr/
fts_autoindex = yes
}

vi 10-mail.conf:


mail_plugins = ... fts fts_solr ...

Restart dovecot server
/etc/init.d/dovecot restart

crontab -e


# Apache-SOLR
0 0 * * * curl http://localhost:8983/solr/update?optimize=true
*/1 * * * * curl http://localhost:8983/solr/update?commit=true >/dev/null 2>&1

Ready. Enjoy 🙂

That’s what it looks like, if you do a ssh forward like:


ssh -L8983:localhost:8983 your.mailserver.tld

solr Dashboard

Also a quick look here:


cd /opt/solr-4.6.0/example/solr/collection1/data/:

# du -sch:
608M .
608M total

2 Gedanken zu „solr-4.6.0 for Dovecot 2.2.9+

  1. sulliwane

    Hi,

    thank you for sharing this. I’m in a very similar situation, I compiled Dovecot 2.2 with solr option, and installed solr 3.6 with tomcat6 on a Ubuntu 14.04

    I configured everything, connected with telnet and tried a „search“ command. If I use ctrl+shift+F on thunderbird to search on the server (imap search) the solr search seems working (as I have a result, and no imap process is running on the server at the same time), but when using the search from roundcube (I select to search all the fields including body) a imap process starts on the server and I have this error message in dovecot.log:

    indexer-worker: Error: User xxxxx@vxxxxxxxe.fr lookup failed: Unknown user
    Sep 24 03:02:12 imap(xxxxxx@vxxxxxxxe.fr): Error: indexer failed to index mailbox INBOX

    and no log message in catalina.log of tomcat6.

    Do you have any idea?
    Why did you upgrade solr to 4.6?

    Thank you for your answers! 😉

    1. Christian Rößner Beitragsautor

      I must admit that I switched to lucene shortly after writing that post. I was discussing this with other postmasters and lucene seems to be easier than the solr solution.

      If you really want to get things done, I suggest you ask on the dovecot users mailing list. I am pretty sure you will find help there.

Kommentare sind geschlossen.