首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >从MongoDB迁移到HBase

从MongoDB迁移到HBase
EN

Stack Overflow用户
提问于 2013-03-05 16:06:18
回答 1查看 2.4K关注 0票数 1

嗨,我是HBase数据库的新手。我下载了一些推特数据并存储到MongoDB中。现在,我需要将这些数据转换为HBase,以加速Hadoop处理。但是我不能创建它的方案。这里我将twitter数据转换为JSON格式-

代码语言:javascript
运行
复制
{
"_id" : ObjectId("512b71e6e4b02a4322d1c0b0"),
"id" : NumberLong("306044618179506176"),
"source" : "<a href=\"http://www.facebook.com/twitter\" rel=\"nofollow\">Facebook</a>",
"user" : {
    "name" : "Dada Bhagwan",
    "location" : "India",
    "url" : "http://www.dadabhagwan.org",
    "id" : 191724440,
    "protected" : false,
    "timeZone" : null,
    "description" : "Founder of Akram Vignan - Practical Spiritual Science of Self Realization",
    "screenName" : "dadabhagwan",
    "geoEnabled" : false,
    "profileImageURL" : "http://a0.twimg.com/profile_images/1647956820/M_DSC_0034_normal.jpg",
    "biggerProfileImageURL" : "http://a0.twimg.com/profile_images/1647956820/M_DSC_0034_bigger.jpg",
    "profileImageUrlHttps" : "https://si0.twimg.com/profile_images/1647956820/M_DSC_0034_normal.jpg",
    "profileImageURLHttps" : "https://si0.twimg.com/profile_images/1647956820/M_DSC_0034_normal.jpg",
    "biggerProfileImageURLHttps" : "https://si0.twimg.com/profile_images/1647956820/M_DSC_0034_bigger.jpg",
    "miniProfileImageURLHttps" : "https://si0.twimg.com/profile_images/1647956820/M_DSC_0034_mini.jpg",
    "originalProfileImageURLHttps" : "https://si0.twimg.com/profile_images/1647956820/M_DSC_0034.jpg",
    "followersCount" : 499,
    "profileBackgroundColor" : "EEE4C1",
    "profileTextColor" : "333333",
    "profileLinkColor" : "990000",
    "lang" : "en",
    "profileSidebarFillColor" : "FCF9EC",
    "profileSidebarBorderColor" : "CBC09A",
    "profileUseBackgroundImage" : true,
    "showAllInlineMedia" : false,
    "friendsCount" : 1,
    "favouritesCount" : 0,
    "profileBackgroundImageUrl" : "http://a0.twimg.com/profile_background_images/396759326/dadabhagwan-twitter.jpg",
    "profileBackgroundImageURL" : "http://a0.twimg.com/profile_background_images/396759326/dadabhagwan-twitter.jpg",
    "profileBackgroundImageUrlHttps" : "https://si0.twimg.com/profile_background_images/396759326/dadabhagwan-twitter.jpg",
    "profileBannerURL" : null,
    "profileBannerRetinaURL" : null,
    "profileBannerIPadURL" : null,
    "profileBannerIPadRetinaURL" : null,
    "miniProfileImageURL" : "http://a0.twimg.com/profile_images/1647956820/M_DSC_0034_mini.jpg",
    "originalProfileImageURL" : "http://a0.twimg.com/profile_images/1647956820/M_DSC_0034.jpg",
    "utcOffset" : -1,
    "contributorsEnabled" : false,
    "status" : null,
    "createdAt" : NumberLong("1284700143000"),
    "profileBannerMobileURL" : null,
    "profileBannerMobileRetinaURL" : null,
    "profileBackgroundTiled" : false,
    "statusesCount" : 1713,
    "verified" : false,
    "translator" : false,
    "listedCount" : 6,
    "followRequestSent" : false,
    "descriptionURLEntities" : [ ],
    "urlentity" : {
        "url" : "http://www.dadabhagwan.org",
        "start" : 0,
        "end" : 26,
        "expandedURL" : "http://www.dadabhagwan.org",
        "displayURL" : "http://www.dadabhagwan.org"
    },
    "rateLimitStatus" : null,
    "accessLevel" : 0
},
"contributors" : [ ],
"geoLocation" : null,
"place" : null,
"favorited" : false,
"retweet" : false,
"retweetedStatus" : null,
"retweetCount" : 0,
"userMentionEntities" : [ ],
"retweetedByMe" : false,
"currentUserRetweetId" : -1,
"possiblySensitive" : false,
"urlentities" : [
    {
        "url" : "http://t.co/gR1GohGjaj",
        "start" : 113,
        "end" : 135,
        "expandedURL" : "http://fb.me/2j2HKHJrM",
        "displayURL" : "fb.me/2j2HKHJrM"
    }
],
"hashtagEntities" : [ ],
"mediaEntities" : [ ],
"truncated" : false,
"inReplyToStatusId" : -1,
"text" : "Spiritual Quote of the Day :\n\n‘I am Chandubhai’ is an illusion itself and from that are \nkarmas charged. When... http://t.co/gR1GohGjaj",
"inReplyToUserId" : -1,
"inReplyToScreenName" : null,
"createdAt" : NumberLong("1361801697000"),
"rateLimitStatus" : null,
"accessLevel" : 0
}

这里如何将数据划分为列和列族?我想做一个包含source, getlocation, place, retweet etc..."twitter" column-family和另一个包含name, location etc... (用户数据)的"user" column-family。即每个内部层子文档的新列族。

这种方法是正确的吗?现在,我将如何区分适用于"user" column-family"twitter" column-familyurlentity

以及如何处理那些包含子文档列表的键(例如urlentity)

EN

回答 1

Stack Overflow用户

发布于 2013-03-06 04:01:47

有许多方法可以在HBase中对此进行建模,从将所有内容存储在单个列中,到为每个子实体使用不同的表以及其他几个表进行“索引”。

一般来说,您可以根据读写访问模式在hbase中对数据进行建模。例如,列族存储在磁盘上的不同文件中。将数据分成两个列族的原因是,在很多情况下,您需要一个列族的数据,而不是另一个列族的数据。等。

来自HBaseCon 2012的Ian Varley有一个关于HBAse模式设计的很好的演示文稿,您可以找到幻灯片here和视频here

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15218672

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档