【问题标题】:Lily with Morphline and HBaseLily 与 Morphline 和 HBase
【发布时间】:2015-06-12 07:52:13
【问题描述】:

我正在尝试使用 Cloudera 的教程。 (http://www.cloudera.com/content/cloudera/en/documentation/core/latest/topics/search_hbase_batch_indexer.html)

我有一个代码可以在 HBase 中插入 Avro 格式的对象,我想将它们插入到 Solr,但我什么也没得到。

我一直在查看日志:

15/06/12 00:45:00 TRACE morphline.ExtractHBaseCellsBuilder$ExtractHBaseCells: beforeNotify: {lifecycle=[START_SESSION]}
15/06/12 00:45:00 TRACE morphline.ExtractHBaseCellsBuilder$ExtractHBaseCells: beforeProcess: {_attachment_body=[keyvalues={0Name178721/data:avroUser/1434094131495/Put/vlen=237/seqid=0}], _attachment_mimetype=[application/java-hbase-result]}
15/06/12 00:45:00 DEBUG indexer.Indexer$RowBasedIndexer: Indexer _default_ will send to Solr 0 adds and 0 deletes
15/06/12 00:45:00 TRACE morphline.ExtractHBaseCellsBuilder$ExtractHBaseCells: beforeNotify: {lifecycle=[START_SESSION]}
15/06/12 00:45:00 TRACE morphline.ExtractHBaseCellsBuilder$ExtractHBaseCells: beforeProcess: {_attachment_body=[keyvalues={1Name134339/data:avroUser/1434094131495/Put/vlen=237/seqid=0}], _attachment_mimetype=[application/java-hbase-result]}

所以,我正在阅读它们,但我不知道为什么它没有在 Solr 中为任何内容编制索引。 我想我的 morphline.conf 是错误的。

morphlines : [
{
    id : morphline1
    importCommands : ["org.kitesdk.**", "org.apache.solr.**", "com.ngdata.**"]
    commands : [
      {
         extractHBaseCells {
          mappings : [
            {
             inputColumn : "data:avroUser"
              outputField : "_attachment_body"
              type : "byte[]"
              source : value
            }
         ]
        }
      }

      #for avro use with type : "byte[]" in extractHBaseCells mapping above
      { readAvroContainer {} }
      {
        extractAvroPaths {
          flatten : true
          paths : {
            name : /name
          }
        }
      }
      { logTrace { format : "output record: {}", args : ["@{}"] } }
    ]
 }
]

我不确定我是否必须在 Solr 中有一个“_attachment_body”字段,但似乎没有必要,所以我猜 readAvroContainer 或 extractAvroPaths 是错误的。 我在 Solr 中有一个“名称”字段,我的 avroUser 也有一个“名称”字段。

{"namespace": "example.avro",
 "type": "record",
 "name": "User",
 "fields": [
     {"name": "name", "type": "string"},
     {"name": "favorite_number",  "type": ["int", "null"]},
     {"name": "favorite_color", "type": ["string", "null"]}
 ]
}

【问题讨论】:

    标签: solr hbase avro


    【解决方案1】:

    我所有的东西都在这里运作良好。 我做了这个步骤:

    1) 将 hbase-solr-indexer 安装为服务: 首先你必须安装 hbase-solr-indexer。 installing hbase-solr-indexing as a service

    为此将 cloudera 存储库添加到 yum 存储库。 在那个类型之后:

    sudo yum  install hbase-solr-indexer
    

    2) 创建吗啉文件: 好的,你做到了。

    2) 为每个列族设置 Replication 范围并注册一个 hbase-indexer 配置

    Using the Lily HBase NRT Indexer Service

    $ hbase shell
    hbase shell> disable 'record'
    hbase shell> alter 'record', {NAME => 'data', REPLICATION_SCOPE => 1}
    hbase shell> enable 'record'
    

    尝试按照上面的其他教程进行操作。 ;) 我在使用 NRT 解决方案时遇到了问题,但是当我一步一步按照所有教程进行操作时,它起作用了。

    我希望这对某人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-08
      相关资源
      最近更新 更多