(2)下载完成后使用命令 tar -zxvf zookeeper-3.4.11.tar.gz进行解压
(3)然后切换到其conf目录下
使用vim zoo.cfg新建一个配置文件。内容如下:
# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial# synchronization phase can takeinitLimit=10# The number of ticks that can pass between# sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just# example sakes.dataDir=/home/chenjie/zookeeper-3.4.11/tmp# the port at which the clients will connectclientPort=2181# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns=60## Be sure to read the maintenance section of the# administrator guide before turning on autopurge.## http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance## The number of snapshots to retain in dataDir#autopurge.snapRetainCount=3# Purge task interval in hours# Set to "0" to disable auto purge feature#autopurge.purgeInterval=1server.1=pc2:2888:3888server.2=pc3:2888:3888server.3=pc4:2888:3888
hbase.zookeeper.quorumpc2,pc3,pc4The directory shared by RegionServers.hbase.rootdirhdfs://pc2:9000/hbaseThe directory shared by RegionServers.hbase.cluster.distributedtrueThe mode the cluster will be in. Possible values arefalse: standalone and pseudo-distributed setups with managed Zookeepertrue: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)hbase.master.info.port60010
put 'test1','rowkey1','cf:q1','r1-v1' put 'test1','rowkey1','cf:q2','r1-v2' put 'test1','rowkey2','cf:q1','r2-v1' put 'test1','rowkey2','cf:q2','r2-v2' put 'test1','rowkey2','cf:q3','r2-v3'
(2)下载完成后使用命令 tar -zxvf zookeeper-3.4.11.tar.gz进行解压
(3)然后切换到其conf目录下
使用vim zoo.cfg新建一个配置文件。内容如下:
# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial# synchronization phase can takeinitLimit=10# The number of ticks that can pass between# sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just# example sakes.dataDir=/home/chenjie/zookeeper-3.4.11/tmp# the port at which the clients will connectclientPort=2181# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns=60## Be sure to read the maintenance section of the# administrator guide before turning on autopurge.## http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance## The number of snapshots to retain in dataDir#autopurge.snapRetainCount=3# Purge task interval in hours# Set to "0" to disable auto purge feature#autopurge.purgeInterval=1server.1=pc2:2888:3888server.2=pc3:2888:3888server.3=pc4:2888:3888
hbase.zookeeper.quorumpc2,pc3,pc4The directory shared by RegionServers.hbase.rootdirhdfs://pc2:9000/hbaseThe directory shared by RegionServers.hbase.cluster.distributedtrueThe mode the cluster will be in. Possible values arefalse: standalone and pseudo-distributed setups with managed Zookeepertrue: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)hbase.master.info.port60010
put 'test1','rowkey1','cf:q1','r1-v1' put 'test1','rowkey1','cf:q2','r1-v2' put 'test1','rowkey2','cf:q1','r2-v1' put 'test1','rowkey2','cf:q2','r2-v2' put 'test1','rowkey2','cf:q3','r2-v3'
关于每个regionserver节点分区数量大致合理的范围,HBase官网上也给出了定义:Generally less regions makes for a smoother running cluster (you can always
manually split the big regions later (if necessary) to spread the data, or
re......
一、前提条件
JDK1.7+
Hadoop 2.5.0+
Zookeeper 3.4.5+
下面介绍一下Zookeeper的安装:
(1)到Zookeeper官网下载Zookeeper最新安装包,
下载地址:http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz
(2)下载完成后使用命令 tar -zxvf zookeeper-3.4.11.tar.gz进行解压
(3)然后切换到其conf目录下
使用vim zoo.cfg新建一个配置文件。内容如下:
其中的主要配置项有
dataDir是指定zookeeper的数据目录,在此我设置在了zookeeper根目录下的tmp目录下(此目录不存在,需要使用mkdir tmp创建)
类似于
是配置zookeeper的节点,有多少个节点就配置多少个server,依次为server.1、server.2。。。pc2、pc3、pc4为各节点的主机名。
(4)配置完成后,切换到刚才配置的dataDir下,在此目录下新建一个myid文件(使用命令 vim myid)
进入vim后按i进入编辑模式,输入当前节点的编号(server.1的编号为1,依次类推),按esc推出编辑模式,输入shift + : 然后输入wq回车保存退出。
(5)使用命令scp -r zookeeper-3.4.11 chenjie@pc3:/home/chenjie将刚才配置好的zookeeper发送到另外两个节点上。
【然后修改另外两台节点上的dataDir/myid中的id为它们各自的id】
(6)切换到bin目录下,使用命令启动zookeeper
如果出现启动不了的情况,记得关闭防火墙
因为防火墙没有关闭。关闭防火墙:
#查看防火墙状态
sudo service iptables status
#关闭防火墙
sudo service iptables stop
#查看防火墙开机启动状态
sudo chkconfig iptables --list
#关闭防火墙开机启动
sudo chkconfig iptables off
二、安装HBase
(1)下载HBase安装包并解压
https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/1.2.6/hbase-1.2.6-bin.tar.gz
tar -zxvf hbase-1.2.6-bin.tar.gz
(2)进入该目录下的conf目录
向hbase-env.sh中添加:
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export HBASE_MANAGES_ZK=false
修改hbase-site.xml为
其中,
修改regionservers为(regionserver为从结点)
pc3
pc4
使用scp -r hbase-1.2.6 chenjie@pc3:/home/chenjie
scp -r hbase-1.2.6 chenjie@pc4:/home/chenjie
将pc2上配置好的hbase发送到pc3、pc4上
(3)切换到bin目录下使用./start-hbase.sh启动hbase
(4)使用hbase shell进入hbase的命令行窗口
使用命令create 'test1', {NAME=>'cf',VERSIONS=>3,COMPRESSION=>'gz'}创建一张表
分别执行
put 'test1','rowkey1','cf:q1','r1-v1'
put 'test1','rowkey1','cf:q2','r1-v2'
put 'test1','rowkey2','cf:q1','r2-v1'
put 'test1','rowkey2','cf:q2','r2-v2'
put 'test1','rowkey2','cf:q3','r2-v3'
插入四条记录
使用命令scan 'test1'查看表数据
(5)登录master的web管理界面
http://192.168.1.112:60010
在开发中,HBASE的安装一般都是有相关人员安装与维护,这里只是学习的写笔记而已。
一、上传解压:将需要安装的jar包上传解压到指定目录。
二、修改配置:下图是需要修改的配置文件的内容
配置文件:hbase-env.sh,配置Javahome以及HBASE的zk该为false。
以及配置hbase-site.xml文件:
三、启动
启动之前的准备
zookeeper启动:bin/zkServer.sh start
hdfs启动: 启动主节点
bin/hbase-daemon.sh start master
启动从节点: bin/hbase-daemon.sh start regionserver
四、验证是否成功
CDH版本: http://bigdata-hpsk01.huadian.com:60010
Apache: http://bigdata-hpsk01.huadian.com:16010
五、HBASE shell CURD :下面是测试是否安装成功的操作
进入Shell交互:bin/hbase shell
创建表: create "order","info"
查看表列表: list
插入数据:
put "表名","rowKey" , "列簇:列名" , 值
put "order","00:00:21_314295453511152","info:date","2015-04-21 00:00:21"
put "order","00:00:21_314295453511152","info:order_id","314295453511152"
查询数据: get "表名","rowKey"
get "order","00:00:21_314295453511152"
扫描表的数据: scan "order"
在测试的时候使用,生产环境千万不能用
hbase有本地模式和分布式模式
hbase-site.xml配置
hbase.tmp.dir
本地文件系统tmp目录,一般配置成bailocal模式的设置一下,但是最好还是需要设置一下,因为很多文件都会默认设置成它下面的
线上配置
默认值:
${java.io.tmpdir}/hbase-${user.name}
写到系统的/tmp目录
hbase.rootdir
HBase集群中所有RegionServer共享目录,用来持久化HBase的数据,一般设置的是hdfs的文件目录,如hdfs://master:9000/hbasedata
一、前提条件
JDK1.7+
Hadoop 2.5.0+
Zookeeper 3.4.5+
下面介绍一下Zookeeper的安装:
(1)到Zookeeper官网下载Zookeeper最新安装包,
下载地址:http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz
(2)下载完成后使用命令 tar -zxvf zookeeper-3.4.11.tar.gz进行解压
(3)然后切换到其conf目录下
使用vim zoo.cfg新建一个配置文件。内容如下:
其中的主要配置项有
dataDir是指定zookeeper的数据目录,在此我设置在了zookeeper根目录下的tmp目录下(此目录不存在,需要使用mkdir tmp创建)
类似于
是配置zookeeper的节点,有多少个节点就配置多少个server,依次为server.1、server.2。。。pc2、pc3、pc4为各节点的主机名。
(4)配置完成后,切换到刚才配置的dataDir下,在此目录下新建一个myid文件(使用命令 vim myid)
进入vim后按i进入编辑模式,输入当前节点的编号(server.1的编号为1,依次类推),按esc推出编辑模式,输入shift + : 然后输入wq回车保存退出。
(5)使用命令scp -r zookeeper-3.4.11 chenjie@pc3:/home/chenjie将刚才配置好的zookeeper发送到另外两个节点上。
【然后修改另外两台节点上的dataDir/myid中的id为它们各自的id】
(6)切换到bin目录下,使用命令启动zookeeper
如果出现启动不了的情况,记得关闭防火墙
因为防火墙没有关闭。关闭防火墙:
#查看防火墙状态
sudo service iptables status
#关闭防火墙
sudo service iptables stop
#查看防火墙开机启动状态
sudo chkconfig iptables --list
#关闭防火墙开机启动
sudo chkconfig iptables off
二、安装HBase
(1)下载HBase安装包并解压
https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/1.2.6/hbase-1.2.6-bin.tar.gz
tar -zxvf hbase-1.2.6-bin.tar.gz
(2)进入该目录下的conf目录
向hbase-env.sh中添加:
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export HBASE_MANAGES_ZK=false
修改hbase-site.xml为
其中,
修改regionservers为(regionserver为从结点)
pc3
pc4
使用scp -r hbase-1.2.6 chenjie@pc3:/home/chenjie
scp -r hbase-1.2.6 chenjie@pc4:/home/chenjie
将pc2上配置好的hbase发送到pc3、pc4上
(3)切换到bin目录下使用./start-hbase.sh启动hbase
(4)使用hbase shell进入hbase的命令行窗口
使用命令create 'test1', {NAME=>'cf',VERSIONS=>3,COMPRESSION=>'gz'}创建一张表
分别执行
put 'test1','rowkey1','cf:q1','r1-v1'
put 'test1','rowkey1','cf:q2','r1-v2'
put 'test1','rowkey2','cf:q1','r2-v1'
put 'test1','rowkey2','cf:q2','r2-v2'
put 'test1','rowkey2','cf:q3','r2-v3'
插入四条记录
使用命令scan 'test1'查看表数据
(5)登录master的web管理界面
http://192.168.1.112:60010
相关问题推荐
可以调一下系统时间,使用date命令,一般节点掉了都是时间不同步。
Hbase安装与启动一,前言二,前期准备 2.1 文件下载 2.2 服务器准备三,配置文件配置 3.1 hbase-env.sh 3.2 hbase-site.xml 3.3 regionservers 3.4 将hbase的bin目录添加到环境变量 3.5 Hbase的官方配置文档四,Hbase服务启动 4.1 ...
首先介绍部署 HBase 之前需要做的准备工作,如 Java、SSH 和 Hadoop 这些先决条件的配置;然后介绍如何安装 HBase,以及如何配置集群中相关文件。同时需要注意的是,本节介绍的是分布式 HBase 集群的部署,在对一台机器修改配置文件后需要同步到集群中的所有...
HBase安装HBase的安装也分为三种,单机版、伪分布式、分布式。我们首先来安装单机版。单机版首先我们去官网下载好HBase的安装包;接下来,将压缩包解压缩到你想安装的目录(我解压到的是/app目录):tar -zxvf hbase-2.1.0-bin.tar.gz /app安装单机版很简...
HBase分布式数据库具有如下的显著特点:容量大:HBase分布式数据库中的表可以存储成千上万的行和列组成的数据。面向列:HBase是面向列的存储和权限控制,并支持独立检索。列存储,其数据在表中是按照某列存储的,根据数据动态的增加列,并且可以单独对列进行...
1、查看单行记录:get '表名称', '行名称'2、查看表中的记录总数:count '表名称'3、查看表所有记录:scan 表名称4、查看表某个列所有记录:scan 表名称 , ['列名称:']5、查看有哪些表:list6、查看表结构:describe '表...
hbase与传统数据库的区别1.数据类型:Hbase只有简单的数据类型,只保留字符串;传统数据库有丰富的数据类型。2.数据操作:Hbase只有简单的插入、查询、删除、清空等操作,表和表之间是分离的,没有复杂的表和表之间的关系;传统数据库通常有各式各样的函数和连...
1、HBase写快读慢,HBase的读取时长通常是几毫秒,而Redis的读取时长通常是几十微秒。性能相差非常大。2、HBase和Redis都支持KV类型。但是Redis支持List、Set等更丰富的类型。3、Redis支持的数据量通常受内存限制,而HBase没有这个限制,可以存储远超内存大小...
启动HBase集群:bin/start-hbase.sh单独启动一个HMaster进程:bin/hbase-daemon.sh start master单独启动一个HRegionServer进程:bin/hbase-daemon.sh start regionserver
hbase的八大应用场景1、对象存储:我们知道不少的头条类、新闻类的的新闻、网页、图片存储在HBase之中,一些病毒公司的病毒库也是存储在HBase之中2、时序数据:HBase之上有OpenTSDB模块,可以满足时序类场景的需求3、推荐画像:特别是用户的画像,是一个比较...
1、频繁刷写我们知道Region的一个列族对应一个MemStore,假设HBase表都有统一的1个列族配置,则每个Region只包含一个MemStore。通常HBase的一个MemStore默认大小为128 MB,见参数hbase.hregion.memstore.flush.size。当可用内存足够时,每个MemStore可以分配...
避免HBase经常split,产生不必要的资源消耗,提高HBase的性能。
HBase每张表在底层存储上是由至少一个Region组成,Region实际上就是HBase表的分区。HBase新建一张表时默认Region即分区的数量为1,一般在生产环境中我们都会手动给Table提前做 预分区,使用合适的分区策略创建好一定数量的分区并使分区均匀分布在不同regions...
关于每个regionserver节点分区数量大致合理的范围,HBase官网上也给出了定义:Generally less regions makes for a smoother running cluster (you can always manually split the big regions later (if necessary) to spread the data, or re......