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 Ismail Siddiqui <is...@gmail.com> on 2008/04/02 22:24:03 UTC

dataimport handler multiple databases

Hi I have a situaion where I am using dataimport handler with development db
and  going to use it with production database in production environment

I have entry in solr-config.xml like this

<requestHandler name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
      <str name="config">/home/username/data-config.xml</str>
      <lst name="datasource">
         <str name="driver">com.mysql.jdbc.Driver</str>
         <str name="url">jdbc:mysql://localhost/dbname</str>
         <str name="user">db_username</str>
         <str name="password">db_password</str>
      </lst>
    </lst>
  </requestHandler>

I understand i can add  another datasource called datasource-2 . but how can
I can use this datasource to index data

currently i am colling somethign  /dataimport?command=full-import or
/dataimport?command=delta-import.    How can i define a particular db to be
called
so it indexes dev db on development machine and prod db in production
environmnt.


thanks

Re: dataimport handler multiple databases

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
each entity has an optional attribute called dataSource.
If you have multiple dataSources give them a name and use the name is
dataSource .So you solrconfig must look like
<requestHandler name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">
   <lst name="defaults">
     <str name="config">/home/username/data-config.xml</str>
     <lst name="datasource">
        <str name="name">datasource-1</str>
        <str name="driver">com.mysql.jdbc.Driver</str>
    ....
     </lst>
  <lst name="datasource">
        <str name="name">datasource-2</str>
        <str name="driver">com.mysql.jdbc.Driver</str>
....
     </lst>
   </lst>
 </requestHandler>

and each entity can have its dataSource attribute refer to something
eg:
<entity name="one" dataSource="datasource-1" ..>
</entity>

<entity name="two" dataSource="datasource-2" ..>
</entity>

But as I see you have a usecase where prod and qa uses different dbs. But

So betweenprod and qa us can change the solrconfig xml
--Noble

On undefined, Ismail Siddiqui <is...@gmail.com> wrote:
> Hi I have a situaion where I am using dataimport handler with development db
>  and  going to use it with production database in production environment
>
>  I have entry in solr-config.xml like this
>
>  <requestHandler name="/dataimport"
>  class="org.apache.solr.handler.dataimport.DataImportHandler">
>     <lst name="defaults">
>       <str name="config">/home/username/data-config.xml</str>
>       <lst name="datasource">
>          <str name="driver">com.mysql.jdbc.Driver</str>
>          <str name="url">jdbc:mysql://localhost/dbname</str>
>          <str name="user">db_username</str>
>          <str name="password">db_password</str>
>       </lst>
>     </lst>
>   </requestHandler>
>
>  I understand i can add  another datasource called datasource-2 . but how can
>  I can use this datasource to index data
>
>  currently i am colling somethign  /dataimport?command=full-import or
>  /dataimport?command=delta-import.    How can i define a particular db to be
>  called
>  so it indexes dev db on development machine and prod db in production
>  environmnt.
>
>
>  thanks
>



-- 
--Noble Paul