[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Running solr as non-root user with a custom schema.xml


I'm currently packaging python-solrpy which comes bundled with some
tests that i'd like to run at build time. For my efforts, see

The tests are basically a python file and a corresponding schema.xml.
Normally, it's suggested to just use solr's example directory (with
integrated jetty) and replace its schema.xml with the one provided by
solrpy, and then run it via java -jar start.jar


On debian however, solr and jetty are unbundled (for good reason), and i
can't of course just replace solr's example schema.xml (which gets
installed to /etc/solr/conf).

I've started by looking for ways to run solr on jetty as non-root by
basically running

java -jar /usr/share/jetty/start.jar

But that is highly non-trivial, as jetty's configuration files seem to
point to solr's in a pretty hardcoded way.

I was able to change jetty's logs and home location by

java -jar -Djetty.home=/usr/share/jetty
-Djetty.logs=/home/me/solr/logs /usr/share/jetty/start.jar /etc/jetty/jetty.xml 

I can run jetty as a non-root user by issuing that command from
within /usr/share/jetty, but it fails to start solr, as I haven't yet
found a way to make solr use another datadir than /var/lib/solr/data --
which is hardcoded in /etc/solr/conf/solrconfig.xml.

I think I might be able to change the latter by having the solr-common
package change its /etc/solr/conf/solrconfig.xml to read


instead of


and put a solrcore.properties into solr.home


( as seen over at
http://wiki.apache.org/solr/SolrConfigXml#System_property_substitution )
-- or just pass -Dsolr.data.dir=/data/dir from within some startup

Would such a modification of solr-common have any chance to be accepted
by the java team?


With schema.xml, I'm rather clueless. -Dsolr.solr.home=/home/me/solr/
doesn't do the trick as this stuff is also hardcoded
(in /usr/share/solr/WEB-INF/jetty-web.xml -- which is part of
solr-jetty). Actually, that's the only purpose of jetty-web.xml, which
is evaluated because of jetty's context settings (I think). Moreover,
I'm trying not to duplicate the other contents of that directory, so
setting solr.solr.home to a different location might not be what I want
at all.

I think my most relevant questions are:
1. Is anyone able to successfully run jetty with solr
via /usr/share/jetty/start.jar as a non-root user (ideally from within
any directory, not just from within /usr/share/jetty)? If yes: how?
2. How can I make solr use my schema.xml instead of the one installed?
3. I haven't tried the whole thing in tomcat yet, so does anyone know if
it would be easier there -- maybe because configuration files aren't
that much entangled and hardcoded there? (In the end, I might have to do
the whole thing also for tomcat anyway as I'm build-depending on
solr-jetty | solr-tomcat which conflict each other).

I'm kinda desperate with the load of configuration files, so I'd really
appreciate any help that gets me closer to get this thing done.
Kind regards

Reply to: