1.2. Quick Start
This guide describes setup of a standalone HBase instance. It will run against the local filesystem. In later sections we will take you through how to run HBase on HDFS, a distributed filesystem. This section leads you through creating a table, inserting rows via the HBase shell, and then cleaning up and shutting down your standalone, local filesystem HBase instance. The below exercise should take no more than ten minutes (not including download time).
Local Filesystem and Durability
Using HBase with a LocalFileSystem does not currently guarantee durability. You need to run HBase on HDFS to ensure all writes are preserved. Running against the local filesystem though will get you off the ground quickly and get you familiar with how the general system works so lets run with it for now. See https://issues.apache.org/jira/browse/HBASE-3696 and its associated issues for more details.
Loopback IP
The below advice is for hbase-0.94.0 (and older) versions; we believe this fixed in hbase-0.96.0 and beyond (let us know if we have it wrong) -- there should be no need of modification to /etc/hosts
.
HBase expects the loopback IP address to be 127.0.0.1. Ubuntu and some other distributions, for example, will default to 127.0.1.1 and this will cause problems for you [1].
/etc/hosts
should look something like this:
127.0.0.1 localhost
127.0.0.1 ubuntu.ubuntu-domain ubuntu
Choose a download site from this list of Apache Download Mirrors. Click on the suggested top link. This will take you to a mirror of HBase Releases. Click on the folder named stable
and then download the file that ends in .tar.gz
to your local filesystem; e.g. hbase-0.94.2.tar.gz
.
Decompress and untar your download and then change into the unpacked directory.
$ tar xfz hbase-0.97.0-SNAPSHOT.tar.gz
$ cd hbase-0.97.0-SNAPSHOT
At this point, you are ready to start HBase. But before starting it, edit conf/hbase-site.xml
, the file you write your site-specific configurations into. Set hbase.rootdir
, the directory HBase writes data to, and hbase.zookeeper.property.dataDir
, the directory ZooKeeper writes its data too:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///DIRECTORY/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/DIRECTORY/zookeeper</value>
</property>
</configuration>
Replace DIRECTORY
in the above with the path to the directory you would have HBase and ZooKeeper write their data. By default, hbase.rootdir
is set to /tmp/hbase-${user.name}
and similarly so for the default ZooKeeper data location which means you'll lose all your data whenever your server reboots unless you change it (Most operating systems clear /tmp
on restart).
Now start HBase:
$ ./bin/start-hbase.sh
starting Master, logging to logs/hbase-user-master-example.org.out
You should now have a running standalone HBase instance. In standalone mode, HBase runs all daemons in the the one JVM; i.e. both the HBase and ZooKeeper daemons. HBase logs can be found in the logs
subdirectory. Check them out especially if it seems HBase had trouble starting.
Is java installed?
All of the above presumes a 1.6 version of Oracle java is installed on your machine and available on your path (See Section 2.1.1, “Java”); i.e. when you type java, you see output that describes the options the java program takes (HBase requires java 6). If this is not the case, HBase will not start. Install java, edit conf/hbase-env.sh
, uncommenting the JAVA_HOME
line pointing it to your java install, then, retry the steps above.
Connect to your running HBase via the shell.
$ ./bin/hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version: 0.90.0, r1001068, Fri Sep 24 13:55:42 PDT 2010
hbase(main):001:0>
Type help and then <RETURN> to see a listing of shell commands and options. Browse at least the paragraphs at the end of the help emission for the gist of how variables and command arguments are entered into the HBase shell; in particular note how table names, rows, and columns, etc., must be quoted.
Create a table named test
with a single column family named cf
. Verify its creation by listing all tables and then insert some values.
hbase(main):003:0> create 'test', 'cf'
0 row(s) in 1.2200 seconds
hbase(main):003:0> list 'test'
..
1 row(s) in 0.0550 seconds
hbase(main):004:0> put 'test', 'row1', 'cf:a', 'value1'
0 row(s) in 0.0560 seconds
hbase(main):005:0> put 'test', 'row2', 'cf:b', 'value2'
0 row(s) in 0.0370 seconds
hbase(main):006:0> put 'test', 'row3', 'cf:c', 'value3'
0 row(s) in 0.0450 seconds
Above we inserted 3 values, one at a time. The first insert is at row1
, column cf:a
with a value of value1
. Columns in HBase are comprised of a column family prefix -- cf
in this example -- followed by a colon and then a column qualifier suffix (a
in this case).
Verify the data insert by running a scan of the table as follows
hbase(main):007:0> scan 'test'
ROW COLUMN+CELL
row1 column=cf:a, timestamp=1288380727188, value=value1
row2 column=cf:b, timestamp=1288380738440, value=value2
row3 column=cf:c, timestamp=1288380747365, value=value3
3 row(s) in 0.0590 seconds
Get a single row
hbase(main):008:0> get 'test', 'row1'
COLUMN CELL
cf:a timestamp=1288380727188, value=value1
1 row(s) in 0.0400 seconds
Now, disable and drop your table. This will clean up all done above.
hbase(main):012:0> disable 'test'
0 row(s) in 1.0930 seconds
hbase(main):013:0> drop 'test'
0 row(s) in 0.0770 seconds
Exit the shell by typing exit.
hbase(main):014:0> exit
Stop your hbase instance by running the stop script.
$ ./bin/stop-hbase.sh
stopping hbase...............
转自:http://hbase.apache.org/book/quickstart.html
相关推荐
You will then learn about the Hadoop ecosystem, and tools such as Kafka, Sqoop, Flume, Pig, Hive, and HBase. Finally, you will look at advanced topics, including real time streaming using Apache Storm...
在IT行业中,尤其是在大数据处理领域,HBase是一个广泛使用的分布式、高性能、列式存储的NoSQL数据库。HBase是建立在Hadoop文件系统(HDFS)之上,为处理大规模数据提供了一个高效的数据存储解决方案。而Spring Data...
HBase入门和使用知识点总结: 1. HBase基本介绍: HBase是建立在Hadoop文件系统(HDFS)之上的一种开源、分布式、可扩展的非关系型数据库。它是一种列式存储系统,模仿Google的Bigtable模型,适用于海量数据的实时...
2. 启动HBase,使用bin/start-hbase.sh命令。 3. 启动HBase shell,使用bin/hbase shell命令。输入status命令以查看状态。 六、HBase的基本概念 HBase是一个分布式的、基于列模式的架构,在Apache Hadoop和Apache ...
HBase 详细安装步骤 HBase 是一个分布式、面向列的 NoSQL ...3. 运行 hbase——start-hbase.sh 4. 运行 jps 查看是否运行成功 注意:在安装过程中,需要授予权限和修改配置文件,以确保 HBase 安装和运行成功。
完成以上配置后,在主服务器上启动 Hadoop 服务,使用命令 `start-all.sh`,然后在 HBase 的 `bin` 目录下使用 `start-hbase.sh` 命令来启动 HBase。 ##### 5. 验证服务状态 最后,通过 `jps` 命令来验证 Hadoop ...
在命令行中,可以使用`start-hbase.sh`来启动HBase的Master节点和服务进程。Master节点负责表和Region的管理,RegionServer则是实际的数据存储和处理节点。 在HBase启动过程中,它会读取配置文件,初始化系统组件,...
搭建pinpoint需要的hbase初始化脚本hbase-create.hbase
bin/start-hbase.sh ``` 3. **进入 HBase Shell**:启动完成后,可以通过命令 `bin/hbaseshell` 进入 HBase 命令行工具。 4. **验证数据**:在 HBase Shell 中执行 `list` 命令,检查是否有数据存在。 ```bash...
5. 启动HBase:执行`./bin/start-hbase.sh`命令启动所有HBase进程。 6. 检查HBase是否正常启动:可以通过Web UI(默认端口是60010)或者命令行工具`hbase shell`来验证。 在实际应用中,你可能还需要学习如何创建表...
deploy.sh start single 启动hbase实例 deploy.sh stop single 停止hbase实例 deploy.sh check single 检测hbase实例状态 deploy.sh connect single 连接hbase实例 deploy.sh clear single *危险操作* 清除...
4. 启动HBase:运行`bin/start-hbase.sh`启动所有HBase服务,包括Master、RegionServer等。 三、HBase操作 1. 创建表:使用`hbase shell`进入命令行工具,执行`create '表名', '列族名'`创建表。 2. 插入数据:...
HBase是一种分布式、基于列族的NoSQL数据库,由Apache软件基金会开发并维护,是Hadoop生态系统中的重要组件。这份“HBase官方文档中文版”提供了全面深入的HBase知识,帮助用户理解和掌握如何在大数据场景下有效地...
### HBase权威指南知识点概述 #### 一、引言与背景 - **大数据时代的来临**:随着互联网技术的发展,人类社会产生了前所未为的数据量。这些数据不仅数量巨大,而且种类繁多,传统的数据库系统难以应对这样的挑战。 ...
6. **启动HBase**:使用HBase提供的`start-hbase.sh`脚本启动HBase集群。如果是单机测试,可以使用`start-hbase.sh --master local`。 7. **检查状态**:通过`hbase shell`进入HBase的命令行界面,使用`status`命令...
HBase是一种分布式、基于列族的NoSQL数据库,它在大数据领域中扮演着重要的角色,尤其是在需要实时查询大规模数据集时。HBase以其高吞吐量、低延迟和水平扩展能力而闻名,常用于存储非结构化和半结构化数据。在HBase...
### HBase开启审计日志详解 #### 一、概述 HBase是一款分布式列式存储系统,基于Google的Bigtable论文实现。它具有高可靠性、高性能、面向列、可伸缩的特点,非常适合处理海量数据。在大数据领域,HBase被广泛用于...
start-hbase.sh ``` HBase提供了一套丰富的命令行接口(HBase Shell),可以用来创建表、插入数据、查询数据等。例如,创建一个名为`users`的表,包含`info`和`friends`两个列族: ```bash hbase(main):001:0> ...
start-hbase.sh 访问HBase 最后,我们可以通过Web界面来访问HBase的状态信息: localhost:16010/master-status 这时,我们可以看到HBase的一些状态信息,如region servers、master server等。 HBase单机版部署...
HBase(hbase-2.4.9-bin.tar.gz)是一个分布式的、面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”。就像Bigtable利用了Google文件系统(File System...