Translation(s): none
Details about using Solr with Debian
Installation
The solr packages are not available in DebianBullseye but only up to DebianBuster.
Install either solr-tomcat or solr-jetty, depending which you want to use as your servlet container:
apt-get install solr-tomcat
apt-get install solr-jetty
The solr interface should now be available at http://localhost:8080/solr/admin/
Adding additional contributions
Upstream provides additional functionality in so called contributions. Only the dataimporthandler without dataimporthandler-extras is included in the Debian package. If you want to add others:
Download solr binaries from http://archive.apache.org/dist/lucene/solr/
- Untar to a temporary directory
Mkdir /usr/local/share/java/
Copy the contrib and dist directories from the temporary directory to /usr/local/share/java/
Uncomment (or add) the relevant lib entires in solrconfig.xml, updating the path as required. For example:
<lib dir="/usr/local/share/java/dist/" regex="apache-solr-cell-\d.*\.jar" /> <lib dir="/usr/local/share/java/contrib/extraction/lib" regex=".*\.jar" /> <lib dir="/usr/local/share/java/dist/" regex="apache-solr-clustering-\d.*\.jar" /> <lib dir="/usr/local/share/java/contrib/clustering/lib/" regex=".*\.jar" /> <lib dir="/usr/local/share/java/dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" /> <lib dir="/usr/local/share/java/contrib/dataimporthandler/lib/" regex=".*\.jar" /> <lib dir="/usr/local/share/java/dist/" regex="apache-solr-langid-\d.*\.jar" /> <lib dir="/usr/local/share/java/contrib/langid/lib/" regex=".*\.jar" /> <lib dir="/usr/local/share/java/dist/" regex="apache-solr-velocity-\d.*\.jar" /> <lib dir="/usr/local/share/java/contrib/velocity/lib" regex=".*\.jar" />
Configuration
All configuration takes place in /etc/solr, although due to limitations of solr, the configuration is symlinked from /usr/share/solr.
A default configuration is included in the package, but it is not at all suited to production use. This wiki does not aim to be a manual on configuring solr, so please read full details at the following links:
solr.xml is the root configuration file for all solr cores: http://wiki.apache.org/solr/Solr.xml%20%28supported%20through%204.x%29
solrconfig.xml is the file that contains most of the parameters for configuring the core itself: http://wiki.apache.org/solr/SolrConfigXml
schema.xml contains all of the details about which fields your documents can contain, and how those fields should be dealt with when adding documents to the index, or when querying those fields: http://wiki.apache.org/solr/SchemaXml
Multicore
Multiple cores let you have a single Solr instance with separate configurations and indexes, with their own config and schema for very different applications.
The default Debian layout does not lend itself well to multicore, as the core configuration files located in /etc/solr need to be moved to a layer down in the file system. Instead, create a directory within /etc/solr for each core, with a conf directory inside that.
Add details of each core to /etc/solr/solr.xml, changing the instanceDir as required:
<cores defaultCoreName="core1" adminPath="/admin/cores" hostPort="8983"> <core instanceDir="core1/" name="core1"/> <core instanceDir="core2/" name="core2"/> </cores>
To make matters more complicated, solr does not work well using files outside of its main "home" directory. Once each core configuration has been created within /etc/solr/<core>/, you will need to create an equivalent directory within /usr/share/solr/ (for example /usr/share/solr/core1/.
From within /usr/share/solr/<core>/ symlink to the other directories that solr expects:
conf -> /etc/solr/<core>/conf/ data -> /var/lib/solr/<core>
Solr will store the indexes in /var/lib/solr/. Create a directory in there for each instance (eg. /var/lib/solr/core1/) owned by tomcat6.tomcat6 (for a Tomcat servlet) and chmod it to 770.
More information can be found at http://wiki.apache.org/solr/CoreAdmin
Security
By default, the Tomcat servlet is open to the world to browse. Use a firewall to limit access, or use a rule similar to this within /etc/tomcat6/server.xml:
<!-- allow is a regex --> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="122\.0\.0\.1"/>
Logging
When using Tomcat as a servlet, log files are contained in /var/log/tomcat6/
Other documentation
Solr query syntax: http://wiki.apache.org/solr/SolrQuerySyntax
Solr FAQ: http://wiki.apache.org/solr/FAQ