Configure DataImportHandler in SolrCloud with ZooKeeper

I have a SolrCloud configured like this: exploration of SolrCloud, the difference is that I use Solr 4.0.0 Beta. Shortly the configuration:

  • ZooKeeper on default port 2181
  • 3 instances of Solr running on different ports
  • This is just for testing purpose. The desired configuration is with 3 ZooKeeper instances (one for every Solr instance). I manage to index some XML files with curl command.

    Questions:

  • How can I configure DIH/collection? I managed to change the solrconfig.xml (config for dataimport-handler), add in lib the proper driver for DB connection, but in solr admin I get "sorry, no dataimport-handler defined!" The changes can be watched in zookeeper (I see the data_config.xml) and in solr admin panel I can see the updated version of solrconfig.xml.

  • Any good tutorial for a production deploy of solrcloud (with somthink like the desired configuration mentioned before) on single or multiple machine for Ubuntu 12.04 LTS?

  • Any advice would be appreciated! Thanks in advance!


    Normally DIH config has nothing to do with wether you're using a single Solr instance or multiple instances in a solrCloud config. DIH will write data in the current instance's Lucene index, and then it's up to zooKeeper to speread it around on the other instances.

    Make sure your DIH is propertly configured:

    In solrconfig.xml, all necessary libraries are loaded. This means the two DIH jars:

    <lib dir="../../../dist/" regex="solr-dataimporthandler-4.3.0.jar" />
    <lib dir="../../../dist/" regex="solr-dataimporthandler-extras-4.3.0.jar" />
    

    as well as others jars you may need (like Database JDBC driver, etc).

    Still in solrconfig.xml make sure the DIH handler is declared, something like this:

    <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
        <lst name="defaults">
            <str name="config">data-config.xml</str>
        </lst>
    </requestHandler>
    

    Finally, the config file you declared in the DIH handler (data-config.xml) should be in the same "conf" dir as solrconfig.xml and should have proper content, something like:

    <dataConfig>
    
    <dataSource type="JdbcDataSource" name="myDataSource" driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@someHost:1521:someDb" user="someUser" password="somePassword" batchSize="5000"/>  
    
    <document name="myDoc" >
        <entity name="myDoc" dataSource="myDatasource" transformer="my.custom.Transformer" query="select col1, col2, col3 from table1 where whatever" />
    </document>
    
    </dataConfig>
    
    链接地址: http://www.djcxy.com/p/63312.html

    上一篇: 圆形按钮

    下一篇: 使用ZooKeeper在SolrCloud中配置DataImportHandler