Hbase分布式搭建部署和shell使用 |
您所在的位置:网站首页 › hbase分布式部署 › Hbase分布式搭建部署和shell使用 |
0. 依赖环境
zookeeper
hadoop
三台linux机器
1. 下载并解压
下载地址:https://hbase.apache.org/downloads.html 解压到三台机器上面去 解压后的目录 2. 配置三台机器相关文件 hbase-env.sh 指定java目录 export JAVA_HOME=/opt/jdk1.8.0_181/ 关闭自带的zookeeper export HBASE_MANAGES_ZK=false hbase-site.xml 指定在hdfs上面的目录 hbase.rootdir hdfs://centos134:9000/hbase hbase.cluster.distributed true hbase.master.port 16000 指定zookeeper hbase.zookeeper.quorum centos134:2181,centos135:2181,centos136:2181 指定zookeeper的dataDir,这个目录可以在zookeeper的配置文件中找到 hbase.zookeeper.property.dataDir /opt/zookeeper-3.4.14/zkData regionservers 指定集群ip centos134 centos135 centos136 3. 创建软连接将hadoop的两个配置文件链接到hbase的conf下面 ln -s /opt/hadoop-2.7.2/etc/hadoop/core-site.xml /opt/hbase-1.3.1/conf/core-site.xml ln -s /opt/hadoop-2.7.2/etc/hadoop/hdfs-site.xml /opt/hbase-1.3.1/conf/hdfs-site.xml也可以直接将这两个文件复制到hbase的conf文件夹下面,但是这样的话,以后如果修改hadoop的配置,这里的文件如果忘了修改可能会留坑,使用软连接就不会有这个问题了。 4. 启动hbase集群启动: bin/start-hbase.sh 启动完成后通过jps命令查看: 节点有HMaster和HRegionServer,其他节点只有HRegionServer停止: bin/stop-hbase.sh 也可以单独到每个机器上面去启动相应的HMaster和HRegionServer 启动HMaster bin/hbase-daemon.sh start master 启动HRegionServer bin/hbase-daemon.sh start regionserver 5. 管理页面http://masterip:16010 6. 简单的一些shell操作进入hbase的shell:bin/hbase shell 创建表 create 'test','datainfo' 显示表 list 查看表结构 describe 'test' 插入数据 put 'test','test1','datainfo:info1','1' put 'test','test1','datainfo:info2','sss' put 'test','test2','datainfo:info1','2' 查询所有数据 scan 'test' 查询指定行的数据 get 'test','test1' 查询指定列族的数据 get 'test','test1','datainfo:info1' get 'test','test1','datainfo:info2' 更新指定字段的数据 put 'test','test1','datainfo:info2','abcdefg' 统计表数据行数 count 'test' 删除某行的数据 deleteall 'test','test2' 删除某行的某一列数据 delete 'test','test1','datainfo:info2' 清空表 truncate 'test' 删除表 删除前的hdfs: disable 'test' drop 'test'删除后的hdfs: |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |