You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Dariusz Borowski <da...@gmail.com> on 2013/01/10 09:58:25 UTC
Reading properties in data-import.xml
I'm having a problem using a property file in my data-import.xml file.
My aim is to not hard code some values inside my xml file, but rather
reusing the values from a property file. I'm using multicore and some of
the values are being changed from time to time and I do not want to change
them in all my data-import files.
For example:
<dataSource
type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://${host}:3306/projectX"
user="${username}"
password="${password}" />
I tried everything, but don't know how I can use proporties here. I tried
to put my values in dataimport.properties, located under "SOLR-HOME/conf"
and under "SOLR-HOME/core1/conf", but without any success.
Please, could someone help me on this?
Re: Reading properties in data-import.xml
Posted by Dariusz Borowski <da...@gmail.com>.
Thanks Alex!
This brought me to the solution I wanted to achieve. :)
D.
On Thu, Jan 10, 2013 at 3:21 PM, Alexandre Rafalovitch
<ar...@gmail.com>wrote:
> dataimport.properties is for DIH to store it's own properties for delta
> processing and things. Try solrcore.properties instead, as per recent
> discussion:
>
> http://lucene.472066.n3.nabble.com/Reading-database-connection-properties-from-external-file-td4031154.html
>
> Regards,
> Alex.
>
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all at
> once. Lately, it doesn't seem to be working. (Anonymous - via GTD book)
>
>
> On Thu, Jan 10, 2013 at 3:58 AM, Dariusz Borowski <dariusz.b@gmail.com
> >wrote:
>
> > I'm having a problem using a property file in my data-import.xml file.
> >
> > My aim is to not hard code some values inside my xml file, but rather
> > reusing the values from a property file. I'm using multicore and some of
> > the values are being changed from time to time and I do not want to
> change
> > them in all my data-import files.
> >
> > For example:
> >
> > <dataSource
> > type="JdbcDataSource"
> > driver="com.mysql.jdbc.Driver"
> > url="jdbc:mysql://${host}:3306/projectX"
> > user="${username}"
> > password="${password}" />
> >
> > I tried everything, but don't know how I can use proporties here. I tried
> > to put my values in dataimport.properties, located under "SOLR-HOME/conf"
> > and under "SOLR-HOME/core1/conf", but without any success.
> >
> > Please, could someone help me on this?
> >
>
RE: Reading properties in data-import.xml
Posted by Swati Swoboda <ss...@igloosoftware.com>.
I am on 3.6 and this is my setup:
Properties file under <solr.home>, so right under /jetty/solr
solr.xml modified as follows:
<core name="corename" instanceDir="instancedir" properties="../solrcore.properties" />
http://wiki.apache.org/solr/CoreAdmin#property - the path is relative to instancedir
Your syntax is correct in DIH, I think all you are missing is the reference to the property file in solr.xml.
-----Original Message-----
From: Dariusz Borowski [mailto:dariusz.b@gmail.com]
Sent: Thursday, January 10, 2013 10:38 AM
To: solr-user@lucene.apache.org
Subject: Re: Reading properties in data-import.xml
Thanks Alexandre!
I followed your example and created a solrcore.properties in <solr.home>/conf/solrcore.properties.
I created a symlink in my core/conf to the solrcore.properties file, but I can't read the properties.
My properties file:
username=myusername
password=mypassword
My data-import.xml:
<dataSource
type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://${host}:3306/projectX"
user="${username}"
password="${password}" />
Is the syntax correct?
Best regards,
Dariusz
On Thu, Jan 10, 2013 at 3:21 PM, Alexandre Rafalovitch
<ar...@gmail.com>wrote:
> dataimport.properties is for DIH to store it's own properties for
> delta processing and things. Try solrcore.properties instead, as per
> recent
> discussion:
>
> http://lucene.472066.n3.nabble.com/Reading-database-connection-propert
> ies-from-external-file-td4031154.html
>
> Regards,
> Alex.
>
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all
> at once. Lately, it doesn't seem to be working. (Anonymous - via GTD
> book)
>
>
> On Thu, Jan 10, 2013 at 3:58 AM, Dariusz Borowski <dariusz.b@gmail.com
> >wrote:
>
> > I'm having a problem using a property file in my data-import.xml file.
> >
> > My aim is to not hard code some values inside my xml file, but
> > rather reusing the values from a property file. I'm using multicore
> > and some of the values are being changed from time to time and I do
> > not want to
> change
> > them in all my data-import files.
> >
> > For example:
> >
> > <dataSource
> > type="JdbcDataSource"
> > driver="com.mysql.jdbc.Driver"
> > url="jdbc:mysql://${host}:3306/projectX"
> > user="${username}"
> > password="${password}" />
> >
> > I tried everything, but don't know how I can use proporties here. I
> > tried to put my values in dataimport.properties, located under "SOLR-HOME/conf"
> > and under "SOLR-HOME/core1/conf", but without any success.
> >
> > Please, could someone help me on this?
> >
>
Re: Reading properties in data-import.xml
Posted by Dariusz Borowski <da...@gmail.com>.
Thanks Alexandre!
I followed your example and created a solrcore.properties in
<solr.home>/conf/solrcore.properties.
I created a symlink in my core/conf to the solrcore.properties file, but I
can't read the properties.
My properties file:
username=myusername
password=mypassword
My data-import.xml:
<dataSource
type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://${host}:3306/projectX"
user="${username}"
password="${password}" />
Is the syntax correct?
Best regards,
Dariusz
On Thu, Jan 10, 2013 at 3:21 PM, Alexandre Rafalovitch
<ar...@gmail.com>wrote:
> dataimport.properties is for DIH to store it's own properties for delta
> processing and things. Try solrcore.properties instead, as per recent
> discussion:
>
> http://lucene.472066.n3.nabble.com/Reading-database-connection-properties-from-external-file-td4031154.html
>
> Regards,
> Alex.
>
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all at
> once. Lately, it doesn't seem to be working. (Anonymous - via GTD book)
>
>
> On Thu, Jan 10, 2013 at 3:58 AM, Dariusz Borowski <dariusz.b@gmail.com
> >wrote:
>
> > I'm having a problem using a property file in my data-import.xml file.
> >
> > My aim is to not hard code some values inside my xml file, but rather
> > reusing the values from a property file. I'm using multicore and some of
> > the values are being changed from time to time and I do not want to
> change
> > them in all my data-import files.
> >
> > For example:
> >
> > <dataSource
> > type="JdbcDataSource"
> > driver="com.mysql.jdbc.Driver"
> > url="jdbc:mysql://${host}:3306/projectX"
> > user="${username}"
> > password="${password}" />
> >
> > I tried everything, but don't know how I can use proporties here. I tried
> > to put my values in dataimport.properties, located under "SOLR-HOME/conf"
> > and under "SOLR-HOME/core1/conf", but without any success.
> >
> > Please, could someone help me on this?
> >
>
Re: Reading properties in data-import.xml
Posted by Alexandre Rafalovitch <ar...@gmail.com>.
dataimport.properties is for DIH to store it's own properties for delta
processing and things. Try solrcore.properties instead, as per recent
discussion:
http://lucene.472066.n3.nabble.com/Reading-database-connection-properties-from-external-file-td4031154.html
Regards,
Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at
once. Lately, it doesn't seem to be working. (Anonymous - via GTD book)
On Thu, Jan 10, 2013 at 3:58 AM, Dariusz Borowski <da...@gmail.com>wrote:
> I'm having a problem using a property file in my data-import.xml file.
>
> My aim is to not hard code some values inside my xml file, but rather
> reusing the values from a property file. I'm using multicore and some of
> the values are being changed from time to time and I do not want to change
> them in all my data-import files.
>
> For example:
>
> <dataSource
> type="JdbcDataSource"
> driver="com.mysql.jdbc.Driver"
> url="jdbc:mysql://${host}:3306/projectX"
> user="${username}"
> password="${password}" />
>
> I tried everything, but don't know how I can use proporties here. I tried
> to put my values in dataimport.properties, located under "SOLR-HOME/conf"
> and under "SOLR-HOME/core1/conf", but without any success.
>
> Please, could someone help me on this?
>