ITPub博客

首页 > 大数据 > 数据分析 > 在Linux系统搭建hbase环境

在Linux系统搭建hbase环境

数据分析 作者:kinglin_zy 时间:2015-01-13 12:25:28 0 删除 编辑

     HBase是一个分布式的、面向列的开源数据库,不同于一般的关系数据库,它是一个适合于非结构化数据存储的数据库。在安装hbase数据库时必须先安装好hadoop和java环境,并测试环境正确无误。hbase相对hadoop安装简单,以下只是hbase单机版本,不是集群方式,不过大概方法都要是差不多。

1.下载和安装hbase数据库
[root@tong1 ~]# wget http://mirrors.hust.edu.cn/apache/hbase/stable/hbase-0.98.9-hadoop2-bin.tar.gz
[root@tong1 ~]# tar xvf hbase-0.98.9-hadoop2-bin.tar.gz
[root@tong1 ~]# mv hbase-0.98.9-hadoop2  /usr/local/
[root@tong1 local]# chown -R hadoop:hadoop hbase-0.98.9-hadoop2
[root@tong1 local]# ll hbase-0.98.9-hadoop2
total 352
drwxr-xr-x. 4 hadoop hadoop   4096 Dec 16 14:16 bin
-rw-r--r--. 1 hadoop hadoop 164928 Dec 16 14:20 CHANGES.txt
drwxr-xr-x. 2 hadoop hadoop   4096 Jan  8 12:48 conf
drwxr-xr-x. 4 hadoop hadoop   4096 Dec 16 14:16 dev-support
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:22 hbase-annotations
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-assembly
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:22 hbase-checkstyle
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-client
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:22 hbase-common
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-examples
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:25 hbase-hadoop1-compat
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-hadoop2-compat
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-hadoop-compat
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-it
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-prefix-tree
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-protocol
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-rest
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-server
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-shell
drwxr-xr-x. 2 hadoop hadoop   4096 Dec 16 14:23 hbase-testing-util
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 14:23 hbase-thrift
-rw-r--r--. 1 hadoop hadoop  11358 Dec  2 07:36 LICENSE.txt
drwxrwxr-x. 2 hadoop hadoop   4096 Jan  8 12:01 logs
-rw-r--r--. 1 hadoop hadoop    897 Dec 16 14:16 NOTICE.txt
-rw-r--r--. 1 hadoop hadoop  81667 Dec 16 14:16 pom.xml
-rw-r--r--. 1 hadoop hadoop   1377 Dec 16 14:16 README.txt
drwxr-xr-x. 3 hadoop hadoop   4096 Dec 16 06:37 src
[root@tong1 local]#

2.修改hbase配置文件
[root@tong1 local]# cd /usr/local/hbase-0.98.9-hadoop2/conf/             
[root@tong1 conf]# vim hbase-site.xml


  
          hbase.rootdir
          hdfs://tong1:9000/hbase     -与hadoop中的core-site.xml文件中一至
  

  
          hbase.cluster.distributed
          true
  


[root@tong1 conf]# vim hbase-env.sh
export JAVA_HOME=/usr/local/jdk1.8.0_25
[root@tong1 conf]#

3.启动hbase服务
[root@tong1 conf]# su - hadoop
[hadoop@tong1 ~]$ start-hbase.sh
localhost: starting zookeeper, logging to /usr/local/hbase-0.98.9-hadoop2/bin/../logs/hbase-hadoop-zookeeper-tong1.out
starting master, logging to /usr/local/hbase-0.98.9-hadoop2/logs/hbase-hadoop-master-tong1.out
localhost: starting regionserver, logging to /usr/local/hbase-0.98.9-hadoop2/bin/../logs/hbase-hadoop-regionserver-tong1.out

[hadoop@tong1 ~]$ hbase shell
2015-01-08 15:01:36,052 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
2015-01-08 15:01:36,082 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
2015-01-08 15:01:36,109 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
2015-01-08 15:01:36,135 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
2015-01-08 15:01:36,147 INFO  [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help' for list of supported commands.
Type "exit" to leave the HBase Shell
Version 0.98.9-hadoop2, r96878ece501b0643e879254645d7f3a40eaf101f, Mon Dec 15 23:00:20 PST 2014

 

hbase(main):008:0* create 'tong1' ,'test'
0 row(s) in 0.9120 seconds

=> Hbase::Table - tong1
hbase(main):009:0> scan 'tong1'
ROW                                             COLUMN+CELL                                                                                                                            
0 row(s) in 0.0390 seconds

hbase(main):010:0>

4.在浏览器查看状态

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/781883/viewspace-1400085/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-09-22

  • 博文量
    58
  • 访问量
    69699