Hbase Solr 二级索引,更新数据部分字段丢失问题
?
問題:
第一次往hbase put數據,索引同步三個字段,第二次更新hbase數據,只更新一個字段,其他兩個字段會消失。
?
原因:
在創建Hbase Indexer 時我們配置文件指定了??read-row="never"?
?
$ cat morphline-hbase-mapper.xml <?xml version="1.0"?> <!-- table:需要索引的HBase表名稱--> <!-- mapper:用來實現和讀取指定的Morphline配置文件類,固定為MorphlineResultToSolrMapper--> <indexer table="tableName" mapper="com.ngdata.hbaseindexer.morphline.MorphlineResultToSolrMapper" read-row="never" > <!--param中的name參數用來指定當前配置為morphlineFile文件 --> <!--value用來指定morphlines.conf文件的路徑,絕對或者相對路徑用來指定本地路徑,如果是使用Cloudera Manager來管理morphlines.conf就直接寫入值morphlines.conf"--><param name="morphlineFile" value="morphlines.conf"/> <!--value="ZDTableMap",這里test3Map是自定義,接下來要使用。其他的mapper,param name等屬性默認即可--><param name="morphlineId" value="TableMap"/> </indexer>?
修改為?read-row="dynamic"? ,再次測試,發現不會丟失字段
?
read-row 說明:https://github.com/NGDATA/hbase-indexer/wiki/Indexer-configuration#read-row
read-row
The read-row attribute has two possible values: dynamic, or never.
This attribute is only important when using row-based indexing. It specifies whether or not the indexer should re-read data from HBase in order to perform indexing.
When set to "dynamic", the indexer will read the necessary data from a row if a partial update to the row is performed in HBase. In dynamic mode, the row will not be re-read if all data needed to perform indexing is included in the row update.
If this attribute is set to never, a row will never be re-read by the indexer.
The default setting is "dynamic".
?
?
?但可能會遇到以下問題,使用前需要充分的測試
?
HBase Indexer導致Solr與HBase數據不一致問題解決:
https://blog.csdn.net/d6619309/article/details/51579594
?
?
總結
以上是生活随笔為你收集整理的Hbase Solr 二级索引,更新数据部分字段丢失问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: cudaMemcpyToSymbol使用
- 下一篇: Linux面试相关