从一张培训签到表说起葡京签到送彩金

从校园到职场,是人生从零初始的长河,学生时代的战表竞争,变成了另一种无形的竞争,分歧的出入在很长时间内很快显现,善于思考和学习的人升高很快。

入门指南

本人刚进一家外企的时候,集团有位刚高校结束学业的新员工小A,上班时期有无数近似复印材料、会议报到和端茶倒水等小事。有一天我在场集团内部的一场培训,小A在会议室门口负责签到,我在培育签到表上签了和谐的名字之后,扫了瞬间表格的始末,下意识地问了一句表格是什么人做的,小A说不知道,不过她反问了一句,表格有怎么着问题吧?

1. 简介

Quickstart会让您启动和运作一个单节点单机HBase。

葡京签到送彩金 1

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版本之后的早已修复了。

自身笑了笑,跟他说,等培训截至,我做一张表发给你,你精心比较一下,看看有啥两样。然后我就用两秒钟的时刻再度做了一张表,发给小A,并且对他说:

2.1. JDK 版本需要

HBase
须求设置JDK。查看Java来收获每个HBase版本所支撑的JDK版本。

1、身在职场,面对全新的铺面和地方,一定要用心、肯学,多观看、多考虑。很多近似不起眼的工作,只要您精心察看,都能发现许多题目,养成这样的习惯有助于你神速升高自己的综合素养和技巧。你前面问我塑造签到表有哪些问题,表明你依旧愿意上学的,只是你的视野还没打开,所以众多事物认知有限。

2.2. 伊始应用 HBase

2、我做的报表排版更整齐赏心悦目,上下左右留白越发合理,行间距也壮大了,那样大家用手写字的时候不会觉得空间太小。那一个是决不专业技能的,但凡用点心就能看出来。在确保排版合理的前提下尽可能在一页纸内多打几行,可以多签一些名字,节省纸张。

经过:下载,配置,和开行单机格局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的目录赋给它

3、表格抬头设计更专业。所有办公文档都是必要浮现或存档的,每个细节都要珍重,很多大公司都有严苛的VI种类,因为集团形象显示于各样细节,集团LOGO字体颜色、横排竖排都不可能不统一规范。

进程:首次接纳HBase

4、扩充了商店宣传语,页眉的左端是集团名称,右侧是公司口号,你只要留意就会意识许多商店的表格都是那样的。公司文化的建设、公司口号的不胫而走是潜移默化、耳濡目染的。也许那几个细节没人会看,不过我们得以做给自己看。

1)连接HBase

使在您HBase安装目录下的bin/ 下用hbase
shell命令行来连接HBase。在那几个事例中,会打印一些您在开行的HBase
shell用时遗漏的用法和版本新闻。HBase Shell用>符号来表示截至。

$ ./bin/hbase shell

hbase(main):001:0>

尽管只是一张小小的的签到表,或许有人觉得自身是小题大做,但自己信仰《三国志·蜀书·先主传》的一句话:“勿以恶小而为之,勿以善小而不为。”我尚未批评她的趣味,更谈不上怎样指点,仅仅是同事之间的维系和拉扯,希望团结的一对理念可见扶助到他。我也是从职场新人过来的,也走了不计其数弯路,经历了很多难倒,假若自己的经验可知扶助到人家,对自家的话是一件很满面红光的事。

2)展现HBase帮衬文本

输出help按下Enter,呈现HBase
Shell的根基运用新闻,以及部分示范命令。需求小心的是表名,行,列都不可以不用引用符号。

葡京签到送彩金 2

创建表

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

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

0 row(s) in 0.4170 seconds

=> Hbase::Table – test

出于紧缺一个对团结归纳宏观的评估,很多毕业生反映进入店铺后感到无法。“工作太累了,总是加班”“领导同事都针对自己”“其他同学挣得比自己多”……频仍听到刚步入职场的小宝宝们发出如此的“小心境”。

列出表的音信

使用list命令

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

TABLE

test

1 row(s) in 0.0180 seconds

=> [“test”]

绝一大半人缺失对友好的认知和剖析,好高骛远、眼高手低和不够主见的人不可胜数。在大城市、大集团,全体的读书意识和工作功用更好,能带动我们集体发展。而小城市、小集团的员工,往往因为不够那样的大环境,加上我学习意识差、自我约束能力弱,成长至极缓慢,用持续几年,我们就能鲜明地看到差异。那种差别,追根究底不是环境导致的,是自个儿的醒悟问题。好的大学里也有差生,差的高校里也有尖子,愿意努力的人总能让祥和散发光芒,不情愿努力的人就只剩下抱怨和不明。

布置数据到表中

利用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。

村办计算了几条意见,我以为适用于所有职场中人:

三次查看所有数据

应用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

1、努力也是一种力量。

获取一行的数量

用get命令一遍得到一行数据

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

COLUMN                                   CELL

cf:a                                    timestamp=1421762485768,
value=value1

1 row(s) in 0.0350 seconds

   
何人都想干事少钱多离家近的工作,什么人都想拿高薪水,谁都想变成官员或专家,不过内心有着渴望是三回事,可以把渴望成为驱动力,爆发行为结果又是另三次事。很两个人想折腾点事,可是最后怎么也干不成。可以自我约束、可以急忙学习、可以举办人脉、可以改变自己的欠缺,是绵长大力的结果,一举成名的票房价值毕竟砸不到你自我的头上。

禁用表

若果你想要删除一个表或者变更它的布局,以及任何一些景色,你首先须要用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

2、主动意识是成人的基本功。

删除表

用drop命令来删除表

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

0 row(s) in 0.1370 seconds

无论在哪些行业、什么店铺、什么部门,要想让投机很快成长,都无法不高标准、严要求地对待自己,要勇往直前去思维和上学,不要觉得公司有什么人该职分教你,校园里的教工应该专心教育你,不过商家提交薪俸请您来,是让你解决问题的,不是来接二连三指点你扶助您成长的。凡事树立主动发现,可以让你更快地判定自己,同时得到成人。

退出HBase Shell

使用exit来与HBase断开连接,但HBase如故在后台运行

3、不要奢求公平。

过程:关闭HBase

跟bin/start-hbase.sh脚本一样方便地启动HBase,用bin/stop-hbase.sh脚本来截至它。

$ ./bin/stop-hbase.sh

stopping hbase………………..

$

在发生这些命令之后,将花费几分钟的大运来关闭。使用jps来保险HMaster和HRegionServer已经倒闭。

上边的始末已经向您来得了何等启动和甘休一个单机HBase。在下局地大家将提供其余格局的安插。

   
很两个人习惯性抱怨,看到人家早早下班,自己日常加班,心里不快;看到首长喜好某人,不希罕自己,心里又伤心;看到显明做的平等,旁人被表扬,而团结却冷落,心里更愁肠。总以为制度不客观、领导有失公允、上帝不开眼,可您无法不弄通晓,你希望的公正究竟是怎样的?是依据你的逻辑和正式来设置的,依旧相对的不分畛域的那种。世界上哪来那么多公平呢?十个手指有长短,与其花时间去抱怨,不如静下心来读读书。

2.3. 伪分布式本地安装

在通过quickstart起步了单机形式之后,你可以重新配置来运转伪分布式格局。伪分布式情势代表HBase照旧运行在一个节点上,不过种种HBase的守护进程(HMaster,
HRegionServer, and
ZooKeeper)运行在单独的进度中:在单机情势中存有的护理进度都运行在一个JVM实例中。默许情状下,除非您布署像quickstart中所描述的配备 hbase.rootdir属性,你的多少仍然存储在/tmp/中。在这一次演示中,大家将数据存储在HDFS中,确保您HDFS是可用的。你可以跳过HDFS配置后续将数据存储在本土文件系统中

4、不要关切办公室政治。

Hadoop配置

以此进程假使你早就在地头系统或者远程系统中配置好Hadoop和HDFS,并且可以运转和确保可用。也只要你利用Hadoop2.Setting
up a Single Node
Cluster
将指点怎么着搭建单节点Hadoop

   
即使这是一个避不开的话题,但正是因为如此,大家才应该云淡风轻。不要去跟傻瓜争辩,否则外人分不清楚什么人是白痴。不要去跟疯子吵架,否则几人都是神经病。当您认为有人总在鬼鬼祟祟挑唆挑唆,给你穿小鞋,最好的点子就是当个屁一样自由掉。所有的本位都应该置身工作上,毕竟真善美的人照旧多数。倘使你所在的铺面真的乌烟瘴气,领导的质地就有问题,那您势必没须求呆下去。

1)假使HBase还在运作请甘休它

万一您曾经形成quickstart中的率领并且HBase如故在运转,请停止他。这些进度将成立一个新的目录来存储它的数量,所在此之前边您创立的数据库将会丢掉。

5、欺骗比犯错严重。

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会试图做一些你并不想要的迁徙。

社会主义基本价值观“富强、民主、文明、和谐、自由、平等、公正、法治、爱国、敬业、诚信、友善”是公民个人范畴的价值准则,诚信是做人的基业,无论生活依旧办事都必须做到诚恳待人。你工作中难免犯错,那是足以被谅解的,但你永远不要挑选隐瞒或诱骗。倘诺工作遇到问题,尝试跟领导联系,很多时候领导都会帮您点出问题的随处。不管如何来头,都不一致意欺骗,那是相对的下线。

3)启动HBase

使用bin/start-hbase.sh命令来启动HBase.
若是你的种类布局是天经地义的话,使用jps命令将会看到HMaster和HRegionServer已经运行。

市面上有好多职场励志类的书本,我们从中可以获取广大借鉴。每个人的成材都是特殊的,工作是我们人生中一定首要的一有的,大家只有不断成长,才能把工作变成一种乐趣,而不只是谋生的工具。

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

欢迎关心有情怀的微信公众号“思维小脑袋”,大家一同畅聊人生和前景。

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

您可以行使HBase
Shell来创立一个表格,插入数据,扫描和获取数据,使用方法和shell
exercises
所显示的一致。

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

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

8)停止 HBase

你可以动用quickstart中演说的吩咐bin/stop-hbase.sh来停止HBase。

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的报错,检查你的防火墙。

进程:配置无密钥SSH登陆

node-a 必要登录到node-b和node-c来启动守护进度。最简易的已毕格局是在具有的主机上采取同一用户名,配置无密钥SSH登陆。

1)在 node-a上转变密钥对

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

$ ssh-keygen -t rsa

即使该命令成功推行,那么密钥对的门径就会打印到标准输出。公钥的默许名字为id_rsa.pub

2)在其他节点创造用来存储密钥的路子。

在node-b和node-c,登陆HBase用户同时在用户的home目录下创设.ssh/目录,借使该目录不存在的话。如若已经存在,要发现到他恐怕已经包括其余密钥了。

3)复制密钥到其余节点

使用scp或者其余安全的主意将密钥安全地从node-a复制到其余各样节点上。每个节点上一经不设有.ssh/authorized_keys这些文件的话,那么创制一个,然后将id_rsa.pub文本的始末添加到该文件末端。须要注解的是您必要在node-a做同样的操作。

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

4)测试无密钥登陆.

设若所有运行顺畅的话,那么你可以动用SSH用相同的用户名而不必要密钥的图景下登陆其余节点。

5)因为node-b将会运作一个备用Master,重复上述的进度,将能观察的node-a都换成node-b。确保不要覆盖已经存在的.ssh/authorized_keys的文档,但足以用>>符号将密钥追加到已存在的文档后边。

过程:预备node-a**

node-a将会运行主master和ZooKeeper进度,不过尚未RegionServers。在node-a将RegionServer停掉。

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

固然你想要在node-a运行一个RegionServer,你应有给她点名一个主机名便于其余服务能够和它通讯。在那个事例当中,主机名为node-a.example.com。那使得你可以分布布局到集群每个节点来防止主机名争论。保存文档。

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

因此在conf/目录下成立一个名为backup-master的新文件,然后添加一行node-b的主机名。在这么些示例当中,主机名为node-b.example.com

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

4)在您的计划中把node-a配置为主机的地方转移指向主机名的引用以致其余节点能够应用它来代表node-a。在这一个示例当中,主机名是node-a.example.com。

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

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

1)下载和解压HBase.

在node-b下下载和平解决压HBase,跟你在quickstart和伪分布式中所做的一模一样。

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

集群中的每个节点要求一致的布署音讯。复制conf/下的始末到node-b和node-c下conf/。

进度:启动和测试你的集群

1)确保其余节点上从未有过运行HBase

只要您在前头测试中忘记截至HBase,就会出错。用jps命令行检查HBase是否运行。看看HMaster,HRegionServer和HQuorumPeer是否存在,若是存在,那么杀掉。

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。

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。

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界面中点击相关链接来登陆。

5)当节点依旧服务没有时测试一下生出了什么样

正如你布置的几个节点,事情并不总是如您所想。你可以通过杀死进程观看log来探望当主Master或者RegionServer消失时发生了哪些?

上面是原文


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
Cluster
in
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.