Linux下HBase和Maven的环境搭建

Maven环境部署如下:

maven下载并进行环变量配置

export MAVEN_HOME=/home/hadoop/app/apache-maven-3.3.9
export PATH=$MAVEN_HOME/bin:$PATH

执行该命令source ~/.bash_profile 使环境变量生效

在$MAVEN_HOME/bin目录下输入mvn -v

配置文件位置:$MAVEN_HOME/conf/文件夹中settings.xml,添加

<localRepository>/home/hadoop/maven_repos/</localRepository>

表示在使用Maven过程中所使用的jar包都需要从网络上下载,该路径指定下载后存放的位置。

HBase环境部署如下:

1.下载地址:http://archive.cloudera.com/cdh5/cdh/5/

2.安装到指定目录

3.vi ~/.bash_profile 添加环境变量并使其生效

4.修改配置文件,$HBASE_HOME/conf/hbase-env.sh中有2处

  a:导出JAVA_HOME的安装路径

  b:zookeeper的管理配置export  HBASE_MANAGER_ZK=true需要设置为false,不需要hbase对ZK进行管理,由zookeeper自己进行管理,设置为true需要hbase对zookeeper进行管理。

5.修改配置文件,$HBASE_HOME/conf/hbase-site.xml

HBase安装目录下的conf文件夹中hbase-env.sh,有3处需要进行配置
  a:hbase的根目录和hadoop中的core-site.xml配置文件中的<value>hdfs://主机名:8020</value> 一致

  b:<property><name>hbase.cluster.distributed</name><value>true</value></property>进行分布式配置

  c:<property><name>hbase.zookeeper.quorum</name><value>hadoop000:2181</value></property>ZK的访问地址

  完整配置如下:

  <configuration>
    <property>
      <name>hbase.rootdir</name>
      <value>hdfs://hadoop000:8020/hbase</value>
    </property>
    <property>
      <name>hbase.cluster.distributed</name>
      <value>true</value>
    </property>
    <property>
      <name>hbase.zookeeper.quorum</name>
      <value>hadoop000:2181</value>
    </property>
  </configuration>

6.$HBASE_HOME/conf/regionservers 修改成主机名

7.启动hbase前需要先启动zookeeper,启动zookeeper命令是:在$ZK_HOME/bin/执行./zkServer.sh start 通过jps命令能查看到QuorumPeerMain进程。

当ZK启动正常后,在$HBASE_HOME/bin目录下输出./start-hbase.sh,hbase启动成功后通过jps查看会出现HMaster和HRegionserver 2个进程说明HBase启动成功。

8.hbase可以通过web方式进行访问:http://hadoop000:60010

9.简单验证:通过$HBASE_HOME/bin目录下的执行./hbase shell

  hbase(main):001:0> version

  1.2.0-cdh5.7.0, rUnknown, Wed Mar 23 11:46:29 PDT 2016

  hbase(main):003:0> status

  1 active master, 0 backup masters, 1 servers, 0 dead, 2.0000 average load

  hbase(main):002:0> create 'member','info','address'
  0 row(s) in 4.9050 seconds

  => Hbase::Table - member
  hbase(main):003:0> list
  TABLE
  member
  1 row(s) in 0.1060 seconds

  => ["member"]
  hbase(main):004:0> desc
  desc describe describe_namespace
  hbase(main):004:0> describe
  describe describe_namespace
  hbase(main):004:0> describe 'member'
  Table member is ENABLED
  member
  COLUMN FAMILIES DESCRIPTION
  {NAME => 'address', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING
  => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_S
  COPE => '0'}
  {NAME => 'info', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING =>
  'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOP
  E => '0'}
  2 row(s) in 0.6670 seconds

  hbase(main):005:0>

 

原文地址:https://www.cnblogs.com/fenghuoliancheng/p/10456102.html