Linux巩固记录(7) Hbase安装

zookeeper安装好,并启动成功后,接下来开始安装hbase

#下载hbase
wget http://mirror.bit.edu.cn/apache/hbase/1.3.1/hbase-1.3.1-bin.tar.gz
[root@master home]# ll
total 103248
drwxr-xr-x.  8 root         root               191 Sep  5 22:31 eclipse
drwxr-xr-x. 13        20415          101       195 Sep  5 21:29 hadoop-2.7.4
-rw-r--r--.  1 root         root         105718722 Jun 20 18:41 hbase-1.3.1-bin.tar.gz
drwxr-xr-x.  8           10          143       255 Jul 22 13:11 jdk1.8.0
drwx------.  3 xiaochangwei xiaochangwei        78 Sep  5 01:01 xiaochangwei
drwxr-xr-x. 10         1001         1001      4096 Sep  7 22:05 zookeeper-3.4.10
[root@master home]# 
#解压到当前的home目录
tar -zxvf hbase-1.3.1-bin.tar.gz
#添加环境变量
vi /etc/profile

#内容如下红色部分,其他为之前配置的
export JAVA_HOME=/home/jdk1.8.0
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin 
export JAVA_HOME
export PATH
export CLASSPATH


export HADOOP_HOME=/home/hadoop-2.7.4
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop


export HBASE=/home/hbase-1.3.1
export PATH=$HBASE/bin:$PATH
#使配置立即生效并验证
[root@master hbase-1.3.1]# source /etc/profile
[root@master hbase-1.3.1]# hbase
Usage: hbase [<options>] <command> [<args>]
Options:
  --config DIR     Configuration direction to use. Default: ./conf
  --hosts HOSTS    Override the list in 'regionservers' file
  --auth-as-server Authenticate to ZooKeeper using servers configuration

Commands:
Some commands take arguments. Pass no args or -h for usage.
  shell           Run the HBase shell
  hbck            Run the hbase 'fsck' tool
  snapshot        Tool for managing snapshots
  snapshotinfo    Tool for dumping snapshot information
  wal             Write-ahead-log analyzer
  hfile           Store file analyzer
  zkcli           Run the ZooKeeper shell
  upgrade         Upgrade hbase
  master          Run an HBase HMaster node
  regionserver    Run an HBase HRegionServer node
  zookeeper       Run a Zookeeper server
  rest            Run an HBase REST server
  thrift          Run the HBase Thrift server
  thrift2         Run the HBase Thrift2 server
  clean           Run the HBase clean up script
  classpath       Dump hbase CLASSPATH
  mapredcp        Dump CLASSPATH entries required by mapreduce
  pe              Run PerformanceEvaluation
  ltt             Run LoadTestTool
  canary          Run the Canary tool
  version         Print the version
  CLASSNAME       Run the class named CLASSNAME
[root@master hbase-1.3.1]# 
#修改hbase的环境变量和jdk环境变量
vi /home/hbase-1.3.1/conf/hbase-env.sh

export JAVA_HOME=/home/jdk1.8.0/
export HBASE_CLASSPATH=/home/hbase-1.3.1/conf
#配置
vi /home/hbase-1.3.1/conf/hbase-site.xml

#修改为
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-->
<configuration>
    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://master:9000/hbase</value>
    </property>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>master,slave1,slave2</value>
    </property>
    <property>
        <name>hbase.tmp.dir</name>
        <value>/tmp/hbase</value>
    </property>
    <property>
        <name>hbase.zookeeper.property.dataDir</name>
        <value>/home/dataDir/zookeeper</value>
    </property>
</configuration>

#配置从节点
vi /home/hbase-1.3.1/conf/regionservers

#去掉里面的localhost,修改为
slave1
slave2


#分别拷贝到slave节点

scp -r /home/hbase-1.3.1/ slave1:/home/

scp -r /home/hbase-1.3.1/ slave2:/home/

接下来依次启动hadoop-》zookeeper(每个几点要分别启动)-》hbase

 启动命令如下:

#master上执行 启动hadoop
/home/hadoop-2.7.4/sbin/start-all.sh 

#master,slave1,slave2上执行 启动zookeeper
/home/zookeeper-3.4.10/bin/zkServer.sh start /home/zookeeper-3.4.10/conf/zoo.cfg 

#全部执行完毕后可以通过下列命令查看状态,比如是leader还是follower
/home/zookeeper-3.4.10/bin/zkServer.sh status

注意:请所有节点都执行启动命令后再通过status进行状态查看,否则看见的是

[root@master ~]# /home/zookeeper-3.4.10/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/zookeeper-3.4.10/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

通过 less /home/zookeeper-3.4.10/zookeeper.out 查看提示无法连接到其他节点
当然了,其他节点都还没启动,所以等所有节点都启动了,再通过status命令查看

#master上执行 启动hbase
/home/hbase-1.3.1/bin/start-hbase.sh 

启动日志如下:
[root@master ~]# /home/hbase-1.3.1/bin/start-hbase.sh 
master: starting zookeeper, logging to /home/hbase-1.3.1/bin/../logs/hbase-root-zookeeper-master.out
slave1: starting zookeeper, logging to /home/hbase-1.3.1/bin/../logs/hbase-root-zookeeper-slave1.out
slave2: starting zookeeper, logging to /home/hbase-1.3.1/bin/../logs/hbase-root-zookeeper-slave2.out
starting master, logging to /home/hbase-1.3.1/bin/../logs/hbase-root-master-master.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
slave1: starting regionserver, logging to /home/hbase-1.3.1/bin/../logs/hbase-root-regionserver-slave1.out
slave2: starting regionserver, logging to /home/hbase-1.3.1/bin/../logs/hbase-root-regionserver-slave2.out
slave1: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
slave1: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
slave2: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
slave2: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0

通过jps命令可以查看节点运行情况

#master
[root@master ~]# date
Fri Sep  8 21:06:42 CST 2017
[root@master ~]# jps
2657 QuorumPeerMain
3108 SecondaryNameNode
3269 ResourceManager
3909 HMaster
2902 NameNode
4281 Jps
[root@master ~]# 
#slave1
[root@slave1 ~]# date
Fri Sep  8 21:07:10 CST 2017
[root@slave1 ~]# jps
3160 HRegionServer
2636 QuorumPeerMain
2748 DataNode
2877 NodeManager
3503 Jps
[root@slave1 ~]# 
#slave2
[root@slave2 ~]# date
Fri Sep  8 21:07:32 CST 2017
[root@slave2 ~]# jps
2626 QuorumPeerMain
3146 HRegionServer
3467 Jps
2732 DataNode
2861 NodeManager
[root@slave2 ~]# 

同时可以打开 http://master:16010/master-status 进行UI界面访问, 若需修改端口 ,请在hbase-site.xml中配置 hbase.master.info.port

官方参考配置及全部参数详解可以参考  http://hbase.apache.org/book.html#example_config

 另外可以通过如下命令测试hbase是否搭建成功

hbase hbck

另外

HBase集群需要依赖于一个Zookeeperensemble。

HBase集群中的所有节点以及要访问HBase的客户端都需要能够访问到该Zookeeper  ensemble。

此外,Zookeeper ensemble一般配置为奇数个节点,并且Hadoop集群、Zookeeper ensemble、HBase集群是三个互相独立的集群,并不需要部署在相同的物理节点上,他们之间是通过网络通信的。

Hbase不需要mapreduce,所以只要start-dfs.sh启动hdfs,然后到zookeeper各节点上启动zookeeper,最后再hbase-start.sh启动hbase即可.

至此,hbase配置、安装、启动完毕

下一篇将讲解Hbase的使用方法

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏技术/开源

开源API测试工具 Hitchhiker v0.7更新 - Schedule的对比diff

Hitchhiker 是一款开源的支持多人协作的 Restful Api 测试工具,支持Schedule, 数据对比,压力测试,支持脚本定制请求,可以轻松部署到...

29760
来自专栏架构之路

idea 远程调试 tomcat web应用

最近在做的一个东西,测试环境和本地环境差距太大,本地能运行的代码,放到测试环境上到处报错,哪里哪里都连不上,所以决定把代码部署到远程服务器上调试,节省时间。 网...

40550
来自专栏Java学习123

Maven学习问题解决

33180
来自专栏大神带我来搬砖

防止DHCP获取的DNS修改/etc/resolv.conf文件

想在centos系统中使用DHCP分配IP,但是使用自定义的DNS服务器,这时重启时会将DHCP获得的DNS服务器写到/etc/resolv.conf文件中,优...

36550
来自专栏云知识学习

Mount命令详解

首先,介绍一下挂接(mount)命令的使用方法,mount命令参数非常多,这里主要讲一下今天我们要用到的。

774150
来自专栏乐沙弥的世界

使用CRM方式管理heartbeat

1、在heartbeat v2之后的版本,可以将haresources方式管理的资源转化为基于CIB方式进行管理 2、使用CRM(CIB)管理,需要配置ha...

15540
来自专栏Django Scrapy

ZOOKEEPER安装

1.将ZOOKEEPER安装包上传到服务器上 /usr/local 2.解压并重命名目录 tar xzvf zookeeper-3.4.8.tar.gz ...

392100
来自专栏Java技术分享

J2Cache——Java两级缓存框架

J2Cache 是 OSChina 目前正在使用的两级缓存框架。第一级缓存使用 Ehcache,第二级缓存使用 Redis 。由于大量的缓存读取会导致 L2 的...

42890
来自专栏小夜博客

星光互联Linux系统挂载硬盘

410110
来自专栏python3

Centos7 安装python虚拟环境+Django

鉴于virtualenv不便于对虚拟环境集中管理,所以推荐直接使用virtualenvwrapper。 virtualenvwrapper提供了一系列命令使得和...

29820

扫码关注云+社区

领取腾讯云代金券