dataimport handler multiple databases

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

dataimport handler multiple databases

Ismail Siddiqui
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
Reply | Threaded
Open this post in threaded view
|

Re: dataimport handler multiple databases

Noble Paul നോബിള്‍  नोब्ळ्
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 <[hidden email]> 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