solr6.6教程-從mysql資料庫中匯入資料(三)

來源:互聯網
上載者:User

標籤:search   roo   pre   統一   jdbc   blog   url   arc   format   

整理多半天的solr6.6,終於算是把solr6.6中設定資料庫弄出來了,網上的文章千篇一律,各說個的,沒有一篇統一覆蓋solr6.6版本配置的 文章,本章節我會把配置的一些注意事項一一列舉,由於時間原因,本片只介紹如何一次性匯入資料,不附帶增量匯入,想看增量的同學可以在後面的文章中。

1,配置準備

本文的前提是你已經配置好了solr,並新建立了一個core,我們下面都會按照前一篇文章中的core_demo為基礎開始

2,修改soreconfig.xml

在soreconfig.xml的<requestHandler name="/select" class="solr.SearchHandler">上面添加如下代碼:

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

注意:需要確認檔案中不存在其他的dataimport,如果存在直接替換即可

在同級目錄下建立data-config.xml檔案,然後設定資料庫相關屬性

 

<?xml version="1.0" encoding="UTF-8"?>  <dataConfig>    <dataSource name="source1" type="JdbcDataSource"              driver="com.mysql.jdbc.Driver"              url="jdbc:mysql://127.0.0.1:3306/ecejcallcenter"              user="root"              password="123456" />    <document>        <entity name="cc_bill" dataSource="source1" pk="bill_id"             query="SELECT cc_bill.bill_id,cc_bill.`name`,cc_bill.address,cc_bill.city_name,cc_bill.create_time FROM cc_bill"><field column=‘bill_id‘ name=‘billid‘ /><field column=‘name‘ name=‘name‘ /><field column=‘address‘ name=‘address‘ /><field column=‘city_name‘ name=‘cityname‘ /><field column=‘create_time‘ name=‘createtime‘ dateTimeFormat=‘yyyy-MM-dd HH:mm:ss‘ />        </entity>    </document></dataConfig>

 

  關於詳細的配置請參照:http://blog.csdn.net/boolbo/article/details/50352331

 

solr6.6教程-從mysql資料庫中匯入資料(三)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.