1

こんにちは、私は HBase データベースを初めて使用します。いくつかの Twitter データをダウンロードして、MongoDB に保存しました。次に、Hadoop 処理を高速化するために、そのデータを HBase に変換する必要があります。しかし、私はそのスキームを作成することができません。ここでは、Twitter データを JSON 形式にしています。

{
"_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
}

データを列と列ファミリーに分割する方法は? (ユーザーのデータ)を含むものと"twitter" column-family含むものを作成することを考えました。つまり、内部レベルのサブドキュメントごとに新しい列ファミリーを作成します。source, getlocation, place, retweet etc..."user" column-familyname, location etc...

このアプローチは正しいですか?とをどのように区別urlentityしますか?"user" column-family"twitter" column-family

そして、サブドキュメントのリストを含むキーを処理する方法 (たとえばurlentity)

4

1 に答える 1

4

HBase でこれをモデル化するには、すべてを 1 つの列に格納する方法から、サブエンティティごとに異なるテーブルを作成し、「インデックス作成」用に他のいくつかのテーブルを使用する方法まで、さまざまな方法があります。

一般的に言えば、読み書きアクセス パターンに基づいて hbase のデータをモデル化します。たとえば、列ファミリーはディスク上の異なるファイルに格納されます。データを 2 つの列ファミリーに分割する理由は、一方のデータが必要で他方のデータが必要ない場合が多い場合です。等

HBaseCon 2012 の Ian Varley による HBAse スキーマ設計に関する優れたプレゼンテーションがあります。スライドはこちら、ビデオはこちらです。

于 2013-03-05T20:01:47.177 に答える