{"id":30499,"date":"2022-12-20T09:17:17","date_gmt":"2022-12-20T01:17:17","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=30499"},"modified":"2022-12-20T09:17:37","modified_gmt":"2022-12-20T01:17:37","slug":"hadoop-hbase-deploy-use","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/hadoop-hbase-deploy-use.html","title":{"rendered":"Hadoop\u96c6\u7fa4\u4e2dHbase\u7684\u4ecb\u7ecd\u3001\u5b89\u88c5\u3001\u4f7f\u7528"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nHBase \u2013 Hadoop Database\uff0c\u662f\u4e00\u4e2a\u9ad8\u53ef\u9760\u6027\u3001\u9ad8\u6027\u80fd\u3001\u9762\u5411\u5217\u3001\u53ef\u4f38\u7f29\u7684\u5206\u5e03\u5f0f\u5b58\u50a8\u7cfb\u7edf\uff0c\u5229\u7528HBase\u6280\u672f\u53ef\u5728\u5ec9\u4ef7PC Server\u4e0a\u642d\u5efa\u8d77\u5927\u89c4\u6a21\u7ed3\u6784\u5316\u5b58\u50a8\u96c6\u7fa4\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4e00\u3001Hbase\u7b80\u4ecb<\/strong><\/div>\n

HBase\u662fGoogle Bigtable\u7684\u5f00\u6e90\u5b9e\u73b0\uff0c\u7c7b\u4f3cGoogle Bigtable\u5229\u7528GFS\u4f5c\u4e3a\u5176\u6587\u4ef6\u5b58\u50a8\u7cfb\u7edf\uff0cHBase\u5229\u7528Hadoop HDFS\u4f5c\u4e3a\u5176\u6587\u4ef6\u5b58\u50a8\u7cfb\u7edf\uff1bGoogle\u8fd0\u884cMapReduce\u6765\u5904\u7406Bigtable\u4e2d\u7684\u6d77\u91cf\u6570\u636e\uff0cHBase\u540c\u6837\u5229\u7528Hadoop MapReduce\u6765\u5904\u7406HBase\u4e2d\u7684\u6d77\u91cf\u6570\u636e\uff1bGoogle Bigtable\u5229\u7528Chubby\u4f5c\u4e3a\u534f\u540c\u670d\u52a1\uff0cHBase\u5229\u7528Zookeeper\u4f5c\u4e3a\u5bf9\u5e94\u3002
\n\"9-11-01\"<\/p>\n

\u4e0a\u56fe\u63cf\u8ff0\u4e86Hadoop EcoSystem\u4e2d\u7684\u5404\u5c42\u7cfb\u7edf\uff0c\u5176\u4e2dHBase\u4f4d\u4e8e\u7ed3\u6784\u5316\u5b58\u50a8\u5c42\uff0cHadoop HDFS\u4e3aHBase\u63d0\u4f9b\u4e86\u9ad8\u53ef\u9760\u6027\u7684\u5e95\u5c42\u5b58\u50a8\u652f\u6301\uff0cHadoop MapReduce\u4e3aHBase\u63d0\u4f9b\u4e86\u9ad8\u6027\u80fd\u7684\u8ba1\u7b97\u80fd\u529b\uff0cZookeeper\u4e3aHBase\u63d0\u4f9b\u4e86\u7a33\u5b9a\u670d\u52a1\u548cfailover\u673a\u5236\u3002<\/p>\n

\u6b64\u5916\uff0cPig\u548cHive\u8fd8\u4e3aHBase\u63d0\u4f9b\u4e86\u9ad8\u5c42\u8bed\u8a00\u652f\u6301\uff0c\u4f7f\u5f97\u5728HBase\u4e0a\u8fdb\u884c\u6570\u636e\u7edf\u8ba1\u5904\u7406\u53d8\u7684\u975e\u5e38\u7b80\u5355\u3002 Sqoop\u5219\u4e3aHBase\u63d0\u4f9b\u4e86\u65b9\u4fbf\u7684RDBMS\u6570\u636e\u5bfc\u5165\u529f\u80fd\uff0c\u4f7f\u5f97\u4f20\u7edf\u6570\u636e\u5e93\u6570\u636e\u5411HBase\u4e2d\u8fc1\u79fb\u53d8\u7684\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n

HBase\u8bbf\u95ee\u63a5\u53e3<\/strong><\/span><\/div>\n
    \n
  1. Native Java API\uff0c\u6700\u5e38\u89c4\u548c\u9ad8\u6548\u7684\u8bbf\u95ee\u65b9\u5f0f\uff0c\u9002\u5408Hadoop MapReduce Job\u5e76\u884c\u6279\u5904\u7406HBase\u8868\u6570\u636e<\/li>\n
  2. HBase Shell\uff0cHBase\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u6700\u7b80\u5355\u7684\u63a5\u53e3\uff0c\u9002\u5408HBase\u7ba1\u7406\u4f7f\u7528<\/li>\n
  3. Thrift Gateway\uff0c\u5229\u7528Thrift\u5e8f\u5217\u5316\u6280\u672f\uff0c\u652f\u6301C++\uff0cPHP\uff0cPython\u7b49\u591a\u79cd\u8bed\u8a00\uff0c\u9002\u5408\u5176\u4ed6\u5f02\u6784\u7cfb\u7edf\u5728\u7ebf\u8bbf\u95eeHBase\u8868\u6570\u636e<\/li>\n
  4. REST Gateway\uff0c\u652f\u6301REST \u98ce\u683c\u7684Http API\u8bbf\u95eeHBase, \u89e3\u9664\u4e86\u8bed\u8a00\u9650\u5236<\/li>\n
  5. Pig\uff0c\u53ef\u4ee5\u4f7f\u7528Pig Latin\u6d41\u5f0f\u7f16\u7a0b\u8bed\u8a00\u6765\u64cd\u4f5cHBase\u4e2d\u7684\u6570\u636e\uff0c\u548cHive\u7c7b\u4f3c\uff0c\u672c\u8d28\u6700\u7ec8\u4e5f\u662f\u7f16\u8bd1\u6210MapReduce Job\u6765\u5904\u7406HBase\u8868\u6570\u636e\uff0c\u9002\u5408\u505a\u6570\u636e\u7edf\u8ba1<\/li>\n
  6. Hive\uff0c\u5f53\u524dHive\u7684Release\u7248\u672c\u5c1a\u6ca1\u6709\u52a0\u5165\u5bf9HBase\u7684\u652f\u6301\uff0c\u4f46\u5728\u4e0b\u4e00\u4e2a\u7248\u672cHive 0.7.0\u4e2d\u5c06\u4f1a\u652f\u6301HBase\uff0c\u53ef\u4ee5\u4f7f\u7528\u7c7b\u4f3cSQL\u8bed\u8a00\u6765\u8bbf\u95eeHBase<\/li>\n<\/ol>\n
    HBase\u6570\u636e\u6a21\u578b<\/strong><\/span><\/div>\n

    1\u3001Table & Column Family<\/strong><\/span>
    \n\"qq%e5%9b%be%e7%89%8720160911164243\"<\/p>\n

    \u00d8\u00a0 Row Key: \u884c\u952e\uff0cTable\u7684\u4e3b\u952e\uff0cTable\u4e2d\u7684\u8bb0\u5f55\u6309\u7167Row Key\u6392\u5e8f<\/p>\n

    \u00d8\u00a0 Timestamp: \u65f6\u95f4\u6233\uff0c\u6bcf\u6b21\u6570\u636e\u64cd\u4f5c\u5bf9\u5e94\u7684\u65f6\u95f4\u6233\uff0c\u53ef\u4ee5\u770b\u4f5c\u662f\u6570\u636e\u7684version number<\/p>\n

    \u00d8\u00a0 Column Family\uff1a\u5217\u7c07\uff0cTable\u5728\u6c34\u5e73\u65b9\u5411\u6709\u4e00\u4e2a\u6216\u8005\u591a\u4e2aColumn Family\u7ec4\u6210\uff0c\u4e00\u4e2aColumn Family\u4e2d\u53ef\u4ee5\u7531\u4efb\u610f\u591a\u4e2aColumn\u7ec4\u6210\uff0c\u5373Column Family\u652f\u6301\u52a8\u6001\u6269\u5c55\uff0c\u65e0\u9700\u9884\u5148\u5b9a\u4e49Column\u7684\u6570\u91cf\u4ee5\u53ca\u7c7b\u578b\uff0c\u6240\u6709Column\u5747\u4ee5\u4e8c\u8fdb\u5236\u683c\u5f0f\u5b58\u50a8\uff0c\u7528\u6237\u9700\u8981\u81ea\u884c\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\u3002<\/p>\n

    2\u3001Table & Region<\/strong><\/span><\/p>\n

    \u5f53Table\u968f\u7740\u8bb0\u5f55\u6570\u4e0d\u65ad\u589e\u52a0\u800c\u53d8\u5927\u540e\uff0c\u4f1a\u9010\u6e10\u5206\u88c2\u6210\u591a\u4efdsplits\uff0c\u6210\u4e3aregions\uff0c\u4e00\u4e2aregion\u7531[startkey,endkey)\u8868\u793a\uff0c\u4e0d\u540c\u7684region\u4f1a\u88abMaster\u5206\u914d\u7ed9\u76f8\u5e94\u7684RegionServer\u8fdb\u884c\u7ba1\u7406\uff1a<\/p>\n

    3\u3001-ROOT- && .META. Table<\/strong><\/span>
    \n\"9-11-02\"<\/p>\n

    HBase\u4e2d\u6709\u4e24\u5f20\u7279\u6b8a\u7684Table\uff0c-ROOT-\u548c.META.<\/p>\n

    \u00d8\u00a0 .META.\uff1a\u8bb0\u5f55\u4e86\u7528\u6237\u8868\u7684Region\u4fe1\u606f\uff0c.META.\u53ef\u4ee5\u6709\u591a\u4e2aregoin<\/p>\n

    \u00d8\u00a0 -ROOT-\uff1a\u8bb0\u5f55\u4e86.META.\u8868\u7684Region\u4fe1\u606f\uff0c-ROOT-\u53ea\u6709\u4e00\u4e2aregion<\/p>\n

    \u00d8\u00a0 Zookeeper\u4e2d\u8bb0\u5f55\u4e86-ROOT-\u8868\u7684location
    \n\"9-11-03\"<\/p>\n

    Client\u8bbf\u95ee\u7528\u6237\u6570\u636e\u4e4b\u524d\u9700\u8981\u9996\u5148\u8bbf\u95eezookeeper\uff0c\u7136\u540e\u8bbf\u95ee-ROOT-\u8868\uff0c\u63a5\u7740\u8bbf\u95ee.META.\u8868\uff0c\u6700\u540e\u624d\u80fd\u627e\u5230\u7528\u6237\u6570\u636e\u7684\u4f4d\u7f6e\u53bb\u8bbf\u95ee\uff0c\u4e2d\u95f4\u9700\u8981\u591a\u6b21\u7f51\u7edc\u64cd\u4f5c\uff0c\u4e0d\u8fc7client\u7aef\u4f1a\u505acache\u7f13\u5b58\u3002<\/p>\n

    MapReduce on HBase<\/strong><\/span><\/div>\n

    \u5728HBase\u7cfb\u7edf\u4e0a\u8fd0\u884c\u6279\u5904\u7406\u8fd0\u7b97\uff0c\u6700\u65b9\u4fbf\u548c\u5b9e\u7528\u7684\u6a21\u578b\u4f9d\u7136\u662fMapReduce\uff0c\u5982\u4e0b\u56fe\uff1a
    \n\"9-11-04\"<\/p>\n

    HBase Table\u548cRegion\u7684\u5173\u7cfb\uff0c\u6bd4\u8f83\u7c7b\u4f3cHDFS File\u548cBlock\u7684\u5173\u7cfb\uff0cHBase\u63d0\u4f9b\u4e86\u914d\u5957\u7684TableInputFormat\u548cTableOutputFormat API\uff0c\u53ef\u4ee5\u65b9\u4fbf\u7684\u5c06HBase Table\u4f5c\u4e3aHadoop MapReduce\u7684Source\u548cSink\uff0c\u5bf9\u4e8eMapReduce Job\u5e94\u7528\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u57fa\u672c\u4e0d\u9700\u8981\u5173\u6ce8HBase\u7cfb\u7edf\u81ea\u8eab\u7684\u7ec6\u8282\u3002<\/p>\n

    \u4e8c\u3001HBase\u7cfb\u7edf\u67b6\u6784<\/strong><\/div>\n

    \"9-11-05\"<\/p>\n

    Client<\/strong><\/span><\/div>\n

    HBase Client\u4f7f\u7528HBase\u7684RPC\u673a\u5236\u4e0eHMaster\u548cHRegionServer\u8fdb\u884c\u901a\u4fe1\uff0c\u5bf9\u4e8e\u7ba1\u7406\u7c7b\u64cd\u4f5c\uff0cClient\u4e0eHMaster\u8fdb\u884cRPC\uff1b\u5bf9\u4e8e\u6570\u636e\u8bfb\u5199\u7c7b\u64cd\u4f5c\uff0cClient\u4e0eHRegionServer\u8fdb\u884cRPC<\/p>\n

    Zookeeper<\/strong><\/span><\/div>\n

    Zookeeper Quorum\u4e2d\u9664\u4e86\u5b58\u50a8\u4e86-ROOT-\u8868\u7684\u5730\u5740\u548cHMaster\u7684\u5730\u5740\uff0cHRegionServer\u4e5f\u4f1a\u628a\u81ea\u5df1\u4ee5Ephemeral\u65b9\u5f0f\u6ce8\u518c\u5230 Zookeeper\u4e2d\uff0c\u4f7f\u5f97HMaster\u53ef\u4ee5\u968f\u65f6\u611f\u77e5\u5230\u5404\u4e2aHRegionServer\u7684\u5065\u5eb7\u72b6\u6001\u3002\u6b64\u5916\uff0cZookeeper\u4e5f\u907f\u514d\u4e86HMaster\u7684 \u5355\u70b9\u95ee\u9898\uff0c\u89c1\u4e0b\u6587\u63cf\u8ff0<\/p>\n

    HMaster<\/strong><\/span><\/div>\n

    HMaster\u6ca1\u6709\u5355\u70b9\u95ee\u9898\uff0cHBase\u4e2d\u53ef\u4ee5\u542f\u52a8\u591a\u4e2aHMaster\uff0c\u901a\u8fc7Zookeeper\u7684Master Election\u673a\u5236\u4fdd\u8bc1\u603b\u6709\u4e00\u4e2aMaster\u8fd0\u884c\uff0cHMaster\u5728\u529f\u80fd\u4e0a\u4e3b\u8981\u8d1f\u8d23Table\u548cRegion\u7684\u7ba1\u7406\u5de5\u4f5c\uff1a<\/p>\n

      \n
    1. \u7ba1\u7406\u7528\u6237\u5bf9Table\u7684\u589e\u3001\u5220\u3001\u6539\u3001\u67e5\u64cd\u4f5c<\/li>\n
    2. \u7ba1\u7406HRegionServer\u7684\u8d1f\u8f7d\u5747\u8861\uff0c\u8c03\u6574Region\u5206\u5e03<\/li>\n
    3. \u5728Region Split\u540e\uff0c\u8d1f\u8d23\u65b0Region\u7684\u5206\u914d<\/li>\n
    4. \u5728HRegionServer\u505c\u673a\u540e\uff0c\u8d1f\u8d23\u5931\u6548HRegionServer \u4e0a\u7684Regions\u8fc1\u79fb<\/li>\n<\/ol>\n
      HRegionServer<\/strong><\/span><\/div>\n

      HRegionServer\u4e3b\u8981\u8d1f\u8d23\u54cd\u5e94\u7528\u6237I\/O\u8bf7\u6c42\uff0c\u5411HDFS\u6587\u4ef6\u7cfb\u7edf\u4e2d\u8bfb\u5199\u6570\u636e\uff0c\u662fHBase\u4e2d\u6700\u6838\u5fc3\u7684\u6a21\u5757\u3002
      \n\"9-11-06\"<\/p>\n

      HRegionServer\u5185\u90e8\u7ba1\u7406\u4e86\u4e00\u7cfb\u5217HRegion\u5bf9\u8c61\uff0c\u6bcf\u4e2aHRegion\u5bf9\u5e94\u4e86Table\u4e2d\u7684\u4e00\u4e2aRegion\uff0cHRegion\u4e2d\u7531\u591a \u4e2aHStore\u7ec4\u6210\u3002\u6bcf\u4e2aHStore\u5bf9\u5e94\u4e86Table\u4e2d\u7684\u4e00\u4e2aColumn Family\u7684\u5b58\u50a8\uff0c\u53ef\u4ee5\u770b\u51fa\u6bcf\u4e2aColumn Family\u5176\u5b9e\u5c31\u662f\u4e00\u4e2a\u96c6\u4e2d\u7684\u5b58\u50a8\u5355\u5143\uff0c\u56e0\u6b64\u6700\u597d\u5c06\u5177\u5907\u5171\u540cIO\u7279\u6027\u7684column\u653e\u5728\u4e00\u4e2aColumn Family\u4e2d\uff0c\u8fd9\u6837\u6700\u9ad8\u6548\u3002<\/p>\n

      HStore\u5b58\u50a8\u662fHBase\u5b58\u50a8\u7684\u6838\u5fc3\u4e86\uff0c\u5176\u4e2d\u7531\u4e24\u90e8\u5206\u7ec4\u6210\uff0c\u4e00\u90e8\u5206\u662fMemStore\uff0c\u4e00\u90e8\u5206\u662fStoreFiles\u3002MemStore\u662f Sorted Memory Buffer\uff0c\u7528\u6237\u5199\u5165\u7684\u6570\u636e\u9996\u5148\u4f1a\u653e\u5165MemStore\uff0c\u5f53MemStore\u6ee1\u4e86\u4ee5\u540e\u4f1aFlush\u6210\u4e00\u4e2aStoreFile\uff08\u5e95\u5c42\u5b9e\u73b0\u662fHFile\uff09\uff0c \u5f53StoreFile\u6587\u4ef6\u6570\u91cf\u589e\u957f\u5230\u4e00\u5b9a\u9608\u503c\uff0c\u4f1a\u89e6\u53d1Compact\u5408\u5e76\u64cd\u4f5c\uff0c\u5c06\u591a\u4e2aStoreFiles\u5408\u5e76\u6210\u4e00\u4e2aStoreFile\uff0c\u5408\u5e76\u8fc7\u7a0b\u4e2d\u4f1a\u8fdb \u884c\u7248\u672c\u5408\u5e76\u548c\u6570\u636e\u5220\u9664\uff0c\u56e0\u6b64\u53ef\u4ee5\u770b\u51faHBase\u5176\u5b9e\u53ea\u6709\u589e\u52a0\u6570\u636e\uff0c\u6240\u6709\u7684\u66f4\u65b0\u548c\u5220\u9664\u64cd\u4f5c\u90fd\u662f\u5728\u540e\u7eed\u7684compact\u8fc7\u7a0b\u4e2d\u8fdb\u884c\u7684\uff0c\u8fd9\u4f7f\u5f97\u7528\u6237\u7684\u5199\u64cd\u4f5c\u53ea\u8981\u8fdb\u5165\u5185\u5b58\u4e2d\u5c31\u53ef\u4ee5\u7acb\u5373\u8fd4\u56de\uff0c\u4fdd\u8bc1\u4e86HBase I\/O\u7684\u9ad8\u6027\u80fd\u3002<\/p>\n

      \u5f53StoreFiles Compact\u540e\uff0c\u4f1a\u9010\u6b65\u5f62\u6210\u8d8a\u6765\u8d8a\u5927\u7684StoreFile\uff0c\u5f53\u5355\u4e2aStoreFile\u5927\u5c0f\u8d85\u8fc7\u4e00\u5b9a\u9608\u503c\u540e\uff0c\u4f1a\u89e6\u53d1Split\u64cd\u4f5c\uff0c\u540c\u65f6\u628a\u5f53\u524d Region Split\u62102\u4e2aRegion\uff0c\u7236Region\u4f1a\u4e0b\u7ebf\uff0c\u65b0Split\u51fa\u76842\u4e2a\u5b69\u5b50Region\u4f1a\u88abHMaster\u5206\u914d\u5230\u76f8\u5e94\u7684HRegionServer \u4e0a\uff0c\u4f7f\u5f97\u539f\u51481\u4e2aRegion\u7684\u538b\u529b\u5f97\u4ee5\u5206\u6d41\u52302\u4e2aRegion\u4e0a\u3002\u4e0b\u56fe\u63cf\u8ff0\u4e86Compaction\u548cSplit\u7684\u8fc7\u7a0b\uff1a
      \n\"9-11-07\"<\/p>\n

      \u5728\u7406\u89e3\u4e86\u4e0a\u8ff0HStore\u7684\u57fa\u672c\u539f\u7406\u540e\uff0c\u8fd8\u5fc5\u987b\u4e86\u89e3\u4e00\u4e0bHLog\u7684\u529f\u80fd\uff0c\u56e0\u4e3a\u4e0a\u8ff0\u7684HStore\u5728\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c\u7684\u524d\u63d0\u4e0b\u662f\u6ca1\u6709\u95ee\u9898\u7684\uff0c\u4f46\u662f\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u73af\u5883\u4e2d\uff0c\u65e0\u6cd5\u907f\u514d\u7cfb\u7edf\u51fa\u9519\u6216\u8005\u5b95\u673a\uff0c\u56e0\u6b64\u4e00\u65e6HRegionServer\u610f\u5916\u9000\u51fa\uff0cMemStore\u4e2d\u7684\u5185\u5b58\u6570\u636e\u5c06\u4f1a\u4e22\u5931\uff0c\u8fd9\u5c31\u9700\u8981\u5f15\u5165HLog\u4e86\u3002 \u6bcf\u4e2aHRegionServer\u4e2d\u90fd\u6709\u4e00\u4e2aHLog\u5bf9\u8c61\uff0cHLog\u662f\u4e00\u4e2a\u5b9e\u73b0Write Ahead Log\u7684\u7c7b\uff0c\u5728\u6bcf\u6b21\u7528\u6237\u64cd\u4f5c\u5199\u5165MemStore\u7684\u540c\u65f6\uff0c\u4e5f\u4f1a\u5199\u4e00\u4efd\u6570\u636e\u5230HLog\u6587\u4ef6\u4e2d\uff08HLog\u6587\u4ef6\u683c\u5f0f\u89c1\u540e\u7eed\uff09\uff0cHLog\u6587\u4ef6\u5b9a\u671f\u4f1a\u6eda\u52a8\u51fa\u65b0\u7684\uff0c\u5e76\u5220\u9664\u65e7\u7684\u6587\u4ef6\uff08\u5df2\u6301\u4e45\u5316\u5230StoreFile\u4e2d\u7684\u6570\u636e\uff09\u3002\u5f53HRegionServer\u610f\u5916\u7ec8\u6b62\u540e\uff0cHMaster\u4f1a\u901a\u8fc7Zookeeper\u611f\u77e5 \u5230\uff0cHMaster\u9996\u5148\u4f1a\u5904\u7406\u9057\u7559\u7684 HLog\u6587\u4ef6\uff0c\u5c06\u5176\u4e2d\u4e0d\u540cRegion\u7684Log\u6570\u636e\u8fdb\u884c\u62c6\u5206\uff0c\u5206\u522b\u653e\u5230\u76f8\u5e94region\u7684\u76ee\u5f55\u4e0b\uff0c\u7136\u540e\u518d\u5c06\u5931\u6548\u7684region\u91cd\u65b0\u5206\u914d\uff0c\u9886\u53d6 \u5230\u8fd9\u4e9bregion\u7684HRegionServer\u5728Load Region\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u53d1\u73b0\u6709\u5386\u53f2HLog\u9700\u8981\u5904\u7406\uff0c\u56e0\u6b64\u4f1aReplay HLog\u4e2d\u7684\u6570\u636e\u5230MemStore\u4e2d\uff0c\u7136\u540eflush\u5230StoreFiles\uff0c\u5b8c\u6210\u6570\u636e\u6062\u590d\u3002<\/p>\n

      HBase\u5b58\u50a8\u683c\u5f0f<\/strong><\/span><\/div>\n

      HBase\u4e2d\u7684\u6240\u6709\u6570\u636e\u6587\u4ef6\u90fd\u5b58\u50a8\u5728Hadoop HDFS\u6587\u4ef6\u7cfb\u7edf\u4e0a\uff0c\u4e3b\u8981\u5305\u62ec\u4e0a\u8ff0\u63d0\u51fa\u7684\u4e24\u79cd\u6587\u4ef6\u7c7b\u578b\uff1a<\/p>\n

        \n
      1. HFile\uff0c HBase\u4e2dKeyValue\u6570\u636e\u7684\u5b58\u50a8\u683c\u5f0f\uff0cHFile\u662fHadoop\u7684\u4e8c\u8fdb\u5236\u683c\u5f0f\u6587\u4ef6\uff0c\u5b9e\u9645\u4e0aStoreFile\u5c31\u662f\u5bf9HFile\u505a\u4e86\u8f7b\u91cf\u7ea7\u5305\u88c5\uff0c\u5373StoreFile\u5e95\u5c42\u5c31\u662fHFile<\/li>\n
      2. HLog File\uff0cHBase\u4e2dWAL\uff08Write Ahead Log\uff09 \u7684\u5b58\u50a8\u683c\u5f0f\uff0c\u7269\u7406\u4e0a\u662fHadoop\u7684Sequence File<\/li>\n<\/ol>\n
        HFile<\/strong><\/span><\/div>\n

        \u4e0b\u56fe\u662fHFile\u7684\u5b58\u50a8\u683c\u5f0f\uff1a
        \n\"9-11-08\"<\/p>\n

        \u9996\u5148HFile\u6587\u4ef6\u662f\u4e0d\u5b9a\u957f\u7684\uff0c\u957f\u5ea6\u56fa\u5b9a\u7684\u53ea\u6709\u5176\u4e2d\u7684\u4e24\u5757\uff1aTrailer\u548cFileInfo\u3002\u6b63\u5982\u56fe\u4e2d\u6240\u793a\u7684\uff0cTrailer\u4e2d\u6709\u6307\u9488\u6307\u5411\u5176\u4ed6\u6570 \u636e\u5757\u7684\u8d77\u59cb\u70b9\u3002File Info\u4e2d\u8bb0\u5f55\u4e86\u6587\u4ef6\u7684\u4e00\u4e9bMeta\u4fe1\u606f\uff0c\u4f8b\u5982\uff1aAVG_KEY_LEN, AVG_VALUE_LEN, LAST_KEY, COMPARATOR, MAX_SEQ_ID_KEY\u7b49\u3002Data Index\u548cMeta Index\u5757\u8bb0\u5f55\u4e86\u6bcf\u4e2aData\u5757\u548cMeta\u5757\u7684\u8d77\u59cb\u70b9\u3002<\/p>\n

        Data Block\u662fHBase I\/O\u7684\u57fa\u672c\u5355\u5143\uff0c\u4e3a\u4e86\u63d0\u9ad8\u6548\u7387\uff0cHRegionServer\u4e2d\u6709\u57fa\u4e8eLRU\u7684Block Cache\u673a\u5236\u3002\u6bcf\u4e2aData\u5757\u7684\u5927\u5c0f\u53ef\u4ee5\u5728\u521b\u5efa\u4e00\u4e2aTable\u7684\u65f6\u5019\u901a\u8fc7\u53c2\u6570\u6307\u5b9a\uff0c\u5927\u53f7\u7684Block\u6709\u5229\u4e8e\u987a\u5e8fScan\uff0c\u5c0f\u53f7Block\u5229\u4e8e\u968f\u673a\u67e5\u8be2\u3002 \u6bcf\u4e2aData\u5757\u9664\u4e86\u5f00\u5934\u7684Magic\u4ee5\u5916\u5c31\u662f\u4e00\u4e2a\u4e2aKeyValue\u5bf9\u62fc\u63a5\u800c\u6210, Magic\u5185\u5bb9\u5c31\u662f\u4e00\u4e9b\u968f\u673a\u6570\u5b57\uff0c\u76ee\u7684\u662f\u9632\u6b62\u6570\u636e\u635f\u574f\u3002\u540e\u9762\u4f1a\u8be6\u7ec6\u4ecb\u7ecd\u6bcf\u4e2aKeyValue\u5bf9\u7684\u5185\u90e8\u6784\u9020\u3002<\/p>\n

        HFile\u91cc\u9762\u7684\u6bcf\u4e2aKeyValue\u5bf9\u5c31\u662f\u4e00\u4e2a\u7b80\u5355\u7684byte\u6570\u7ec4\u3002\u4f46\u662f\u8fd9\u4e2abyte\u6570\u7ec4\u91cc\u9762\u5305\u542b\u4e86\u5f88\u591a\u9879\uff0c\u5e76\u4e14\u6709\u56fa\u5b9a\u7684\u7ed3\u6784\u3002\u6211\u4eec\u6765\u770b\u770b\u91cc\u9762\u7684\u5177\u4f53\u7ed3\u6784\uff1a
        \n\"9-11-09\"<\/p>\n

        \u5f00\u59cb\u662f\u4e24\u4e2a\u56fa\u5b9a\u957f\u5ea6\u7684\u6570\u503c\uff0c\u5206\u522b\u8868\u793aKey\u7684\u957f\u5ea6\u548cValue\u7684\u957f\u5ea6\u3002\u7d27\u63a5\u7740\u662fKey\uff0c\u5f00\u59cb\u662f\u56fa\u5b9a\u957f\u5ea6\u7684\u6570\u503c\uff0c\u8868\u793aRowKey\u7684\u957f\u5ea6\uff0c\u7d27\u63a5\u7740\u662f RowKey\uff0c\u7136\u540e\u662f\u56fa\u5b9a\u957f\u5ea6\u7684\u6570\u503c\uff0c\u8868\u793aFamily\u7684\u957f\u5ea6\uff0c\u7136\u540e\u662fFamily\uff0c\u63a5\u7740\u662fQualifier\uff0c\u7136\u540e\u662f\u4e24\u4e2a\u56fa\u5b9a\u957f\u5ea6\u7684\u6570\u503c\uff0c\u8868\u793aTime Stamp\u548cKey Type\uff08Put\/Delete\uff09\u3002Value\u90e8\u5206\u6ca1\u6709\u8fd9\u4e48\u590d\u6742\u7684\u7ed3\u6784\uff0c\u5c31\u662f\u7eaf\u7cb9\u7684\u4e8c\u8fdb\u5236\u6570\u636e\u4e86\u3002<\/p>\n

        HLogFile<\/strong><\/span><\/div>\n

        \"9-11-10\"<\/p>\n

        \u4e0a\u56fe\u4e2d\u793a\u610f\u4e86HLog\u6587\u4ef6\u7684\u7ed3\u6784\uff0c\u5176\u5b9eHLog\u6587\u4ef6\u5c31\u662f\u4e00\u4e2a\u666e\u901a\u7684Hadoop Sequence File\uff0cSequence File \u7684Key\u662fHLogKey\u5bf9\u8c61\uff0cHLogKey\u4e2d\u8bb0\u5f55\u4e86\u5199\u5165\u6570\u636e\u7684\u5f52\u5c5e\u4fe1\u606f\uff0c\u9664\u4e86table\u548cregion\u540d\u5b57\u5916\uff0c\u540c\u65f6\u8fd8\u5305\u62ec\u00a0sequence number\u548ctimestamp\uff0ctimestamp\u662f\u201c\u5199\u5165\u65f6\u95f4\u201d\uff0csequence number\u7684\u8d77\u59cb\u503c\u4e3a0\uff0c\u6216\u8005\u662f\u6700\u8fd1\u4e00\u6b21\u5b58\u5165\u6587\u4ef6\u7cfb\u7edf\u4e2dsequence number\u3002<\/p>\n

        HLog Sequece File\u7684Value\u662fHBase\u7684KeyValue\u5bf9\u8c61\uff0c\u5373\u5bf9\u5e94HFile\u4e2d\u7684KeyValue\uff0c\u53ef\u53c2\u89c1\u4e0a\u6587\u63cf\u8ff0\u3002<\/p>\n

        \u4e09\u3001Hbase\u5b89\u88c5<\/strong><\/div>\n

        1\u3001Hbase\u7248\u672c\u9009\u62e9<\/strong><\/p>\n

        \u6311\u9009\u4e00\u4e2aApache Download Mirror\uff08Apache\u4e0b\u8f7d\u955c\u50cf\uff09\uff0c\u4e0b\u8f7d\u4e00\u4e2aHbase\u7684\u7a33\u5b9a\u53d1\u5e03\u7248\u672c\uff0c\u89e3\u538b\u5982\u4e0b\uff1a<\/p>\n

        tar zxvf hbase-1.0.3-bin.tar.gz -C \/home\/hadoop\/<\/pre>\n

        \u8bbe\u7f6eHbase\u73af\u5883\u53d8\u91cf<\/p>\n

        # hbase env\r\nexport HBASE_HOME=\/home\/hadoop\/hbase\r\nexport PATH=$PATH:$HBASE_HOME\/bin<\/pre>\n

        #\u83b7\u53d6Hbase\u9009\u9879\u5217\u8868\u53ca\u7248\u672c\u4fe1\u606f<\/p>\n

        hbase version<\/pre>\n

        \"9-11-11\"<\/p>\n

        2\u3001\u6d4b\u8bd5\u9a71\u52a8<\/strong><\/p>\n

        #\u542f\u52a8\u4e00\u4e2a\u4f7f\u7528\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\/tmp\u76ee\u5f55\u4f5c\u4e3a\u6301\u4e45\u5316\u5b58\u50a8\u7684Hbase\u4e34\u65f6\u5b9e\u4f8b<\/p>\n

        start-hbase.sh\r\nstarting master, logging to \/home\/hadoop\/hbase\/logs\/hbase-root-master-linux-node1.out<\/pre>\n

        \"qq%e5%9b%be%e7%89%8720160911170244\"<\/p>\n

        #\u65b0\u5efa\u4e00\u4e2a\u540d\u4e3atest\u7684\u8868\uff0c\u4f7f\u5176\u53ea\u5305\u542b\u4e00\u4e2a\u540d\u4e3adata\u7684\u5217\uff0c\u8868\u548c\u5217\u65cf\u5c5e\u6027\u90fd\u4e3a\u9ed8\u8ba4\u503c<\/p>\n

        hbase(main):001:0> create 'test','data'\r\n0 row(s) in 0.4150 seconds<\/pre>\n

        #\u901a\u8fc7\u952e\u5165help\u67e5\u770b\u5e2e\u52a9\u547d\u4ee4\uff0c\u8fd0\u884clist\u67e5\u770b\u65b0\u5efa\u7684\u8868\u662f\u5426\u5b58\u5728<\/p>\n

        hbase(main):003:0> list\r\nTABLE\r\ntest\r\n1 row(s) in 0.0230 seconds<\/pre>\n

        #\u5728\u5217\u65cfdata\u4e2d\u4e8c\u4e2a\u4e0d\u540c\u7684\u884c\u548c\u5217\u4e0a\u63d2\u5165\u6570\u636e\uff0c\u7136\u540e\u5217\u51fa\u8868\u5185\u5bb9<\/p>\n

        hbase(main):004:0> put 'test','row1','data:1','values1'\r\n0 row(s) in 0.1280 seconds\r\nhbase(main):005:0> put 'test','row2','data:2','values2'\r\n0 row(s) in 0.0090 seconds\r\nhbase(main):006:0> scan 'test'\r\nROW COLUMN+CELL\r\nrow1 column=data:1, timestamp=1473585137461, value=values1\r\nrow2 column=data:2, timestamp=1473585158072, value=values2\r\n2 row(s) in 0.0200 seconds<\/pre>\n

        #\u5220\u9664\u521a\u521b\u5efa\u7684\u8868test\uff0c\u9700\u8981\u5148\u8bbe\u4e3a\u7981\u7528\uff0c\u7136\u540e\u5220\u9664\uff0c\u4e0d\u8bbe\u7f6e\u4f1a\u62a5\u9519\uff1a<\/p>\n

        ERROR: Table test is enabled. Disable it first.\r\nhbase(main):009:0> disable 'test'\r\n0 row(s) in 1.1800 seconds\r\nhbase(main):010:0> drop 'test'\r\n0 row(s) in 0.1570 seconds<\/pre>\n

        \u672c\u6587\u539f\u521b\u5730\u5740\uff1a http:\/\/lrxjmw.cn\/hadoop-hbase-deploy-use.html \u200e<\/a>\u4f5c\u8005\uff1a\u738b\u8f89\uff0c\u5ba1\u6838\u5458\uff1a\u5cb3\u6c38<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

        \u5bfc\u8bfb HBase \u2013 Hadoop Database\uff0c\u662f\u4e00\u4e2a\u9ad8\u53ef\u9760\u6027\u3001\u9ad8\u6027\u80fd\u3001\u9762\u5411\u5217\u3001\u53ef\u4f38\u7f29\u7684\u5206\u5e03\u5f0f\u5b58\u50a8\u7cfb\u7edf\uff0c […]<\/p>\n","protected":false},"author":63,"featured_media":31294,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-30499","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/30499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=30499"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/30499\/revisions"}],"predecessor-version":[{"id":259725,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/30499\/revisions\/259725"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/31294"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=30499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=30499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=30499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}