How to properly set the solr configuration for a config friendly data location
I'm working with a solr app that needs to have a config friendly data location. I've been following this post with no luck.
In my solr module I have the following solrcore.properties file
#solrcore.properties
data.dir=C:\temp\solr123\
I also have the following defined in my solrconfig (also in the solr module)
<dataDir>${data.dir:./solr/data}</dataDir>
solr is still creating the solr directory in the root directory so it would appear that the config friendly property can't be found.
开发者_运维百科Anyone actually hooked these up so you could config your data dir dynamically with solr?
I was able to verify that setting data.dir in solrcore.properties does work, but I tested this on OS X in Jetty. I'm not sure what web container you're using, but you might want to try defining
-Dsolr.solr.home=<location of solr>
since solrcore.properties is expected to be in
<solr.home>/conf/solrcore.properties.
We defined the following system property when starting up our container.
-Dsystem.properties=conf\solrcore.properties
solrcore.properties had the following property
data.dir=C:\\temp\\document-imaging\\solr
In our pom we added a system property section for running our maven build.
<systemProperties>
<system.properties>${tomcat.basedir}/conf/override.properties</system.properties>
</systemProperties>
To clarify further more.
The solrcore.properties
file (Solr 4.x) should be placed either in conf/
or collection1/conf
directory of your Solr home or if Tomcat is used, it can be placed in WEB-INF/
dir of your app. Basically anywhere within Java classpath.
If Solr 5.x is used, consider using core.properties
instead.
Then the configuration can be either reloaded from Application Manager (/manager/html
) or Solr/Jetty/Tomcat service needs to be restarted.
精彩评论