【hbase】hbase配置独立的zookeeper的安装与测试

下载hbase-2.2.1-bin.tar.gz并执行安装命令:

[[email protected] ~]$ tar -zxvf hbase-2.2.1-bin.tar.gz

查看安装目录:

[[email protected] ~]$ cd hbase-2.2.1
[[email protected] hbase-2.2.1]$ ls -l
total 872
drwxr-xr-x. 4 hadoop hadoop   4096 Sep 10 14:26 bin
-rw-r--r--. 1 hadoop hadoop 128367 Sep  9 09:16 CHANGES.md
drwxr-xr-x. 2 hadoop hadoop    178 Sep 10 14:26 conf
drwxr-xr-x. 7 hadoop hadoop     80 Sep 10 14:28 hbase-webapps
-rw-rw-r--. 1 hadoop hadoop    262 May  2  2018 LEGAL
drwxrwxr-x. 6 hadoop hadoop   8192 Sep 21 23:30 lib
-rw-rw-r--. 1 hadoop hadoop 129312 Sep 10 14:31 LICENSE.txt
-rw-rw-r--. 1 hadoop hadoop 519346 Sep 10 14:31 NOTICE.txt
-rw-r--r--. 1 hadoop hadoop   1477 Sep  9 09:16 README.txt
-rw-r--r--. 1 hadoop hadoop  82873 Sep  9 09:16 RELEASENOTES.md

进入安装目录下conf,编辑hbase-env.sh、hbase-site、regionservers文件

[[email protected] hbase-2.2.1]$ cd conf
[[email protected] conf]$ ls
hadoop-metrics2-hbase.properties  hbase-site.xml
hbase-env.cmd                     log4j.properties
hbase-env.sh                      regionservers
hbase-policy.xml

hbase-env.sh文件

[[email protected] conf]$ gedit hbase-env.sh修改的内容:

export JAVA_HOME=/usr/java/jdk1.8.0_11/
export HBASE_MANAGES_ZK=false #flase表示使用独立的zookeeper

hbase-site文件:

[[email protected] conf]$ gedit hbase-site.xml
编辑内容:
<configuration>
        <property>
                <name>hbase.master</name>#hbasemaster的主机和端口
                <value>hadoop01:16010</value>
        </property>
        <property>
                <name>hbase.rootdir</name>#共享目录,持久化hbase数据
                <value>hdfs://hadoop01:9000/hbase</value>
        </property>
        <property>
                <name>hbase.cluster.distributed</name>#是否分布式运行,false即为单机
                <value>true</value>
        </property>
        <property>
                <name>hbase.zookeeper.quorum</name>#zookeeper地址
                <value>hadoop01,hadoop02,hadoop03</value>
        </property>
        <property>
                <name>hbase.master.maxclockskew</name>#时间同步允许的时间差
                <value>180000</value>
        </property><!--hbase.unsafe.stream.capability.enforce:使用本地文件系统设置为false,使用hdfs设置为true。但根据HBase 官方手册的说明:HBase 从2.0.0 开始默认使用的是asyncfs。-->
        <property>
                <name>hbase.unsafe.stream.capability.enforce</name>
                <value>false</value>                   <description>
        Controls whether HBase will check for stream capabilities (hflush/hsync).
        Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
        with the ‘file://‘ scheme, but be mindful of the NOTE below.
        WARNING: Setting this to false blinds you to potential data loss and
        inconsistent system state in the event of process and/or node failures. If
        HBase is complaining of an inability to use hsync or hflush it‘s most
        likely not a false positive.
                   </description>         </property> </configuration>

注:我们测试环境里用的是HBase 2.2.1, 所以这里虽然是集群环境,也直接将该参数设置false,然后重启Hbase Master,恢复正常。 或者使用版本小于2.0.0的HBase,也可以避免出现这种错误

regionservers文件

[[email protected] conf]# gedit regionservers
编辑内容为:
hadoop02
hadoop03

配置环境变量:

[[email protected] ~]$ gedit ~/.bash_profile
文本需要添加的内容:
#hbase
export HBASE_HOME=/home/hadoop/hbase-2.2.1
export PATH=$HBASE_HOME/bin:$PATH
export HADOOP_CLASSPATH=$HBASE_HOME/lib/*
[[email protected] ~]$ source ~/.bash_profile

拷贝到其他节点上:
[[email protected] ~]$ scp -r hbase-2.2.1 hadoop02:~/
[[email protected] ~]$ scp -r hbase-2.2.1 hadoop03:~/

启动停止hbase命令:

[[email protected] ~]$ cd ~/hbase-2.2.1
[[email protected] hbase-2.2.1]$ bin/start-hbase.sh --启动hbase
[[email protected] hbase-2.2.1]$ jps --显示进程
16720 ResourceManager
16866 NodeManager
19427 QuorumPeerMain --zookeeper进程
22387 Jps
16455 SecondaryNameNode
16075 NameNode
22062 HMaster --hbase进程
[[email protected] hbase-2.2.1]$ bin/stop-hbase.sh

注:启动报如下异常

java.lang.IllegalStateException: The procedure WAL relies on the ability to hsync for proper operation during component failures, but the underlying filesystem does not support doing so. Please check the config value of ‘hbase.procedure.store.wal.use.hsync‘ to set the desired level of robustness and ensure the config value of ‘hbase.wal.dir‘ points to a FileSystem mount that can provide it.

hbase-site.xml增加配置 

<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>

hbase网页版网:http://192.168.1.100:16010/master-status
注:HBASE1.0之后的版本web端访问的接口变更为16010,192.168.1.100为我的linux端口地址

启动并测试hbase:

[[email protected] hbase-2.2.1]$ jps --查看进程HMaster是否启动
11264 HMaster
11573 Jps
8566 DataNode
8426 NameNode
9642 QuorumPeerMain
8795 SecondaryNameNode
9053 ResourceManager
9197 NodeManager
[[email protected] hbase-2.2.1]$ hbase shell --进入shell模式
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/hadoop-3.2.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/hbase-2.2.1/lib/client-facing-thirdparty/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.2.1, rf93aaf770cce81caacbf22174dfee2860dbb4810, 2019年 09月 10日 星期二 14:28:27 CST
Took 0.0027 seconds
hbase(main):001:0> create ‘test1‘,‘f11‘ --创建test1表
Created table test1
Took 2.8262 seconds
=> Hbase::Table - test1
hbase(main):002:0> list --显示表
TABLE
test1
1 row(s)
Took 0.0274 seconds
=> ["test1"]
hbase(main):003:0> put ‘test1‘,‘id001‘,‘f11:uid‘,‘001‘ --插入数据
Took 0.2699 seconds
hbase(main):004:0> scan ‘test1‘ --查看数据
ROW                                         COLUMN+CELL
 id001                                      column=f11:uid, timestamp=1569686397247, value=001
1 row(s)
Took 0.0697 seconds
hbase(main):005:0> describe ‘test1‘ --查看表结构
Table test1 is ENABLED
test1
COLUMN FAMILIES DESCRIPTION
{NAME => ‘f11‘, VERSIONS => ‘1‘, EVICT_BLOCKS_ON_CLOSE => ‘false‘, NEW_VERSION_BEHAVIOR => ‘false‘, KEEP_DELETED_CELLS => ‘FALSE‘, CACHE_DATA_ON_WRITE => ‘false‘, DATA_BLO
CK_ENCODING => ‘NONE‘, TTL => ‘FOREVER‘, MIN_VERSIONS => ‘0‘, REPLICATION_SCOPE => ‘0‘, BLOOMFILTER => ‘ROW‘, CACHE_INDEX_ON_WRITE => ‘false‘, IN_MEMORY => ‘false‘, CACHE_
BLOOMS_ON_WRITE => ‘false‘, PREFETCH_BLOCKS_ON_OPEN => ‘false‘, COMPRESSION => ‘NONE‘, BLOCKCACHE => ‘true‘, BLOCKSIZE => ‘65536‘}                                         

1 row(s)

QUOTAS
0 row(s)
Took 0.1465 seconds
hbase(main):006:0> drop ‘test1‘ --删除表

ERROR: Table test1 is enabled. Disable it first.

For usage try ‘help "drop"‘

Took 0.0235 seconds
注:这里删除表失败了,根据提示,现在表状态为有效,无法删除。必须先将test1表状态失效才能成功删除。

hbase(main):008:0> disable ‘test1‘
Took 1.3230 seconds
hbase(main):009:0> drop ‘test1‘
Took 0.9026 seconds
hbase(main):010:0> list
TABLE
0 row(s)
Took 0.0111 seconds
=> []
hbase(main):011:0> exit --退出shell模式
[[email protected] hbase-2.2.1]$ 

原文地址:https://www.cnblogs.com/CQ-LQJ/p/11605636.html

时间: 2024-07-29 07:55:54

【hbase】hbase配置独立的zookeeper的安装与测试的相关文章

HBase参数配置及说明

转自:http://www.cnblogs.com/nexiyi/p/hbase_config_94.html 目的是看下生产环境配置与默认配置情况. hbase.hregion.max.filesize:100G hbase.regionserver.hlog.blocksize:512M hbase.regionserver.maxlogs:32 ............. 版本:0.94-cdh4.2.1 hbase-site.xml配置 hbase.tmp.dir 本地文件系统tmp目录

Zookeeper分布式安装配置

Zookeeper分布式安装配置 Zookeeper介绍 概述 1.ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件.它是一个为分布式应用提供一致性服务的软件,提供的功能包括:配置维护.域名服务.分布式同步.组服务等. 2.ZooKeeper的目标就是封装好复杂易出错的关键服务,将简单易用的接口和性能高效.功能稳定的系统提供给用户. 3.ZooKeeper包含一个简单的原语集,提供Java和C的接

hbase单机配置

zookeeper安装配置: 1. 解压至任意文件夹 2. /conf/zoo.cfg中 dataDir=/zkData(提前创建zkData目录) clientPort=2181 不变 server.1=yourhostname1:2888:3888 server.2=yourhostname2:2888:3888 server.3=yourhostname3:2888:3888(加上集群配置) 3.在zkData目录下创建myid文件,写对应机器编号 4. 分布到其他机器 scp zooke

HBase介绍、搭建、环境、安装部署

hadoop培训课程:HBase介绍.搭建.环境.安装部署 1.搭建环境 部署节点操作系统为CentOS,防火墙和SElinux禁用,创建了一个shiyanlou用户并在系统根目录下创建/app目录,用于存放Hadoop等组件运行包.因为该目录用于安装hadoop等组件程序,用户对shiyanlou必须赋予rwx权限(一般做法是root用户在根目录下创建/app目录,并修改该目录拥有者为shiyanlou(chown –R shiyanlou:shiyanlou /app). Hadoop搭建环

zookeeper 的安装配置及简单使用

===> Zookeeper 是什么? => ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件. => ZooKeeper包含一个简单的原语集,提供Java和C的接口. => ZooKeeper代码版本中,提供了分布式独享锁.选举.队列的接口,代码在zookeeper-3.4.3\src\recipes.其中分布锁和队列有Java和C两个版本,选举只有Java版本 ===> Z

记hbase list 命令报错zookeeper连接失败

hbase list 命令报错:zookeeper exists failed after 4 attempts $telnet h0082161 2181 Connected to 172.16.82.161.Escape character is '^]'. telnet connect by close foreign. 此时发现telnet h0082161 其他端口均正常,其他机器telnet h0082161 2181正常, 此时进入一个误区,一直在围绕telnet 服务查看,查看/

ZooKeeper的安装、配置、启动和使用(一)——单机模式

ZooKeeper的安装非常简单,它的工作模式分为单机模式.集群模式和伪集群模式,本博客旨在总结ZooKeeper单机模式下如何安装.配置.启动和使用: 一.安装配置ZooKeeper(在Windows操作系统下) a.下载ZooKeeper压缩安装文件,这里下载稳定版--zookeeper-3.4.5.tar.gz b.解压压缩文件,这里将其解压到C盘根目录下,打开解压后的文件夹,得到下图: c.点击上图名为"conf"的文件夹,可以看到下图: d.用记事本打开上图名为"z

zookeeper的安装和配置

1.将zookeeper-3.4.5.tar.gz这个文件上传到huanghe的/usr/local目录下 2.进入local目录下,执行解压      tar -zxvf  zookeeper-3.4.5.tar.gz 3.将解压后生成的zookeeper-3.4.5文件文件夹重命名为zk mv zookeeper-3.4.5  zk 然后设置zookeeper的系统环境变量 vi  /etc/profile 设置完后执行执行 source /etc/profile 然后将配置文件分别拷贝到h

浅谈 zookeeper 原理,安装和配置

当前云计算流行, 单一机器额的处理能力已经不能满足我们的需求,不得不采用大量的服务集群.服务集群对外提供服务的过程中,有很多的配置需要随时更新,服务间需要协调工作,那么这些信息如何推送到各个节点?并且保证信息的一致性和可靠性?我们知道分布式协调服务很难正确无误地实现, 因为他们很容易在竞争条件和死锁上犯错误.那么zookeeper将是一个不错的选择 Zookeeper是什么? 引用官方的说法:“Zookeeper是一个高性能,分布式的,开源分布式应用协调服务.它提供了简单原始的功能,分布式应用可