当前位置: 移动技术网 > IT编程>数据库>其他数据库 > HBASE的安装过程及运行HBASE程序的需要配置的内容

HBASE的安装过程及运行HBASE程序的需要配置的内容

2019年05月22日  | 移动技术网IT编程  | 我要评论

hbase安装配置

①下载压缩包(选择与自己安装的hadoop版本的兼容版本,见后面附录)

官网下载地址:

选择稳定版hbase-1.4.9-bin.tar.gz,在windows里面下载。

②将压缩包从windows传输到linux当前目录下

securecrt 【file】→【connect sftp session】开启sftp操作

 

③安装

解压安装到指定目录下/opt/module(/opt是系统自带目录,之下的/module是自己创建的)

 

④配置环境变量

在/etc/profile文件里添加hbase安装路径的配置信息,之后用source命令使配置生效。安装之后的目录为hbase-1.4.9,修改为hbase,所以我的hbase安装路径是/opt/module/hbase。

 

测试hbase安装成功,命令hbase version,或hbase。

 

hbase配置(伪分布式模式)

配置文件位于hbase安装路径的conf目录(/opt/module/hbase/conf)下面

①配置hbase-env.sh

设置java安装路径

 

设置hbase的配置文件路径(/opt/module/hbase/conf)

采用hbase自带zookeeper,设置参数true

 

②配置hbase-site.xml

<!--hbase共享目录,持久化hbase数据-->

<!--配置为core-site.xml 中的fs.defaultfs -->

<property>

        <name>hbase.rootdir</name>

        <value>hdfs://bigdata128:9000/hbase</value>

</property>

<!--分布式运行模式,false(默认)为单机模式-->

<property>

        <name>hbase.cluster.distributed</name>

        <value>true</value>

</property>

<!--zookeeper集群的地址列表,伪分布式用默认localhost-->

<property>

        <name>hbase.zookeeper.quorum</name>

        <value>localhost</value>

</property>

③启动并运行hbase(之前启动hadoop)

启动hbase,并jps查看

 

用完停止hbase运行(之后停止hadoop)

 

start-all.sh

start-hbase.sh

进入hbase数据库

进入hbase的shell命令行模式

 

了解命令使用方法,如创建表,输入help ‘create’

①   创建表

 

②   添加数据

 

③   查看数据

 

 

④删除数据

删除一个单元格

删除一行

 

④   删除表

 

 

hbase架构原理

hbase java api

参考资料:

linux下配置环境变量最常用的两种方法—— .bashrc 和 /etc/profile

学习 hbase,应该选择哪个版本?

https://www.csdn.net/gather_2a/mttaegzsodu5mi1ibg9n.html

 

warn  [main] zookeeper.zookeepernodetracker: can't get or delete the master znode

will not attempt to authenticate using sasl (unknown error)

建表之后查看logs报错

error [main] client.connectionmanager$hconnectionimplementation: can't get connection to zookeeper: keepererrorcode = connectionloss for /hbase

建表时报错

can't get connection to zookeeper: keepererrorcode = connectionloss for /hbase

重新停止、启动hbase,查看logs,报错2019-04-04 10:41:52,238 info  [m:0;bigdata128:35321-sendthread(localhost:2181)] zookeeper.clientcnxn: opening socket connection to server localhost/127.0.0.1:2181. will not attempt to authenticate using sasl (unknown error)

hbase shell 运行status

报错2019-04-04 10:49:55,710 error [main] client.connectionmanager$hconnectionimplementation: can't get connection to zookeeper: keepererrorcode = connectionloss for /hbase

 

启动hbase,报错:

error [main] server.zookeeperserver: zkshutdownhandler is not registered

error [main] master.hmastercommandline: master exiting

java.io.ioexception: could not start zk at requested port of 2181.  zk was started at port: 2182.  aborting as clients (e.g. shell) will not be able to find this zk quorum.

关闭防火墙service iptables stop

 

hbase安装配置

解压及安装

将压缩包从windows传输到linux当前目录下:

 

解压安装到指定目录下/opt/module

 

配置环境变量

在/etc/profile文件里添加hbase及zookeeper安装路径的配置信息

 

测试hbase安装成功,命令hbase version,或hbase

修改配置信息

修改slaves里的内容,改成虚拟机的主机名

 

把zoo_sample.cfd文件名称改为zoo.cfg,

 

hbase配置(伪分布式模式)

配置文件位于hbase安装路径的conf目录

配置hbase-env.sh,设置java,hbase,zookeeper安装路径

 

配置hbase-site.xml   注:bigdata128,localhost改成虚拟机的主机名

<!--hbase共享目录,持久化hbase数据-->

<!--配置为core-site.xml 中的fs.defaultfs -->

<property>

        <name>hbase.rootdir</name>

        <value>hdfs://bigdata128:9000/hbase</value>

</property>

<!--分布式运行模式,false(默认)为单机模式-->

<property>

        <name>hbase.cluster.distributed</name>

        <value>true</value>

</property>

 

<!--zookeeper集群的地址列表,伪分布式用默认localhost-->

<property>

        <name>hbase.zookeeper.quorum</name>

        <value>localhost</value>

</property>

修改eclipse的内容

在【properties】 里的【java build path】 中【libraries】添加【hbase-1.4.9】中【lib】的除了【slf4j-log4j12-1.7.10.jar】其它所有jar文件都要添加;并添加【conf】文件夹,把【hbase-1.4.9】中【conf】的【hbase-site.xml】添加到【conf】文件夹里。

 

修改添加的【hbase-site.xml】文件注:bigdata128,localhost改成虚拟机的主机名

<!--hbase共享目录,持久化hbase数据-->

<!--配置为core-site.xml 中的fs.defaultfs -->

<property>

        <name>hbase.rootdir</name>

        <value>hdfs://bigdata128:9000/hbase</value>

</property>

<!--分布式运行模式,false(默认)为单机模式-->

<property>

        <name>hbase.cluster.distributed</name>

        <value>true</value>

</property>

<!--zookeeper集群的地址列表,伪分布式用默认localhost-->

<property>

        <name>hbase.zookeeper.quorum</name>

        <value>localhost</value>

</property>

运行程序时,先在crt上启动hadoop、hbase、zookeeper,并jps查看

start-all.sh

start-hbase.sh

zkserver.sh start

 

 

 

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网