db-tutorial/pages/7ab03c/index.html

106 lines
56 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>HBase 快速入门 | DB-TUTORIAL</title>
<meta name="generator" content="VuePress 1.9.9">
<link rel="icon" href="/db-tutorial/img/favicon.ico">
<script src="https://cdn.wwads.cn/js/makemoney.js" type="text/javascript"></script>
<meta name="description" content="☕ db-tutorial 是一个数据库教程。">
<meta name="keywords" content="vuepress,theme,blog,vdoing">
<meta name="theme-color" content="#11a8cd">
<meta name="wwads-cn-verify" content="mxqWx62nfQQ9ocT4e5DzISHzOWyF4s">
<link rel="preload" href="/db-tutorial/assets/css/0.styles.51390d19.css" as="style"><link rel="preload" href="/db-tutorial/assets/js/app.be3f2e92.js" as="script"><link rel="preload" href="/db-tutorial/assets/js/2.aded268b.js" as="script"><link rel="preload" href="/db-tutorial/assets/js/54.340ab690.js" as="script"><link rel="prefetch" href="/db-tutorial/assets/js/10.551ab278.js"><link rel="prefetch" href="/db-tutorial/assets/js/11.c049b6a2.js"><link rel="prefetch" href="/db-tutorial/assets/js/12.92d587d6.js"><link rel="prefetch" href="/db-tutorial/assets/js/13.a7b35fa5.js"><link rel="prefetch" href="/db-tutorial/assets/js/14.9ec959b5.js"><link rel="prefetch" href="/db-tutorial/assets/js/15.e7943372.js"><link rel="prefetch" href="/db-tutorial/assets/js/16.c6ad7b26.js"><link rel="prefetch" href="/db-tutorial/assets/js/17.39500ebd.js"><link rel="prefetch" href="/db-tutorial/assets/js/18.29949979.js"><link rel="prefetch" href="/db-tutorial/assets/js/19.78f879b8.js"><link rel="prefetch" href="/db-tutorial/assets/js/20.3ce14df7.js"><link rel="prefetch" href="/db-tutorial/assets/js/21.9d311c7c.js"><link rel="prefetch" href="/db-tutorial/assets/js/22.90234550.js"><link rel="prefetch" href="/db-tutorial/assets/js/23.12cf9e2d.js"><link rel="prefetch" href="/db-tutorial/assets/js/24.5b436e46.js"><link rel="prefetch" href="/db-tutorial/assets/js/25.8f2dc7d9.js"><link rel="prefetch" href="/db-tutorial/assets/js/26.61665ff4.js"><link rel="prefetch" href="/db-tutorial/assets/js/27.dfc7cc88.js"><link rel="prefetch" href="/db-tutorial/assets/js/28.a6286a66.js"><link rel="prefetch" href="/db-tutorial/assets/js/29.bfa8c106.js"><link rel="prefetch" href="/db-tutorial/assets/js/3.82108019.js"><link rel="prefetch" href="/db-tutorial/assets/js/30.c93b7a2e.js"><link rel="prefetch" href="/db-tutorial/assets/js/31.d48aab81.js"><link rel="prefetch" href="/db-tutorial/assets/js/32.33f8bb7c.js"><link rel="prefetch" href="/db-tutorial/assets/js/33.eb3b622d.js"><link rel="prefetch" href="/db-tutorial/assets/js/34.1ba1a06c.js"><link rel="prefetch" href="/db-tutorial/assets/js/35.24e4fee8.js"><link rel="prefetch" href="/db-tutorial/assets/js/36.dc61504e.js"><link rel="prefetch" href="/db-tutorial/assets/js/37.f1c9c729.js"><link rel="prefetch" href="/db-tutorial/assets/js/38.5024023f.js"><link rel="prefetch" href="/db-tutorial/assets/js/39.30ed016e.js"><link rel="prefetch" href="/db-tutorial/assets/js/4.884deeca.js"><link rel="prefetch" href="/db-tutorial/assets/js/40.6a6327f0.js"><link rel="prefetch" href="/db-tutorial/assets/js/41.3767f4d8.js"><link rel="prefetch" href="/db-tutorial/assets/js/42.14a20b0f.js"><link rel="prefetch" href="/db-tutorial/assets/js/43.b059081c.js"><link rel="prefetch" href="/db-tutorial/assets/js/44.73f724d9.js"><link rel="prefetch" href="/db-tutorial/assets/js/45.68f2ab27.js"><link rel="prefetch" href="/db-tutorial/assets/js/46.aed8a61f.js"><link rel="prefetch" href="/db-tutorial/assets/js/47.3bbf2366.js"><link rel="prefetch" href="/db-tutorial/assets/js/48.81688356.js"><link rel="prefetch" href="/db-tutorial/assets/js/49.1d366c93.js"><link rel="prefetch" href="/db-tutorial/assets/js/5.42f2cdb7.js"><link rel="prefetch" href="/db-tutorial/assets/js/50.ee6f08b7.js"><link rel="prefetch" href="/db-tutorial/assets/js/51.47835d9d.js"><link rel="prefetch" href="/db-tutorial/assets/js/52.b0cab79c.js"><link rel="prefetch" href="/db-tutorial/assets/js/53.106440a2.js"><link rel="prefetch" href="/db-tutorial/assets/js/55.00623de9.js"><link rel="prefetch" href="/db-tutorial/assets/js/56.9f086601.js"><link rel="prefetch" href="/db-tutorial/assets/js/57.f5ad5f3f.js"><link rel="prefetch" href="/db-tutorial/assets/js/58.14827368.js"><link rel="prefetch" href="/db-tutorial/assets/js/59.c41f57d6.js"><link rel="prefetch" href="/db-tutorial/assets/js/6.5a5b4e54.js"><link rel="prefetch" href="/db-tutorial/assets/js/60.314534c0.js"><link rel="prefetch" href="/db-tutorial/assets/js/61.1ea5e4b7.js"><link rel="prefetch" href="/db-tutorial/assets/js/62.8b52e8fc.js"><link rel="prefetch" href="/db-tutorial/assets/js/63.d2fa8325.js"><link rel="prefetch" href="/db-tutorial/assets/js/64.ea2577e7.js"><link rel="prefetch" href="/db-tutorial/assets/js/65.563da2bb.js"><link rel="prefetch" href="/db-tutorial/assets/js/66.34eb51bd.js"><link rel="prefetch" href="/db-tutorial/assets/js/67.ab57f04f.js"><link rel="prefetch" href="/db-tutorial/assets/js/68.15b6f540.js"><link rel="prefetch" href="/db-tutorial/assets/js/69.54590de4.js"><link rel="prefetch" href="/db-tutorial/assets/js/7.913bec54.js"><link rel="prefetch" href="/db-tutorial/assets/js/70.40a2cea2.js"><link rel="prefetch" href="/db-tutorial/assets/js/71.3ce50922.js"><link rel="prefetch" href="/db-tutorial/assets/js/72.b9c022e9.js"><link rel="prefetch" href="/db-tutorial/assets/js/73.fba94661.js"><link rel="prefetch" href="/db-tutorial/assets/js/74.998d6c2f.js"><link rel="prefetch" href="/db-tutorial/assets/js/75.6efb68b0.js"><link rel="prefetch" href="/db-tutorial/assets/js/76.57273256.js"><link rel="prefetch" href="/db-tutorial/assets/js/77.3ddffb5b.js"><link rel="prefetch" href="/db-tutorial/assets/js/78.8fde3d74.js"><link rel="prefetch" href="/db-tutorial/assets/js/79.7a472c31.js"><link rel="prefetch" href="/db-tutorial/assets/js/8.103b4774.js"><link rel="prefetch" href="/db-tutorial/assets/js/80.4c55c65f.js"><link rel="prefetch" href="/db-tutorial/assets/js/81.cbdb67b8.js"><link rel="prefetch" href="/db-tutorial/assets/js/82.9c14d852.js"><link rel="prefetch" href="/db-tutorial/assets/js/83.a3d7d272.js"><link rel="prefetch" href="/db-tutorial/assets/js/84.6994dacc.js"><link rel="prefetch" href="/db-tutorial/assets/js/85.aca8d788.js"><link rel="prefetch" href="/db-tutorial/assets/js/86.00671865.js"><link rel="prefetch" href="/db-tutorial/assets/js/87.9076c4e8.js"><link rel="prefetch" href="/db-tutorial/assets/js/88.bbe68dab.js"><link rel="prefetch" href="/db-tutorial/assets/js/89.e2173071.js"><link rel="prefetch" href="/db-tutorial/assets/js/9.386bfe3a.js"><link rel="prefetch" href="/db-tutorial/assets/js/90.429162f2.js"><link rel="prefetch" href="/db-tutorial/assets/js/91.6ecc7c85.js"><link rel="prefetch" href="/db-tutorial/assets/js/92.efe42934.js"><link rel="prefetch" href="/db-tutorial/assets/js/93.69562766.js"><link rel="prefetch" href="/db-tutorial/assets/js/94.04aebfbc.js"><link rel="prefetch" href="/db-tutorial/assets/js/95.fe7cfce4.js"><link rel="prefetch" href="/db-tutorial/assets/js/96.674475d6.js"><link rel="prefetch" href="/db-tutorial/assets/js/97.8a7b73f2.js"><link rel="prefetch" href="/db-tutorial/assets/js/98.bf85add1.js">
<link rel="stylesheet" href="/db-tutorial/assets/css/0.styles.51390d19.css">
</head>
<body class="theme-mode-light">
<div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/db-tutorial/" class="home-link router-link-active"><img src="https://raw.githubusercontent.com/dunwu/images/master/common/dunwu-logo.png" alt="DB-TUTORIAL" class="logo"> <span class="site-name can-hide">DB-TUTORIAL</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/db-tutorial/12.数据库/01.数据库综合/" class="nav-link">数据库综合</a></div><div class="nav-item"><a href="/db-tutorial/12.数据库/02.数据库中间件/" class="nav-link">数据库中间件</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="关系型数据库" class="dropdown-title"><a href="/db-tutorial/12.数据库/03.关系型数据库/" class="link-title">关系型数据库</a> <span class="title" style="display:none;">关系型数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/01.综合/" class="nav-link">综合</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/02.Mysql/" class="nav-link">Mysql</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/99.其他/" class="nav-link">其他</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="文档数据库" class="dropdown-title"><!----> <span class="title" style="display:;">文档数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/04.文档数据库/01.MongoDB/" class="nav-link">MongoDB</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="KV数据库" class="dropdown-title"><!----> <span class="title" style="display:;">KV数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/05.KV数据库/01.Redis/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="搜索引擎数据库" class="dropdown-title"><!----> <span class="title" style="display:;">搜索引擎数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/01.Elasticsearch/" class="nav-link">Elasticsearch</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/02.Elastic/" class="nav-link">Elastic技术栈</a></li></ul></div></div> <a href="https://github.com/dunwu/db-tutorial" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/db-tutorial/12.数据库/01.数据库综合/" class="nav-link">数据库综合</a></div><div class="nav-item"><a href="/db-tutorial/12.数据库/02.数据库中间件/" class="nav-link">数据库中间件</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="关系型数据库" class="dropdown-title"><a href="/db-tutorial/12.数据库/03.关系型数据库/" class="link-title">关系型数据库</a> <span class="title" style="display:none;">关系型数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/01.综合/" class="nav-link">综合</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/02.Mysql/" class="nav-link">Mysql</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/99.其他/" class="nav-link">其他</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="文档数据库" class="dropdown-title"><!----> <span class="title" style="display:;">文档数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/04.文档数据库/01.MongoDB/" class="nav-link">MongoDB</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="KV数据库" class="dropdown-title"><!----> <span class="title" style="display:;">KV数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/05.KV数据库/01.Redis/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="搜索引擎数据库" class="dropdown-title"><!----> <span class="title" style="display:;">搜索引擎数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/01.Elasticsearch/" class="nav-link">Elasticsearch</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/02.Elastic/" class="nav-link">Elastic技术栈</a></li></ul></div></div> <a href="https://github.com/dunwu/db-tutorial" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav> <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>数据库综合</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>数据库中间件</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>关系型数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>文档数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>KV数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>列式数据库</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><section class="sidebar-group collapsable is-sub-group depth-1"><p class="sidebar-heading open"><span>HBase</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/db-tutorial/pages/7ab03c/" aria-current="page" class="active sidebar-link">HBase 快速入门</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/7ab03c/#hbase-简介" class="sidebar-link">HBase 简介</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/7ab03c/#为什么需要-hbase" class="sidebar-link">为什么需要 HBase</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/7ab03c/#什么是-hbase" class="sidebar-link">什么是 HBase</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/7ab03c/#什么时候使用-hbase" class="sidebar-link">什么时候使用 HBase</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/7ab03c/#hbase-数据模型简介" class="sidebar-link">HBase 数据模型简介</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/7ab03c/#特性比较" class="sidebar-link">特性比较</a></li><li class="sidebar-sub-header level4"><a href="/db-tutorial/pages/7ab03c/#hbase-vs-rdbms" class="sidebar-link">HBase vs. RDBMS</a></li><li class="sidebar-sub-header level4"><a href="/db-tutorial/pages/7ab03c/#hbase-vs-hdfs" class="sidebar-link">HBase vs. HDFS</a></li><li class="sidebar-sub-header level4"><a href="/db-tutorial/pages/7ab03c/#行式数据库-vs-列式数据库" class="sidebar-link">行式数据库 vs. 列式数据库</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/7ab03c/#hbase-安装" class="sidebar-link">HBase 安装</a></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/7ab03c/#hbase-hello-world-示例" class="sidebar-link">HBase Hello World 示例</a></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/7ab03c/#参考资料" class="sidebar-link">参考资料</a></li></ul></li><li><a href="/db-tutorial/pages/c8cfeb/" class="sidebar-link">HBase 数据模型</a></li><li><a href="/db-tutorial/pages/a69528/" class="sidebar-link">HBase Schema 设计</a></li><li><a href="/db-tutorial/pages/62f8d9/" class="sidebar-link">HBase 架构</a></li><li><a href="/db-tutorial/pages/a8cad3/" class="sidebar-link">HBase Java API 基础特性</a></li><li><a href="/db-tutorial/pages/a3347e/" class="sidebar-link">HBase Java API 高级特性之过滤器</a></li><li><a href="/db-tutorial/pages/5f1bc3/" class="sidebar-link">HBase Java API 高级特性之协处理器</a></li><li><a href="/db-tutorial/pages/ce5ca0/" class="sidebar-link">HBase Java API 其他高级特性</a></li><li><a href="/db-tutorial/pages/b59ba2/" class="sidebar-link">HBase Java API 管理功能</a></li><li><a href="/db-tutorial/pages/f808fc/" class="sidebar-link">HBase 运维</a></li><li><a href="/db-tutorial/pages/263c40/" class="sidebar-link">HBase 命令</a></li></ul></section></li><li><a href="/db-tutorial/pages/ca3ca5/" class="sidebar-link">Cassandra</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>搜索引擎数据库</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-06225672><div class="articleInfo" data-v-06225672><ul class="breadcrumbs" data-v-06225672><li data-v-06225672><a href="/db-tutorial/" title="首页" class="iconfont icon-home router-link-active" data-v-06225672></a></li> <li data-v-06225672><a href="/db-tutorial/categories/?category=%E6%95%B0%E6%8D%AE%E5%BA%93" title="分类" data-v-06225672>数据库</a></li><li data-v-06225672><a href="/db-tutorial/categories/?category=%E5%88%97%E5%BC%8F%E6%95%B0%E6%8D%AE%E5%BA%93" title="分类" data-v-06225672>列式数据库</a></li><li data-v-06225672><a href="/db-tutorial/categories/?category=HBase" title="分类" data-v-06225672>HBase</a></li></ul> <div class="info" data-v-06225672><div title="作者" class="author iconfont icon-touxiang" data-v-06225672><a href="https://github.com/dunwu" target="_blank" title="作者" class="beLink" data-v-06225672>dunwu</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-06225672><a href="javascript:;" data-v-06225672>2020-02-10</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c6QAABH1JREFUSA3tVl1oHFUUPmdmd2ltklqbpJDiNnXFmgbFktho7YMPNiJSSZM0+CAYSkUELVhM6YuwIPpgoOKDqOBDC0XE2CQoNtQXBUFTTcCi+Wlh1V2TQExsUzcltd3M9Tt3ZjZzZ2fT+OJTL8yeM+eee757fmeJbq//KQL8X3DUSFOcfr7cRsRtxNQMWueeVzOkaITIGqQHNg5y8+jNW9ldM7A6nTpAjuolUikAwq7CE3WcM2RRDz+XGVgN3FptU/aUSlvq9Pa3iZ1+sgAqJyyAFqkipd9dqiwHF3P65YycLWc/6sqGrvoEoIp6DOFaX5h6+dnfjkWprwqsPk0dUGq5vySwDImC10KxFHgGL1SWoc92O3eVht09qdXNH11I2SsTsJYqMWzihqGMi+A+Garf3BAuuLI5oGlULyNfyB/HYNujwktOfRrMr5t77NmevqaUopx0grnKAyvVpmwUDB4x6FPXuGvYLTDwWsejwgtgkYKPqRJg8SV6xaiZ3ZTppGneS4yfH5/66fZSDHv+QZci/+h5c5UHtpy67JUqGppM0sh0Nc1dW6/N1W5Yoqat8/TU/VnadmdeW2PLLSyh0cvxBs3KbqTmwYPpxN4do/mzE8nEpvX/UMu2Wbp74zUAK5q6WkHns7V0eWkdPbPzd3rxkTGybadYySumVzhcaJFbs5UrEkQ/+CK8gF5dnh/6ciIZ73gwQ927L1IitoxKLXYP3SjYdOrHHfTZhRRlFyrorafPk20B3HPD1y2G3qKZME5Jcf3t/HUC13/8tSd++vqFveMUTwAUxSUFI1QekR1+bIze3D9MF2aq6cPvG72CgnldWCFqyRw3lwH8ZMerjTD9ElRO7Gv44wNpC90aASqGfVlz/Rx17srQ57/UU26hkhQqUB7dBR71WmzQhHUnblGmVOEw0jhbV1n9OlXUDCIRGaNV5Jp43N516fN7JmnTHdfp7Hgy0luO4aMhtkLL8Bi3bUWYvzh5Mn1dTxrL6QmGuRhGL/TiTTxRoEdTszSaq9GR0NGA3KdkOz3hqSV3MIDhQ5IVX/Ivx3umBti2es2h4eZby7x8br1rkf7Mo90AqC8aQ3sJeNzqFRu+vSANAQe3PL7l0HGOAdwDCeZYvNKeoZp1Qfs6Aipndh86HmFRi0LAnEO47wsqM6cdfjh3jBPUzhZy7nvlUfFsamED1VQt6aISHVymXZ/B2aCtIG8AI8xfobj2d3en1wWVhOeHELKmLQ1s211s88comkv4UCwWyF787mJdYXtNfhKAXVqnKTq8QZvGAGGOfaTo5pGZ/PwbUCr5+DPr/1J92JNHr9aOl/F3iI5+O1nfybsGxoimvZ3ViWSluDITw3P37mypheDIPY0tw7+O/5ApbkYw+zpfaUVu32Pi98+defdUhEpZkRFq0aqyNh9FuL9hpYbEm6iwi0z2REd09ZmyENEbuhjDWzKvZXTqKYaBIr3tt5kuPtQBZFvEUwHt60vfCNu41XsksH9Ij1BMMz1Y0OOunHNShFIP5868g5zeXmuLwL9T4b6Q2+KejgAAAABJRU5ErkJggg==">HBase 快速入门<!----></h1> <div class="theme-vdoing-content content__default"><h1 id="hbase-快速入门"><a href="#hbase-快速入门" class="header-anchor">#</a> HBase 快速入门</h1> <h2 id="hbase-简介"><a href="#hbase-简介" class="header-anchor">#</a> HBase 简介</h2> <h3 id="为什么需要-hbase"><a href="#为什么需要-hbase" class="header-anchor">#</a> 为什么需要 HBase</h3> <p>在介绍 HBase 之前,我们不妨先了解一下为什么需要 HBase或者说 HBase 是为了达到什么目的而产生。</p> <p>在 HBase 诞生之前Hadoop 可以通过 HDFS 来存储结构化、半结构甚至非结构化的数据,它是传统数据库的补充,是海量数据存储的最佳方法,它针对大文件的存储,批量访问和流式访问都做了优化,同时也通过多副本解决了容灾问题。</p> <p>Hadoop 的缺陷在于:它只能执行批处理,并且只能以顺序方式访问数据。这意味着即使是最简单的工作,也必须搜索整个数据集,即:<strong>Hadoop 无法实现对数据的随机访问</strong>。实现数据的随机访问是传统的关系型数据库所擅长的,但它们却不能用于海量数据的存储。在这种情况下,必须有一种新的方案来<strong>同时解决海量数据存储和随机访问的问题</strong>HBase 就是其中之一 (HBaseCassandracouchDBDynamo 和 MongoDB 都能存储海量数据并支持随机访问)。</p> <blockquote><p>注:数据结构分类:</p> <ul><li>结构化数据:即以关系型数据库表形式管理的数据;</li> <li>半结构化数据非关系模型的有基本固定结构模式的数据例如日志文件、XML 文档、JSON 文档、Email 等;</li> <li>非结构化数据:没有固定模式的数据,如 WORD、PDF、PPT、EXL各种格式的图片、视频等。</li></ul></blockquote> <h3 id="什么是-hbase"><a href="#什么是-hbase" class="header-anchor">#</a> 什么是 HBase</h3> <p><strong>HBase 是一个构建在 HDFSHadoop 文件系统)之上的列式数据库</strong></p> <p>HBase 是一种类似于 <code>Googles Big Table</code> 的数据模型,它是 Hadoop 生态系统的一部分,它将数据存储在 HDFS 上,客户端可以通过 HBase 实现对 HDFS 上数据的随机访问。</p> <p><img src="https://raw.githubusercontent.com/dunwu/images/master/snap/20200601170449.png" alt="img"></p> <p>HBase 的<strong>核心特性</strong>如下:</p> <ul><li><strong>分布式</strong> <ul><li><strong>伸缩性</strong>:支持通过增减机器进行水平扩展,以提升整体容量和性能</li> <li><strong>高可用</strong>:支持 RegionServers 之间的自动故障转移</li> <li><strong>自动分区</strong>Region 分散在集群中当行数增长的时候Region 也会自动的分区再均衡</li></ul></li> <li><strong>超大数据集</strong>HBase 被设计用来读写超大规模的数据集(数十亿行至数百亿行的表)</li> <li><strong>支持结构化、半结构化和非结构化的数据</strong>:由于 HBase 基于 HDFS 构建,所以和 HDFS 一样,支持结构化、半结构化和非结构化的数据</li> <li><strong>非关系型数据库</strong> <ul><li><strong>不支持标准 SQL 语法</strong></li> <li><strong>没有真正的索引</strong></li> <li><strong>不支持复杂的事务</strong>:只支持行级事务,即单行数据的读写都是原子性的</li></ul></li></ul> <p>HBase 的其他特性</p> <ul><li>读写操作遵循强一致性</li> <li>过滤器支持谓词下推</li> <li>易于使用的 Java 客户端 API</li> <li>它支持线性和模块化可扩展性。</li> <li>HBase 表支持 Hadoop MapReduce 作业的便捷基类</li> <li>很容易使用 Java API 进行客户端访问</li> <li>为实时查询提供块缓存 BlockCache 和布隆过滤器</li> <li>它通过服务器端过滤器提供查询谓词下推</li></ul> <h3 id="什么时候使用-hbase"><a href="#什么时候使用-hbase" class="header-anchor">#</a> 什么时候使用 HBase</h3> <p>根据上一节对于 HBase 特性的介绍,我们可以梳理出 HBase 适用、不适用的场景:</p> <p>HBase 不适用场景:</p> <ul><li>需要索引</li> <li>需要复杂的事务</li> <li>数据量较小(比如:数据量不足几百万行)</li></ul> <p>HBase 适用场景:</p> <ul><li>能存储海量数据并支持随机访问(比如:数据量级达到十亿级至百亿级)</li> <li>存储结构化、半结构化数据</li> <li>硬件资源充足</li></ul> <blockquote><p>一言以蔽之——HBase 适用的场景是:<strong>实时地随机访问超大数据集</strong></p></blockquote> <p>HBase 的典型应用场景</p> <ul><li>存储监控数据</li> <li>存储用户/车辆 GPS 信息</li> <li>存储用户行为数据</li> <li>存储各种日志数据,如:访问日志、操作日志、推送日志等。</li> <li>存储短信、邮件等消息类数据</li> <li>存储网页数据</li></ul> <h3 id="hbase-数据模型简介"><a href="#hbase-数据模型简介" class="header-anchor">#</a> HBase 数据模型简介</h3> <p>前面已经提及HBase 是一个列式数据库,其数据模型和关系型数据库有所不同。其数据模型的关键术语如下:</p> <ul><li>TableHBase 表由多行组成。</li> <li>RowHBase 中的一行由一个行键和一个或多个列以及与之关联的值组成。 行在存储时按行键的字母顺序排序。 为此,行键的设计非常重要。 目标是以相关行彼此靠近的方式存储数据。 常见的行键模式是网站域。 如果您的行键是域您应该将它们反向存储org.apache.www、org.apache.mail、org.apache.jira。 这样,所有 Apache 域在表中彼此靠近,而不是根据子域的第一个字母展开。</li> <li>ColumnHBase 中的列由列族和列限定符组成,它们由 :(冒号)字符分隔。</li> <li>Column Family通常出于性能原因列族在物理上将一组列及其值放在一起。 每个列族都有一组存储属性,例如它的值是否应该缓存在内存中,它的数据是如何压缩的,它的行键是如何编码的,等等。 表中的每一行都有相同的列族,尽管给定的行可能不在给定的列族中存储任何内容。</li> <li>列限定符:将列限定符添加到列族以提供给定数据片段的索引。 给定列族内容,列限定符可能是 content:html另一个可能是 content:pdf。 尽管列族在表创建时是固定的,但列限定符是可变的,并且行之间可能有很大差异。</li> <li>Cell单元格是行、列族和列限定符的组合包含一个值和一个时间戳代表值的版本。</li> <li>Timestamp时间戳写在每个值旁边是给定版本值的标识符。 默认情况下,时间戳表示写入数据时 RegionServer 上的时间,但您可以在将数据放入单元格时指定不同的时间戳值。</li></ul> <p><img src="https://raw.githubusercontent.com/dunwu/images/master/cs/bigdata/hbase/1551164224778.png" alt="img"></p> <h3 id="特性比较"><a href="#特性比较" class="header-anchor">#</a> 特性比较</h3> <h4 id="hbase-vs-rdbms"><a href="#hbase-vs-rdbms" class="header-anchor">#</a> HBase vs. RDBMS</h4> <table><thead><tr><th>RDBMS</th> <th>HBase</th></tr></thead> <tbody><tr><td>RDBMS 有它的模式,描述表的整体结构的约束</td> <td>HBase 无模式,它不具有固定列模式的概念;仅定义列族</td></tr> <tr><td>支持的文件系统有 FAT、NTFS 和 EXT</td> <td>支持的文件系统只有 HDFS</td></tr> <tr><td>使用提交日志来存储日志</td> <td>使用预写日志 (WAL) 来存储日志</td></tr> <tr><td>使用特定的协调系统来协调集群</td> <td>使用 ZooKeeper 来协调集群</td></tr> <tr><td>存储的都是中小规模的数据表</td> <td>存储的是超大规模的数据表,并且适合存储宽表</td></tr> <tr><td>通常支持复杂的事务</td> <td>仅支持行级事务</td></tr> <tr><td>适用于结构化数据</td> <td>适用于半结构化、结构化数据</td></tr> <tr><td>使用主键</td> <td>使用 row key</td></tr></tbody></table> <h4 id="hbase-vs-hdfs"><a href="#hbase-vs-hdfs" class="header-anchor">#</a> HBase vs. HDFS</h4> <table><thead><tr><th>HDFS</th> <th>HBase</th></tr></thead> <tbody><tr><td>HDFS 提供了一个用于分布式存储的文件系统。</td> <td>HBase 提供面向表格列的数据存储。</td></tr> <tr><td>HDFS 为大文件提供优化存储。</td> <td>HBase 为表格数据提供了优化。</td></tr> <tr><td>HDFS 使用块文件。</td> <td>HBase 使用键值对数据。</td></tr> <tr><td>HDFS 数据模型不灵活。</td> <td>HBase 提供了一个灵活的数据模型。</td></tr> <tr><td>HDFS 使用文件系统和处理框架。</td> <td>HBase 使用带有内置 Hadoop MapReduce 支持的表格存储。</td></tr> <tr><td>HDFS 主要针对一次写入多次读取进行了优化。</td> <td>HBase 针对读/写许多进行了优化。</td></tr></tbody></table> <h4 id="行式数据库-vs-列式数据库"><a href="#行式数据库-vs-列式数据库" class="header-anchor">#</a> 行式数据库 vs. 列式数据库</h4> <table><thead><tr><th>行式数据库</th> <th>列式数据库</th></tr></thead> <tbody><tr><td>对于添加/修改操作更高效</td> <td>对于读取操作更高效</td></tr> <tr><td>读取整行数据</td> <td>仅读取必要的列数据</td></tr> <tr><td>最适合在线事务处理系统OLTP</td> <td>不适合在线事务处理系统OLTP</td></tr> <tr><td>将行数据存储在连续的页内存中</td> <td>将列数据存储在非连续的页内存中</td></tr></tbody></table> <p>列式数据库的优点:</p> <ul><li>支持数据压缩</li> <li>支持快速数据检索</li> <li>简化了管理和配置</li> <li>有利于聚合查询(例如 COUNT、SUM、AVG、MIN 和 MAX的高性能</li> <li>分区效率很高,因为它提供了自动分片机制的功能,可以将较大的区域分配给较小的区域</li></ul> <p>列式数据库的缺点:</p> <ul><li>JOIN 查询和来自多个表的数据未优化</li> <li>必须为频繁的删除和更新创建拆分,因此降低了存储效率</li> <li>由于非关系数据库的特性,分区和索引的设计非常困难</li></ul> <h2 id="hbase-安装"><a href="#hbase-安装" class="header-anchor">#</a> HBase 安装</h2> <ul><li><a href="https://hbase.apache.org/book.html#quickstart" target="_blank" rel="noopener noreferrer">独立模式<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://hbase.apache.org/book.html#quickstart_pseudo" target="_blank" rel="noopener noreferrer">伪分布式模式<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://hbase.apache.org/book.html#quickstart_fully_distributed" target="_blank" rel="noopener noreferrer">全分布式模式<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/big-data-europe/docker-hbase" target="_blank" rel="noopener noreferrer">Docker 部署<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <h2 id="hbase-hello-world-示例"><a href="#hbase-hello-world-示例" class="header-anchor">#</a> HBase Hello World 示例</h2> <ol><li><p>连接 HBase</p> <p>在 HBase 安装目录的 <code>/bin</code> 目录下执行 <code>hbase shell</code> 命令进入 HBase 控制台。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>$ ./bin/hbase shell
hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:001:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span>
</code></pre></div></li> <li><p>输入 <code>help</code> 可以查看 HBase Shell 命令。</p></li> <li><p>创建表</p> <p>可以使用 <code>create</code> 命令创建一张新表。必须要指定表名和 Column Family。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:001:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> create <span class="token string">'test'</span>, <span class="token string">'cf'</span>
<span class="token number">0</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">0.4170</span> seconds
<span class="token operator">=</span><span class="token operator">&gt;</span> Hbase::Table - <span class="token builtin class-name">test</span>
</code></pre></div></li> <li><p>列出表信息</p> <p>使用 <code>list</code> 命令来确认新建的表已存在。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:002:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> list <span class="token string">'test'</span>
TABLE
<span class="token builtin class-name">test</span>
<span class="token number">1</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">0.0180</span> seconds
<span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token punctuation">[</span><span class="token string">&quot;test&quot;</span><span class="token punctuation">]</span>
</code></pre></div><p>可以使用 <code>describe</code> 命令可以查看表的细节信息,包括配置信息</p> <div class="language-shell extra-class"><pre class="language-shell"><code>hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:003:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> describe <span class="token string">'test'</span>
Table <span class="token builtin class-name">test</span> is ENABLED
<span class="token builtin class-name">test</span>
COLUMN FAMILIES DESCRIPTION
<span class="token punctuation">{</span>NAME <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'cf'</span>, VERSIONS <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'1'</span>, EVICT_BLOCKS_ON_CLOSE <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'false'</span>, NEW_VERSION_BEHAVIOR <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'false'</span>, KEEP_DELETED_CELLS <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'FALSE'</span>, CACHE_DATA_ON_WRITE <span class="token operator">=</span><span class="token operator">&gt;</span>
<span class="token string">'false'</span>, DATA_BLOCK_ENCODING <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'NONE'</span>, TTL <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'FOREVER'</span>, MIN_VERSIONS <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'0'</span>, REPLICATION_SCOPE <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'0'</span>, BLOOMFILTER <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'ROW'</span>, CACHE_INDEX_ON_WRITE <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'f
alse'</span>, IN_MEMORY <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'false'</span>, CACHE_BLOOMS_ON_WRITE <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'false'</span>, PREFETCH_BLOCKS_ON_OPEN <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'false'</span>, COMPRESSION <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'NONE'</span>, BLOCKCACHE <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'true'</span>, BLOCKSIZE
<span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">'65536'</span><span class="token punctuation">}</span>
<span class="token number">1</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
Took <span class="token number">0.9998</span> seconds
</code></pre></div></li> <li><p>向表中写数据</p> <p>可以使用 <code>put</code> 命令向 HBase 表中写数据。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:003:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> put <span class="token string">'test'</span>, <span class="token string">'row1'</span>, <span class="token string">'cf:a'</span>, <span class="token string">'value1'</span>
<span class="token number">0</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">0.0850</span> seconds
hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:004:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> put <span class="token string">'test'</span>, <span class="token string">'row2'</span>, <span class="token string">'cf:b'</span>, <span class="token string">'value2'</span>
<span class="token number">0</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">0.0110</span> seconds
hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:005:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> put <span class="token string">'test'</span>, <span class="token string">'row3'</span>, <span class="token string">'cf:c'</span>, <span class="token string">'value3'</span>
<span class="token number">0</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">0.0100</span> seconds
</code></pre></div></li> <li><p>一次性扫描表的所有数据</p> <p>使用 <code>scan</code> 命令来扫描表数据。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:006:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> scan <span class="token string">'test'</span>
ROW COLUMN+CELL
row1 <span class="token assign-left variable">column</span><span class="token operator">=</span>cf:a, <span class="token assign-left variable">timestamp</span><span class="token operator">=</span><span class="token number">1421762485768</span>, <span class="token assign-left variable">value</span><span class="token operator">=</span>value1
row2 <span class="token assign-left variable">column</span><span class="token operator">=</span>cf:b, <span class="token assign-left variable">timestamp</span><span class="token operator">=</span><span class="token number">1421762491785</span>, <span class="token assign-left variable">value</span><span class="token operator">=</span>value2
row3 <span class="token assign-left variable">column</span><span class="token operator">=</span>cf:c, <span class="token assign-left variable">timestamp</span><span class="token operator">=</span><span class="token number">1421762496210</span>, <span class="token assign-left variable">value</span><span class="token operator">=</span>value3
<span class="token number">3</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">0.0230</span> seconds
</code></pre></div></li> <li><p>查看一行数据</p> <p>使用 <code>get</code> 命令可以查看一行表数据。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:007:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> get <span class="token string">'test'</span>, <span class="token string">'row1'</span>
COLUMN CELL
cf:a <span class="token assign-left variable">timestamp</span><span class="token operator">=</span><span class="token number">1421762485768</span>, <span class="token assign-left variable">value</span><span class="token operator">=</span>value1
<span class="token number">1</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">0.0350</span> seconds
</code></pre></div></li> <li><p>禁用表</p> <p>如果想要删除表或修改表设置,必须先使用 <code>disable</code> 命令禁用表。如果想再次启用表,可以使用 <code>enable</code> 命令。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:008:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> disable <span class="token string">'test'</span>
<span class="token number">0</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">1.1820</span> seconds
hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:009:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> <span class="token builtin class-name">enable</span> <span class="token string">'test'</span>
<span class="token number">0</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">0.1770</span> seconds
</code></pre></div></li> <li><p>删除表</p> <p>使用 <code>drop</code> 命令可以删除表。</p> <div class="language-shell extra-class"><pre class="language-shell"><code>hbase<span class="token punctuation">(</span>main<span class="token punctuation">)</span>:011:<span class="token operator"><span class="token file-descriptor important">0</span>&gt;</span> drop <span class="token string">'test'</span>
<span class="token number">0</span> row<span class="token punctuation">(</span>s<span class="token punctuation">)</span> <span class="token keyword">in</span> <span class="token number">0.1370</span> seconds
</code></pre></div></li> <li><p>退出 HBase Shell</p> <p>使用 <code>quit</code> 命令,就能退出 HBase Shell 控制台。</p></li></ol> <h2 id="参考资料"><a href="#参考资料" class="header-anchor">#</a> 参考资料</h2> <ul><li><strong>官方</strong> <ul><li><a href="http://hbase.apache.org/" target="_blank" rel="noopener noreferrer">HBase 官网<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://hbase.apache.org/book.html" target="_blank" rel="noopener noreferrer">HBase 官方文档<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="http://abloz.com/hbase/book.html" target="_blank" rel="noopener noreferrer">HBase 官方文档中文版<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li> <li><strong>书籍</strong> <ul><li><a href="https://book.douban.com/subject/27600204/" target="_blank" rel="noopener noreferrer">Hadoop 权威指南<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li> <li><strong>文章</strong> <ul><li><a href="https://static.googleusercontent.com/media/research.google.com/zh-CN//archive/bigtable-osdi06.pdf" target="_blank" rel="noopener noreferrer">Bigtable: A Distributed Storage System for Structured Data<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://mapr.com/blog/in-depth-look-hbase-architecture" target="_blank" rel="noopener noreferrer">An In-Depth Look at the HBase Architecture<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li> <li><strong>教程</strong> <ul><li>https://github.com/heibaiying/BigData-Notes</li> <li>https://www.cloudduggu.com/hbase/introduction/</li></ul></li></ul></div></div> <div class="page-edit"><div class="edit-link"><a href="https://github.com/dunwu/db-tutorial/edit/master/docs/12.数据库/06.列式数据库/01.HBase/01.HBase快速入门.md" target="_blank" rel="noopener noreferrer">📝 帮助改善此页面!</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="tags"><a href="/db-tutorial/tags/?tag=%E6%95%B0%E6%8D%AE%E5%BA%93" title="标签">#数据库</a><a href="/db-tutorial/tags/?tag=%E5%88%97%E5%BC%8F%E6%95%B0%E6%8D%AE%E5%BA%93" title="标签">#列式数据库</a><a href="/db-tutorial/tags/?tag=%E5%A4%A7%E6%95%B0%E6%8D%AE" title="标签">#大数据</a><a href="/db-tutorial/tags/?tag=HBase" title="标签">#HBase</a></div> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2024/10/09, 07:16:02</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/db-tutorial/pages/537098/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">Redis 运维</div></a> <a href="/db-tutorial/pages/c8cfeb/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">HBase 数据模型</div></a></div> <div class="page-nav"><p class="inner"><span class="prev">
<a href="/db-tutorial/pages/537098/" class="prev">Redis 运维</a></span> <span class="next"><a href="/db-tutorial/pages/c8cfeb/">HBase 数据模型</a>
</span></p></div></div></div> <div class="article-list"><div class="article-title"><a href="/db-tutorial/archives/" class="iconfont icon-bi">最近更新</a></div> <div class="article-wrapper"><dl><dd>01</dd> <dt><a href="/db-tutorial/pages/b59ba2/"><div>
HBase Java API 管理功能
<!----></div></a> <span class="date">04-13</span></dt></dl><dl><dd>02</dd> <dt><a href="/db-tutorial/pages/ce5ca0/"><div>
HBase Java API 其他高级特性
<!----></div></a> <span class="date">03-31</span></dt></dl><dl><dd>03</dd> <dt><a href="/db-tutorial/pages/c8cfeb/"><div>
HBase 数据模型
<!----></div></a> <span class="date">03-16</span></dt></dl> <dl><dd></dd> <dt><a href="/db-tutorial/archives/" class="more">更多文章&gt;</a></dt></dl></div></div></main></div> <div class="footer"><div class="icons"><a href="mailto:forbreak@163.com" title="发邮件" target="_blank" class="iconfont icon-youjian"></a><a href="https://github.com/dunwu" title="GitHub" target="_blank" class="iconfont icon-github"></a></div>
Theme by
<a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a>
| Copyright © 2019-2024
<span>钝悟dunwu | CC-BY-SA-4.0</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
跟随系统
</li><li class="iconfont icon-rijianmoshi">
浅色模式
</li><li class="iconfont icon-yejianmoshi">
深色模式
</li><li class="iconfont icon-yuedu">
阅读模式
</li></ul></div></div> <!----> <!----> <div class="custom-html-window custom-html-window-rb" style="display:;"><div class="custom-wrapper"><span class="close-but">×</span> <div>
<div class="wwads-cn wwads-vertical windowRB" data-id="261" style="max-width:160px;
min-width: auto;min-height:auto;"></div>
<style>
.windowRB{ padding: 0;}
.windowRB .wwads-img{margin-top: 10px;}
.windowRB .wwads-content{margin: 0 10px 40px 10px;}
.custom-html-window-rb .close-but{
display: none;
}
</style>
</div></div></div></div><div class="global-ui"><div></div></div></div>
<script src="/db-tutorial/assets/js/app.be3f2e92.js" defer></script><script src="/db-tutorial/assets/js/2.aded268b.js" defer></script><script src="/db-tutorial/assets/js/54.340ab690.js" defer></script>
</body>
</html>