1

I've the following configuration file within conf/Catalina/localhost in Tomcat 7:

<Context docBase="webapps/solr.war" debug="0" crossContext="true" >
   <Environment name="solr/home" type="java.lang.String" value="/opt/solr/home" override="true" />
   <Environment name="data/dir" type="java.lang.String" value="/var/lib/solr" override="true" />
</Context>

where I would like to separate my solr.home from data.dir.

I've tested the above config files, but doesn't seems to work.

Is it something possible using that this kind of XML configuration file?

I've checked on GitHub and there are some configuration files which they have it there, but I couldn't make it working.

2
  • 1
    Is that helps ? wiki.apache.org/solr/SolrTomcat#Multiple_Solr_apps
    – krisFR
    May 28, 2015 at 23:26
  • @krisFR Thanks, however it doesn't help, I've seen that already, but it doesn't show if I can define data/dir (I'm not sure even if the name of variable is correct). Basically I want to have one instance, but two different folders to separate config files and data it-self.
    – kenorb
    May 28, 2015 at 23:27

2 Answers 2

1

I don't believe so.

Work was done a long time ago to support system property substitution when the solrconfig.xml file is loaded, but i don't think that was ever generalized to support JNDI values as well (which is the <Environment/> tags in context files set).

I actually have a patch for solr config parser which allows you to use context environment variables in the solrconfig.xml.

Posted by Chris Hostetter (Hoss) back in 2010 at solr-user group.

1

I don't think it's possible to use Tomcat context environment entries for data directory without patching Solr. It seems only solr/home variable works fine.

The better way of doing is by using JVM system property file (solrcore.properties) which should be located either within your Solr conf/ home directory (or: collection1/conf) or Tomcat WEB-INF/ dir with the following entry:

solr.data.dir=/var/lib/solr

by using and reload your app or restart your Tomcat service to reload Java properties.

Alternatively is to use solr.xml (in Solr 4.x) by setting different instanceDir and dataDir which would separate dataDir from the configuration files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .