HBase Getting Started(入门指南)

3)检查过程是否运行

在集聚众多中之每个节点,运行jps命令检查每个服务是否健康运作。你恐怕会见看出其他用于其它目的Java进程也运行在。

Example 2.node-ajpsOutput**

$ jps

20355 Jps

20071 HQuorumPeer

20137 HMaster

Example 3.node-bjpsOutput**

$ jps

15930 HRegionServer

16194 Jps

15838 HQuorumPeer

16010 HMaster

Example 4.node-ajpsOutput**

$ jps

13901 Jps

13639 HQuorumPeer

13737 HRegionServer

ZooKeeper进程名字

HQuorumPeer 进程就是ZooKeeper实例由HBase启动用来决定HBase的。如果您于此以ZooKeeper,那么会限制集众多中每个节点有一个实例并且就适用于测试。如果ZooKeeper运行在HBase之外,那么进程名也QuorumPeer。请到zookeeper查看更多关于ZooKeeper配置包括要就此外表ZooKeeper控制HBase。

办公逸于2015年7月上线运营,截止2017年11月,注册合作社越7万家,员工过600万,在华夏信用社劳动
SaaS中排名前列。办公逸已落知名投资机构启赋资本、松禾资本、老鹰基金、雷雨资本的数千万首届投资以及领先的自由职业者综合服务平台爱员工的战略性投资。

1)如果HBase还当运行请已其

要你都完结quickstart中之指导并且HBase仍然在运转,请已外。这个进程用创设一个新的目来存储它的数量,所以之前若创造的数据库将会少。

每当报到环节,除了3D签到和签到上墙等倍受欢迎的效应外,3.0本子还新增了手写签到效果,酷炫的相互方式,让业主第一时间点赞,让年会掀起第一波高潮;自定义之年会背景功能提供了多种摘,企业只是组成本人VI标准色使用,无需单独设计;公司LOGO与年会主题与充分展示,更加会激起职工肾上腺素,增强职工的凝聚力与往心力!

1)下载和解压HBase.

每当node-b下下载和解压HBase,跟你在quickstart和伪分布式中所召开的等同。

此次众签和办公逸的搭档不仅是为平糟到年会的见,更是公司级SaaS服务之多元化展示。相信在非远之未来,众签与办公逸将继承在行业深耕,以美好的产品体验及服务,驱动更多号级劳动成功走向应用,从而成为极端值得托付的商家服务平台。

4)测试无密钥登陆.

使所有运行顺畅的言辞,那么您得用SSH用相同之用户称如不需密钥的情下登陆其他节点。

5)因为node-b将见面运作一个备用Master,重复上述的进程,将能够观看底node-a都变成node-b。确保不要挂已在的.ssh/authorized_keys的文档,但足以就此>>符号将密钥追加至曾经存在的文档后面。

在暖场环节,办公逸提供了季栽玩法:疯狂摇头一摇、开心数钞票、留言及墙以及炫酷弹幕,每种玩法还突破传统,在微信端直接互动,全员参与、公平公正。在抽奖方式层面,办公逸微信年会3.0本子新增了幸运福袋,大大丰富了年会整个流程中极度重要一环的玩法,大屏幕抽奖、抢红包、幸运大转盘大大刺激了百姓的彼此感官;而留言抽奖这等同聊有点的效力,极大提升了员工的互动性。通过微信年会,节目评选可天天进行,全部节目献艺了即可现场打分,增强年会的当场氛围,这也是办公逸产品研发的暖心举措之一。

2.2. 上马下 HBase

过去,组织同集市伟大上之年会总让人力资源部门身心疲惫,但办公逸的微信年会采取也公司年会服务做了到家优化。办公逸3.0本子年会最老用变化体现于服务延伸层面,免费提供成千上万卖年会筹备资料,从创意策划、年会设计、节目编排,现场签到、暖场互动、节目评选等环节,提供多种缓解方案。

赢得一行的数据

因而get命令一次等拿走一行数

hbase(main):007:0> get ‘test’, ‘row1’

COLUMN                                   CELL

cf:a                                    timestamp=1421762485768,
value=value1

1 row(s) in 0.0350 seconds

办公逸是领先的智能人力资源管理公司(AI HR
SaaS),致力为用前方科技融入人力资源管理,提升HR工作效率,辅助企业做出还好之人力资源决策。办公逸已发表智能考试勤机、智能考勤系统、智能人事、智能薪酬、智能文化等五非常智能HR解决方案,可大幅增强人事管理效率,提升职工满意度。办公逸也当努力探索,在招聘、面试、人才挽留等世界,如何用人工智能(AI)、大数据以及机器人也铺面提供再智能的缓解方案,帮助企业招到当的人,留住合适的口。

退出HBase Shell

使用exit来和HBase断开连接,但HBase仍然当后台运行

近来,领先的一律站式人力资源管理云服务提供商办公逸与成千上万签上深度合作意向,双方充分发挥本业领域资源以及正式还优势,运用科技和法律手段服务被店市场。

2)启动集群

以node-a上,运行start-hbase.sh命令。就会见起有类似下面的出口:

$ bin/start-hbase.sh

node-c.example.com: starting zookeeper, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-zookeeper-node-c.example.com.out

node-a.example.com: starting zookeeper, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-zookeeper-node-a.example.com.out

node-b.example.com: starting zookeeper, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-zookeeper-node-b.example.com.out

starting master, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-master-node-a.example.com.out

node-c.example.com: starting regionserver, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-regionserver-node-c.example.com.out

node-b.example.com: starting regionserver, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-regionserver-node-b.example.com.out

node-b.example.com: starting master, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-master-nodeb.example.com.out

预先启动ZooKeeper,接着master,然后RegionServers,最后是备用masters。

办公逸年会采取上线以来,世界/中国500胜公司,国内赫赫有名企事业数百小知名企业都选办公逸作为年会应用服务商。办公逸的起全面提高了店家年会执行效率,提升了号员工为心力。

8)停止 HBase

汝可以应用quickstart受到阐述的指令bin/stop-hbase.sh来停止HBase。

直至2017年11月,众签电子合同服务平台已为20基本上万家庄用户、1000差不多万个人用户提供全流程电子合同服务,电子合同签名总量已经突破1亿。目前,众签已为互联网经济、供应链、电子商务、旅游、保险、政府、人力资源等20几近只行业用户提供电子合同服务,典型客户包括人们贷、中国网库、银联商务、百安居、中银保险、中航工业、58至下、爱回收、海底捞、中信银行等。

插数据及表中

动put命令来插入数据.

hbase(main):003:0> put ‘test’, ‘row1’, ‘cf:a’, ‘value1’

0 row(s) in 0.0850 seconds

hbase(main):004:0> put ‘test’, ‘row2’, ‘cf:b’, ‘value2’

0 row(s) in 0.0110 seconds

hbase(main):005:0> put ‘test’, ‘row3’, ‘cf:c’, ‘value3’

0 row(s) in 0.0100 seconds

以此,我们每次插入一长达数,总共三长长的。第一潮将value1插入到row1,列cf:a中。HBase中的排列以列族名也前缀,例子中凡是cf,后面是冒号和排的范围符后缀,例子中是a。

群签是同下安全电子合同服务机关,成立于2013年12月,一直以来专注让电子合同关键技术应用之研讨与应用服务推广。旨在为用户提供实名认证、数字证书、合同转换、在线签署、存证保全和司法落地等全流程电子合同服务,帮助用户实现合同全程在线签署和管制,提高合同签约效率、降低合同管理资本等。

过程:预备node-a**

node-a将会运行主master和ZooKeeper进程,但是尚未RegionServers。在node-a将RegionServer停掉。

5)当节点还是服务没有时测试一下生出了呀

正巧使您安排的老三独节点,事情并无总是要你所想。你可以透过杀进程观察log来探当主Master或者RegionServer消失时发生了什么?

2)将node-b配置也一个备用master。

因此于conf/目录下创办一个称也backup-master的新文件,然后上加一行node-b的主机名。在斯示例当中,主机名吧node-b.example.com

1)确保其他节点上尚未运行HBase

只要您于之前测试中忘记停止HBase,就见面出错。用jps命令执行检查HBase是否运行。看看HMaster,HRegionServer和HQuorumPeer是否留存,如果有,那么杀掉。

2.1. JDK 版本要求

HBase
需要安装JDK。查看Java来抱每个HBase版本所支撑之JDK版本。

一如既往涂鸦查看所有数据

应用scan命令行来围观表格的数额。你得界定而的扫描,但是目前,所有的数据都受得了。

hbase(main):006:0> scan ‘test’

ROW                                      COLUMN+CELL

row1                                    column=cf:a,
timestamp=1421762485768, value=value1

row2                                    column=cf:b,
timestamp=1421762491785, value=value2

row3                                    column=cf:c,
timestamp=1421762496210, value=value3

3 row(s) in 0.0230 seconds

Hadoop配置

这个进程假要你曾经以当地系统要远程系统受到配置好Hadoop和HDFS,并且能运转及包可用。也只要你以Hadoop2.Setting
up a Single Node
Cluster以指引如何搭建单节点Hadoop

脚是原文


Getting Started

  1. Introduction

Quickstartwill
get you up and running on a single-node, standalone instance of HBase.

  1. Quick Start – Standalone HBase

This section describes the setup of a single-node standalone HBase.
Astandaloneinstance has all HBase daemons — the Master, RegionServers,
and ZooKeeper — running in a single JVM persisting to the local
filesystem. It is our most basic deploy profile. We will show you how to
create a table in HBase using thehbase shellCLI, insert rows into the
table, perform put and scan operations against the table, enable or
disable the table, and start and stop HBase.

Apart from downloading HBase, this procedure should take less than 10
minutes.

Prior to HBase 0.94.x, HBase expected the loopback IP address to be
127.0.0.1. Ubuntu and some other distributions default to 127.0.1.1 and
this will cause problems for you. SeeWhy does HBase care about
/etc/hosts?for
detail

The following/etc/hostsfile works correctly for HBase 0.94.x and
earlier, on Ubuntu. Use this as a template if you run into trouble.

127.0.0.1 localhost

127.0.0.1 ubuntu.ubuntu-domain ubuntu

This issue has been fixed in hbase-0.96.0 and beyond.

2.1. JDK Version Requirements

HBase requires that a JDK be installed.
SeeJavafor
information about supported JDK versions.

2.2. Get Started with HBase

Procedure: Download, Configure, and Start HBase in Standalone Mode

Choose a download site from this list ofApache Download
Mirrors.
Click on the suggested top link. This will take you to a mirror ofHBase
Releases
. Click on the folder namedstableand then download the binary
file that ends in.tar.gzto your local filesystem. Do not download the
file ending insrc.tar.gzfor now.

Extract the downloaded file, and change to the newly-created directory.

$ tar xzvf hbase-2.0.0-SNAPSHOT-bin.tar.gz

$ cd hbase-2.0.0-SNAPSHOT/

You are required to set theJAVA_HOMEenvironment variable before
starting HBase. You can set the variable via your operating system’s
usual mechanism, but HBase provides a central
mechanism,conf/hbase-env.sh. Edit this file, uncomment the line
starting withJAVA_HOME, and set it to the appropriate location for your
operating system. TheJAVA_HOMEvariable should be set to a directory
which contains the executable filebin/java. Most modern Linux
operating systems provide a mechanism, such as /usr/bin/alternatives on
RHEL or CentOS, for transparently switching between versions of
executables such as Java. In this case, you can setJAVA_HOMEto the
directory containing the symbolic link tobin/java, which is
usually/usr.

JAVA_HOME=/usr

Editconf/hbase-site.xml, which is the main HBase configuration file.
At this time, you only need to specify the directory on the local
filesystem where HBase and ZooKeeper write data. By default, a new
directory is created under /tmp. Many servers are configured to delete
the contents of/tmpupon reboot, so you should store the data
elsewhere. The following configuration will store HBase’s data in
thehbasedirectory, in the home directory of the user calledtestuser.
Paste thetags beneath thetags, which should be empty in a new HBase
install.

Example 1. Examplehbase-site.xmlfor Standalone HBase

hbase.rootdirfile:///home/testuser/hbasehbase.zookeeper.property.dataDir/home/testuser/zookeeper

You do not need to create the HBase data directory. HBase will do this
for you. If you create the directory, HBase will attempt to do a
migration, which is not what you want.

Thehbase.rootdirin the above example points to a directory in
thelocal filesystem. The ‘file:/’ prefix is how we denote local
filesystem. To home HBase on an existing instance of HDFS, set
thehbase.rootdirto point at a directory up on your instance:
e.g.hdfs://namenode.example.org:8020/hbase. For more on this variant,
see the section below on Standalone HBase over HDFS.

Thebin/start-hbase.shscript is provided as a convenient way to start
HBase. Issue the command, and if all goes well, a message is logged to
standard output showing that HBase started successfully. You can use
thejpscommand to verify that you have one running process calledHMaster.
In standalone mode HBase runs all daemons within this single JVM, i.e.
the HMaster, a single HRegionServer, and the ZooKeeper daemon. Go
tohttp://localhost:16010to
view the HBase Web UI.

Java needs to be installed and available. If you get an error indicating
that Java is not installed, but it is on your system, perhaps in a
non-standard location, edit theconf/hbase-env.shfile and modify
theJAVA_HOMEsetting to point to the directory that
containsbin/javayour system.

Procedure: Use HBase For the First Time

Connect to HBase.

Connect to your running instance of HBase using thehbase shellcommand,
located in thebin/directory of your HBase install. In this example,
some usage and version information that is printed when you start HBase
Shell has been omitted. The HBase Shell prompt ends with a>character.

$ ./bin/hbase shell

hbase(main):001:0>

Display HBase Shell Help Text.

Typehelpand press Enter, to display some basic usage information for
HBase Shell, as well as several example commands. Notice that table
names, rows, columns all must be enclosed in quote characters.

Create a table.

Use thecreatecommand to create a new table. You must specify the table
name and the ColumnFamily name.

hbase(main):001:0> create ‘test’, ‘cf’

0 row(s) in 0.4170 seconds

=> Hbase::Table – test

List Information About your Table

Use thelistcommand to

hbase(main):002:0> list ‘test’

TABLE

test

1 row(s) in 0.0180 seconds

=> [“test”]

Put data into your table.

To put data into your table, use theputcommand.

hbase(main):003:0> put ‘test’, ‘row1’, ‘cf:a’, ‘value1’

0 row(s) in 0.0850 seconds

hbase(main):004:0> put ‘test’, ‘row2’, ‘cf:b’, ‘value2’

0 row(s) in 0.0110 seconds

hbase(main):005:0> put ‘test’, ‘row3’, ‘cf:c’, ‘value3’

0 row(s) in 0.0100 seconds

Here, we insert three values, one at a time. The first insert is atrow1,
columncf:a, with a value ofvalue1. Columns in HBase are comprised of a
column family prefix,cfin this example, followed by a colon and then a
column qualifier suffix,ain this case.

Scan the table for all data at once.

One of the ways to get data from HBase is to scan. Use thescancommand to
scan the table for data. You can limit your scan, but for now, all data
is fetched.

hbase(main):006:0> scan ‘test’

ROW                                      COLUMN+CELL

row1                                    column=cf:a,
timestamp=1421762485768, value=value1

row2                                    column=cf:b,
timestamp=1421762491785, value=value2

row3                                    column=cf:c,
timestamp=1421762496210, value=value3

3 row(s) in 0.0230 seconds

Get a single row of data.

To get a single row of data at a time, use thegetcommand.

hbase(main):007:0> get ‘test’, ‘row1’

COLUMN                                  CELL

cf:a                                    timestamp=1421762485768,
value=value1

1 row(s) in 0.0350 seconds

Disable a table.

If you want to delete a table or change its settings, as well as in some
other situations, you need to disable the table first, using
thedisablecommand. You can re-enable it using theenablecommand.

hbase(main):008:0> disable ‘test’

0 row(s) in 1.1820 seconds

hbase(main):009:0> enable ‘test’

0 row(s) in 0.1770 seconds

Disable the table again if you tested theenablecommand above:

hbase(main):010:0> disable ‘test’

0 row(s) in 1.1820 seconds

Drop the table.

To drop (delete) a table, use thedropcommand.

hbase(main):011:0> drop ‘test’

0 row(s) in 0.1370 seconds

Exit the HBase Shell.

To exit the HBase Shell and disconnect from your cluster, use
thequitcommand. HBase is still running in the background.

Procedure: Stop HBase

In the same way that thebin/start-hbase.shscript is provided to
conveniently start all HBase daemons, thebin/stop-hbase.shscript stops
them.

$ ./bin/stop-hbase.sh

stopping hbase………………..

$

After issuing the command, it can take several minutes for the processes
to shut down. Use thejpsto be sure that the HMaster and HRegionServer
processes are shut down.

The above has shown you how to start and stop a standalone instance of
HBase. In the next sections we give a quick overview of other modes of
hbase deploy.

2.3. Pseudo-Distributed Local Install

After working your way
throughquickstartstandalone
mode, you can re-configure HBase to run in pseudo-distributed mode.
Pseudo-distributed mode means that HBase still runs completely on a
single host, but each HBase daemon (HMaster, HRegionServer, and
ZooKeeper) runs as a separate process: in standalone mode all daemons
ran in one jvm process/instance. By default, unless you configure
thehbase.rootdirproperty as described
inquickstart,
your data is still stored in/tmp/. In this walk-through, we store your
data in HDFS instead, assuming you have HDFS available. You can skip the
HDFS configuration to continue storing your data in the local
filesystem.

Hadoop Configuration

This procedure assumes that you have configured Hadoop and HDFS on your
local system and/or a remote system, and that they are running and
available. It also assumes you are using Hadoop 2. The guide onSetting
up a Single Node
Clusterin
the Hadoop documentation is a good starting point.

Stop HBase if it is running.

If you have just
finishedquickstartand
HBase is still running, stop it. This procedure will create a totally
new directory where HBase will store its data, so any databases you
created before will be lost.

Configure HBase.

Edit thehbase-site.xmlconfiguration. First, add the following
property. which directs HBase to run in distributed mode, with one JVM
instance per daemon.

hbase.cluster.distributedtrue

Next, change thehbase.rootdirfrom the local filesystem to the address of
your HDFS instance, using thehdfs:////URI syntax. In this example, HDFS
is running on the localhost at port 8020.

hbase.rootdirhdfs://localhost:8020/hbase

You do not need to create the directory in HDFS. HBase will do this for
you. If you create the directory, HBase will attempt to do a migration,
which is not what you want.

Start HBase.

Use thebin/start-hbase.shcommand to start HBase. If your system is
configured correctly, thejpscommand should show the HMaster and
HRegionServer processes running.

Check the HBase directory in HDFS.

If everything worked correctly, HBase created its directory in HDFS. In
the configuration above, it is stored in/hbase/on HDFS. You can use
thehadoop fscommand in Hadoop’sbin/directory to list this directory.

$ ./bin/hadoop fs -ls /hbase

Found 7 items

drwxr-xr-x  – hbase users          0 2014-06-25 18:58 /hbase/.tmp

drwxr-xr-x  – hbase users          0 2014-06-25 21:49 /hbase/WALs

drwxr-xr-x  – hbase users          0 2014-06-25 18:48 /hbase/corrupt

drwxr-xr-x  – hbase users          0 2014-06-25 18:58 /hbase/data

-rw-r–r–  3 hbase users        42 2014-06-25 18:41 /hbase/hbase.id

-rw-r–r–  3 hbase users          7 2014-06-25 18:41
/hbase/hbase.version

drwxr-xr-x  – hbase users          0 2014-06-25 21:49 /hbase/oldWALs

Create a table and populate it with data.

You can use the HBase Shell to create a table, populate it with data,
scan and get values from it, using the same procedure as inshell
exercises.

Start and stop a backup HBase Master (HMaster) server.

Running multiple HMaster instances on the same hardware does not make
sense in a production environment, in the same way that running a
pseudo-distributed cluster does not make sense for production. This step
is offered for testing and learning purposes only.

The HMaster server controls the HBase cluster. You can start up to 9
backup HMaster servers, which makes 10 total HMasters, counting the
primary. To start a backup HMaster, use thelocal-master-backup.sh. For
each backup master you want to start, add a parameter representing the
port offset for that master. Each HMaster uses three ports (16010,
16020, and 16030 by default). The port offset is added to these ports,
so using an offset of 2, the backup HMaster would use ports 16012,
16022, and 16032. The following command starts 3 backup servers using
ports 16012/16022/16032, 16013/16023/16033, and 16015/16025/16035.

$ ./bin/local-master-backup.sh 2 3 5

To kill a backup master without killing the entire cluster, you need to
find its process ID (PID). The PID is stored in a file with a name
like/tmp/hbase-USER-X-master.pid. The only contents of the file is the
PID. You can use thekill -9command to kill that PID. The following
command will kill the master with port offset 1, but leave the cluster
running:

$ cat /tmp/hbase-testuser-1-master.pid |xargs kill -9

Start and stop additional RegionServers

The HRegionServer manages the data in its StoreFiles as directed by the
HMaster. Generally, one HRegionServer runs per node in the cluster.
Running multiple HRegionServers on the same system can be useful for
testing in pseudo-distributed mode. Thelocal-regionservers.shcommand
allows you to run multiple RegionServers. It works in a similar way to
thelocal-master-backup.shcommand, in that each parameter you provide
represents the port offset for an instance. Each RegionServer requires
two ports, and the default ports are 16020 and 16030. However, the base
ports for additional RegionServers are not the default ports since the
default ports are used by the HMaster, which is also a RegionServer
since HBase version 1.0.0. The base ports are 16200 and 16300 instead.
You can run 99 additional RegionServers that are not a HMaster or backup
HMaster, on a server. The following command starts four additional
RegionServers, running on sequential ports starting at 16202/16302 (base
ports 16200/16300 plus 2).

$ .bin/local-regionservers.sh start 2 3 4 5

To stop a RegionServer manually, use thelocal-regionservers.shcommand
with thestopparameter and the offset of the server to stop.

$ .bin/local-regionservers.sh stop 3

Stop HBase.

You can stop HBase the same way as in
thequickstartprocedure,
using thebin/stop-hbase.shcommand.

2.4. Advanced – Fully Distributed

In reality, you need a fully-distributed configuration to fully test
HBase and to use it in real-world scenarios. In a distributed
configuration, the cluster contains multiple nodes, each of which runs
one or more HBase daemon. These include primary and backup Master
instances, multiple ZooKeeper nodes, and multiple RegionServer nodes.

This advanced quickstart adds two more nodes to your cluster. The
architecture will be as follows:

Table 1. Distributed Cluster Demo Architecture

Node NameMasterZooKeeperRegionServer

node-a.example.com

yes

yes

no

node-b.example.com

backup

yes

yes

node-c.example.com

no

yes

yes

This quickstart assumes that each node is a virtual machine and that
they are all on the same network. It builds upon the previous
quickstart,Pseudo-Distributed Local
Install,
assuming that the system you configured in that procedure is nownode-a.
Stop HBase onnode-abefore continuing.

Be sure that all the nodes have full access to communicate, and that no
firewall rules are in place which could prevent them from talking to
each other. If you see any errors likeno route to host, check your
firewall.

Procedure: Configure Passwordless SSH Access

node-aneeds to be able to log intonode-bandnode-c(and to itself) in
order to start the daemons. The easiest way to accomplish this is to use
the same username on all hosts, and configure password-less SSH login
fromnode-ato each of the others.

Onnode-a, generate a key pair.

While logged in as the user who will run HBase, generate a SSH key pair,
using the following command:

$ ssh-keygen -t rsa

If the command succeeds, the location of the key pair is printed to
standard output. The default name of the public key isid_rsa.pub.

Create the directory that will hold the shared keys on the other nodes.

Onnode-bandnode-c, log in as the HBase user and create a.ssh/directory
in the user’s home directory, if it does not already exist. If it
already exists, be aware that it may already contain other keys.

Copy the public key to the other nodes.

Securely copy the public key fromnode-ato each of the nodes, by using
thescpor some other secure means. On each of the other nodes, create a
new file called.ssh/authorized_keysif it does not already exist, and
append the contents of theid_rsa.pubfile to the end of it. Note that
you also need to do this fornode-aitself.

$ cat id_rsa.pub >> ~/.ssh/authorized_keys

Test password-less login.

If you performed the procedure correctly, if you SSH fromnode-ato either
of the other nodes, using the same username, you should not be prompted
for a password.

Sincenode-bwill run a backup Master, repeat the procedure above,
substitutingnode-beverywhere you seenode-a. Be sure not to overwrite
your existing.ssh/authorized_keysfiles, but concatenate the new key
onto the existing file using the>>operator rather than
the>operator.

Procedure: Preparenode-a

node-awill run your primary master and ZooKeeper processes, but no
RegionServers. . Stop the RegionServer from starting onnode-a.

Editconf/regionserversand remove the line which containslocalhost. Add
lines with the hostnames or IP addresses fornode-bandnode-c.

Even if you did want to run a RegionServer onnode-a, you should refer to
it by the hostname the other servers would use to communicate with it.
In this case, that would benode-a.example.com. This enables you to
distribute the configuration to each node of your cluster any hostname
conflicts. Save the file.

Configure HBase to usenode-bas a backup master.

Create a new file inconf/calledbackup-masters, and add a new line to
it with the hostname fornode-b. In this demonstration, the hostname
isnode-b.example.com.

Configure ZooKeeper

In reality, you should carefully consider your ZooKeeper configuration.
You can find out more about configuring ZooKeeper
inzookeeper.
This configuration will direct HBase to start and manage a ZooKeeper
instance on each node of the cluster.

Onnode-a, editconf/hbase-site.xmland add the following properties.

hbase.zookeeper.quorumnode-a.example.com,node-b.example.com,node-c.example.comhbase.zookeeper.property.dataDir/usr/local/zookeeper

Everywhere in your configuration that you have referred
tonode-aaslocalhost, change the reference to point to the hostname that
the other nodes will use to refer tonode-a. In these examples, the
hostname isnode-a.example.com.

Procedure: Preparenode-bandnode-c

node-bwill run a backup master server and a ZooKeeper instance.

Download and unpack HBase.

Download and unpack HBase tonode-b, just as you did for the standalone
and pseudo-distributed quickstarts.

Copy the configuration files fromnode-atonode-b.andnode-c.

Each node of your cluster needs to have the same configuration
information. Copy the contents of theconf/directory to
theconf/directory onnode-bandnode-c.

Procedure: Start and Test Your Cluster

Be sure HBase is not running on any node.

If you forgot to stop HBase from previous testing, you will have errors.
Check to see whether HBase is running on any of your nodes by using
thejpscommand. Look for the processesHMaster,HRegionServer,
andHQuorumPeer. If they exist, kill them.

Start the cluster.

Onnode-a, issue thestart-hbase.shcommand. Your output will be similar to
that below.

$ bin/start-hbase.sh

node-c.example.com: starting zookeeper, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-zookeeper-node-c.example.com.out

node-a.example.com: starting zookeeper, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-zookeeper-node-a.example.com.out

node-b.example.com: starting zookeeper, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-zookeeper-node-b.example.com.out

starting master, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-master-node-a.example.com.out

node-c.example.com: starting regionserver, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-regionserver-node-c.example.com.out

node-b.example.com: starting regionserver, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-regionserver-node-b.example.com.out

node-b.example.com: starting master, logging to
/home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-master-nodeb.example.com.out

ZooKeeper starts first, followed by the master, then the RegionServers,
and finally the backup masters.

Verify that the processes are running.

On each node of the cluster, run thejpscommand and verify that the
correct processes are running on each server. You may see additional
Java processes running on your servers as well, if they are used for
other purposes.

Example 2.node-ajpsOutput

$ jps

20355 Jps

20071 HQuorumPeer

20137 HMaster

Example 3.node-bjpsOutput

$ jps

15930 HRegionServer

16194 Jps

15838 HQuorumPeer

16010 HMaster

Example 4.node-ajpsOutput

$ jps

13901 Jps

13639 HQuorumPeer

13737 HRegionServer

ZooKeeper Process Name

TheHQuorumPeerprocess is a ZooKeeper instance which is controlled and
started by HBase. If you use ZooKeeper this way, it is limited to one
instance per cluster node, , and is appropriate for testing only. If
ZooKeeper is run outside of HBase, the process is calledQuorumPeer. For
more about ZooKeeper configuration, including using an external
ZooKeeper instance with HBase,
seezookeeper.

Browse to the Web UI.

Web UI Port Changes

Web UI Port Changes

In HBase newer than 0.98.x, the HTTP ports used by the HBase Web UI
changed from 60010 for the Master and 60030 for each RegionServer to
16010 for the Master and 16030 for the RegionServer.

If everything is set up correctly, you should be able to connect to the
UI for the
Masterhttp://node-a.example.com:16010/or
the secondary master
athttp://node-b.example.com:16010/for
the secondary master, using a web browser. If you can connect
vialocalhostbut not from another host, check your firewall rules. You
can see the web UI for each of the RegionServers at port 16030 of their
IP addresses, or by clicking their links in the web UI for the Master.

Test what happens when nodes or services disappear.

With a three-node cluster like you have configured, things will not be
very resilient. Still, you can test what happens when the primary Master
or a RegionServer disappears, by killing the processes and watching the
logs.

2)显示HBase帮助文本

出口help按下Enter,显示HBase
Shell的底蕴运用信息,以及一些演示命令。需要注意的是表名,行,列都要用引用符号。

过程:首破下HBase

1)在 node-a上生成密钥对

登陆那个使运行HBase的用户,使用下发号施令生成一个SSH密钥对:

$ ssh-keygen -t rsa

苟该令成实践,那么密钥对的途径就是会见打印及标准输出。公钥的默认名字也id_rsa.pub

1)编辑conf/regionservers跟移除包含localhost的那一行。添加node-b和node-c的主机名及IP地址。

尽管你想使当node-a运行一个RegionServer,你当被他点名一个主机名好其他服务好与其通讯。在这例子中,主机名吧node-a.example.com。这让你可分布布局到集群每个节点来避免主机名闯。保存文档。

经过:配置无密钥SSH登陆

node-a 需要登录到node-b和node-c来启动守护进程。最简便的贯彻方式是以所有的主机及行使同一用户称,配置无密钥SSH登陆。

3)配置ZooKeeper

实际,你当认真的配置你的ZooKeeper。你得当zookeeper找到更多关于ZooKeeper的细节。这个配置会指导HBase的起步与管制集群的每个节点受到之ZooKeeper实例。

On node-a, editconf/hbase-site.xmland add the following properties.

hbase.zookeeper.quorum

node-a.example.com,node-b.example.com,node-c.example.com

hbase.zookeeper.property.dataDir

/usr/local/zookeeper

过程:预备node-bnode-c**

node-b 将会见运作一个备用master 服务器和一个ZooKeeper 实例.

3)复制密钥到其他节点

以scp或者其他安全的法将密钥安全地从node-a复制到任何每个节点上。每个节点上使无在.ssh/authorized_keys其一文件的语,那么创建一个,然后用id_rsa.pub文本之始末补充加到该文件后。需要说明的凡若待在node-a做一样的操作。

$ cat id_rsa.pub >> ~/.ssh/authorized_keys

2)配置HBase

编辑hbase-site.xml开展配置. 第一,添加底下 property来 指导
HBase运行分布式模式, 每个守护进程运行于一个JVM上。

hbase.cluster.distributed

true

对接下去, 将hbase.rootdir由地方系统改也HDFS实例的地方, 使用 hdfs://// URI
语法. 在这个例子中, HDFS 运行在端口 8020达标.

hbase.rootdir

hdfs://localhost:8020/hbase

您切莫需以HDFS上创办一个索引。HBase会自己创造。如果您自己创立了,HBase会试图开一些公并无思量使的迁移。

4)浏览Web

Web看端口改变

一经HBase的本子高于0.98.x,那么登陆master的端口由60010变动也16010,登陆RegionServer的端口由60030改动吗16030。

假若安排都不错的话,你当力所能及运用浏览器通过http://node-a.example.com:16010/连接Master,通过http://node-b.example.com:16010/连日来备用Master。如果您不得不通过本地主机登陆而别主机不能够,检查你的防火墙规则。你可经过ip:16030来并接RegionServers,也得以于Master的Web界面中点击相关链接来登陆。

入门指南

1. 简介

Quickstart会面被你启动和运行一个单节点单机HBase。

创建表

使create命令来创造一个新表。你必须指定表名和列族名

hbase(main):001:0> create ‘test’, ‘cf’

0 row(s) in 0.4170 seconds

=> Hbase::Table – test

过程:关闭HBase

跟bin/start-hbase.sh脚本一样方便地开行HBase,用bin/stop-hbase.sh脚本来已其。

$ ./bin/stop-hbase.sh

stopping hbase………………..

$

在闹之命令后,将消费几分钟之时来关闭。使用jps来担保HMaster和HRegionServer已经关闭。

地方的始末曾往而显得了什么启动同止一个单机HBase。在生部分咱们将提供其他模式的部署。

1)连接HBase

万一在你HBase安装目录下的bin/ 下用hbase
shell命令行来连续HBase。在此事例中,会打印一些您以起步的HBase
shell用时漏之用法及版本信息。HBase Shell用>符号来表示了。

$ ./bin/hbase shell

hbase(main):001:0>

2)在其他节点创建用来囤密钥的不二法门。

当node-b和node-c,登陆HBase用户以以用户的home目录下创建.ssh/目录,如果该目录不存在的语。如果已在,要发现及外可能曾经包含其他密钥了。

6)启动和停止一个HMaster备用服务器

以跟一个硬件环境达到运行多只HMaster实例的情形不能够出现在生产条件,同样伪分布式也是勿容许的。这个手续只适用于测试与上

HMaster服务器控制HBase
集群。你可启动9独HMaster服务器,那么10个HMaster一起执行计算。使用local-master-backup.sh来启动一个HMaster备用服务器。你想要开动的每个备用服务器都使上加一个意味着master的端口参数。每个备用HMaster使用三独端口(默认是16010,16020,16030)端口还是以默认默认端口进行偏移的,偏移量为2的言辞,备用HMaster的端口会是16012,16022,16032。下面的授命用来启动3只端口分别吗16012/16022/16032、
16013/16023/16033跟16015/16025/16035的HMaster。

$ ./bin/local-master-backup.sh 2 3 5

想念使杀掉一个备用master而休是掩所有过程,你需要找到他的ID(PID)。PID存储在一个名为/tmp/hbase-USER-X-master.pid的文书中。该文件中的始末只有PID。你可使用kill-9命令来杀掉PID。下面的命杀掉端口为偏移量1底master,而集群仍然运行:

$ cat /tmp/hbase-testuser-1-master.pid |xargs kill -9

4)检查HBase在HDFS中之目

比方拥有都运行是吧,HBase将会见当HDFS中开创它的目。在点的部署中,它用积存于HDFS的/hbase中。你可当Hadoop的bin/下用hadoop
fs命令行来排有之目录下之享有文件。

$ ./bin/hadoop fs -ls /hbase

Found 7 items

drwxr-xr-x   – hbase users          0 2014-06-25 18:58 /hbase/.tmp

drwxr-xr-x   – hbase users          0 2014-06-25 21:49 /hbase/WALs

drwxr-xr-x   – hbase users          0 2014-06-25 18:48 /hbase/corrupt

drwxr-xr-x   – hbase users          0 2014-06-25 18:58 /hbase/data

-rw-r–r–   3 hbase users         42 2014-06-25 18:41 /hbase/hbase.id

-rw-r–r–   3 hbase users          7 2014-06-25 18:41
/hbase/hbase.version

drwxr-xr-x   – hbase users          0 2014-06-25 21:49 /hbase/oldWALs

2.4. 高档 – 全分布式

实则,你需要一个全分布式的配备来测试完整的HBase并且以它用当实世界之使用场景被。在一个分布式配置中,集群包括多单节点,每个节点运行一个还是多独HBase守护进程。这些概括要的同备用Master实例,多单ZooKeeper节点和多只RegionServer节点。

这高级配置比quickstart中几近上加了少只节点,结构如下:

Table 1. Distributed Cluster Demo Architecture

Node Name               Master    ZooKeeper    RegionServer

node-a.example.com      yes                yes                        
 no

node-b.example.com   backup           yes                         yes

node-c.example.com      no                 yes                        
yes

其一便捷启动设定每个节点都是一个虚拟机而且她们于平等的纱及。它搭建在事先的quickstart和Pseudo-Distributed
Local
Install以上,设定你之前安排体系为node-a。在继续操作前要停止HBase。

防火墙也相应关闭确保所节点都能互为通信。如果你瞧no route to
host的报错,检查你的防火墙。

2. 快启动 – 单点HBase

即时一部分讲述单节点单机HBase的安排。一个单例拥有富有的HBase守护线程—Master,RegionServers和ZooKeeper,运行一个独立JVM持久化到当地文件系统。这是咱太基础之配备文档。我们用会向你出示如何通过hbase
shell
CLI在HBase中开创一个报表,在说明中插入入行,执行put和scan操作,让表而能及开行和停止HBase等等操作。

而外下载HBase,这个历程大概需要不至10分钟地日。

HBase
0.94.x之前的版要回送IP地址也127.0.0.1,而UBuntu和另批发版默认是127.0.1.1,这将会给您造成麻烦。查看Why
does HBase care about
/etc/hosts?取得更多细节

每当Ubuntu上运行0.94.x事先版本的HBase,/etc/hosts文档应该因下面所写的模版来担保正常运转

127.0.0.1 localhost

127.0.0.1 ubuntu.ubuntu-domain ubuntu

hbase-0.96.0版后的曾修复了。

删除表

故drop命令来删除表

hbase(main):011:0> drop ‘test’

0 row(s) in 0.1370 seconds

5)创建一个报表并插入数据

您得应用HBase
Shell来创造一个报表,插入数据,扫描和获取数据,使用办法和shell
exercises所展示的一律。

过程:启动暨测试你的集群

经过:下载,配置,和开行单机模式HBase

  1. 从Apache Download
    Mirrors列表中精选一个下载节点。点击显示的链接。这将会晤带动您及一个HBase发布版的镜像。点击名字吧stable的文本夹然后下充斥文件结尾为.tar.gz的二进制文件及公的地方文件系统中。不要下载文件结尾为src.tar.gz的公文。

2.取下载文件同时以她坐新建的目录。

$ tar xzvf hbase-2.0.0-SNAPSHOT-bin.tar.gz

$ cd hbase-2.0.0-SNAPSHOT/

3.
若要以开行HBase之前安装好JAVA_HOME环境变量,你得通过你的操作系统常用方法来设置是变量,但是HBase提供了千篇一律栽中央编制,conf/hbse-env.sh。编辑这文档,将JAVA-HOME这同样推行之诠释给取消,然后拿他的值设为汝的操作系统中JAVA的装路径。JAVA_HOME变量应该设置包含可执行文件bin/java的不二法门。大多数现代的Linux操作系统提供相同种体制,例如当RHEL或者CentOS是/usr/bin/alternatives,为了能够显示地切换Java版本。在这种场面,你可当装JAVA_HOME为包含bin/java符号链接的目录,通常是/usr。

JAVA_HOME=/usr

4.
编conf/hbase-site.xml,该文档是HBase配置文件。在是时空点你不过待以地面文件系统中指定HBase和ZooKeeper写多少的目。默认情况下,会在/tmp目录下创造一个初目录。许多服务器会配备也一旦reboot那会去/tmp目录下的情节,所以你当当别的地方贮存数据。接下来的布局将见面储存HBase的数额以hbase目录下,放在用户testuser的主目录下。新安装之HBase下 标签中的内容是空,粘贴 标签及 下进行安排。

Example 1. Example hbase-site.xml for Standalone HBase

hbase.rootdir

file:///home/testuser/hbase

hbase.zookeeper.property.dataDir

/home/testuser/zookeeper

君切莫需要创造HBase数据目录。HBase将会见否卿创造。如果你自己创造了,HBase将见面打算一个您并无思要的搬迁。

地方例子中hbase.rootdir本着本地文件系统的目。我们就此‘file:/’前缀来表示当地文件系统。将HBase的home目录配置在曾经部分HDFS实例上,设置hbase.rootdir倚于而的HDFS实例,例如hdfs://namenode.example.org:8020/hbase.关于这变量的细节,请查看下在HDFS上配备单机HBase部分。

5.
bin/start-hbase.sh脚本将提供一个轻便的法来启动HBase。发出之命令并且运行良好的话,一长条标准的成启动之音讯会打印在控制台上。你可通过jps命令来判定你是不是已运行一个HMaster进程。在单价模式下,HBase会在斯独自的JVM中启动HMater,HRegionServer和ZooKeeper守护进程。在http://localhost:16010查看HBase
WebUI 。

亟待设置Java并且只要之可用。如果你早就设置了,但是可报错提示您未曾安装,可能设置于一个非标准路径下,编辑conf/hbase-env.sh并且修改JAVA_HOME,将包含bin/java的目录给给它们

7)启动和平息另外的RegionServers

HRegionServer被HMaster指导管理它StoreFiles里的数额。通常来说,集众多被的每个节点都运作一个HReigionServer,运行多单HRegionServer在同系统当中可以为此来测试伪分布式模式。使用local-regionservers.sh命令运行多单RegionServers。跟local-master-backup.sh一样,为每个实例提供端口偏移量。每个RegionServer需要少个端口,默认端口为16020同16030。然而,1.0.0本子的骨干端口已经被HMaster所使用,所以RegionServer无法使用默认端口。所有中心端口改吗16200及16300。你可以于一个服务中运行99额外RegionServer而休是一个HMaster或者HMaster。下面的下令用来启动端口从16202/16302起来连的额外的RegionServer。

$ .bin/local-regionservers.sh start 2 3 4 5

动用local-regionservers.sh 命令
和假设关门的server的偏移量参数来手动停止RegionServer。

$ .bin/local-regionservers.sh stop 3

3)启动HBase

使用bin/start-hbase.sh令来启动HBase.
如果您的系部署是没错的话,使用jps葡京签到送彩金命令将会晤看到HMaster和HRegionServer已经运行。

禁用表

若是你想只要去除一个表明要改变它的配备,以及另外有状况,你首先用因此disable命令来禁用表。

hbase(main):008:0> disable ‘test’

0 row(s) in 1.1820 seconds

hbase(main):009:0> enable ‘test’

0 row(s) in 0.1770 seconds

在启用‘test’之后重新禁用‘test’

hbase(main):010:0> disable ‘test’

0 row(s) in 1.1820 seconds

排出表的信

使用list命令

hbase(main):002:0> list ‘test’

TABLE

test

1 row(s) in 0.0180 seconds

=> [“test”]

4)在您的安排中拿node-a配置为主机的地方转移对主机名的援以致其他节点可以行使她来表示node-a。在这示例当中,主机名是node-a.example.com。

2.3. 伪分布式本地安装

在通过quickstart起步了单机模式后,你可重新配置来运作伪分布式模式。伪分布式模式代表HBase仍然运行在一个节点上,但是每个HBase的守护进程(HMaster,
HRegionServer, and
ZooKeeper)运行于单身的长河被:在单机模式受到有的看护进程都运行在一个JVM实例中。默认情况下,除非你安排像quickstart面临所讲述的布 hbase.rootdir属性,你的多少还是蕴藏在/tmp/中。在这次演示着,我们将数据存储在HDFS中,确保您HDFS是可用的。你得跨了HDFS配置后续将数据存储在地头文件系统中

2)从node-a复制配置信息到node-b和node-c

汇众多中之每个节点需要同的布信息。复制conf/下的始末及node-b和node-c下conf/。