设为首页 加入收藏

TOP

HBase数据结构与基本语法详解(三)
2019-01-06 22:08:41 】 浏览:402
Tags:HBase 数据结构 基本 语法 详解
dh4.2.1/sbin/hadoop-daemon.sh --config /etc/hadoop/conf stop datanode"
#启动:
cat /home/hadoop/slaves|xargs -i -t ssh hadoop@{} "sudo /home/hadoop/cdh4/hadoop-2.0.0-cdh4.2.1/sbin/hadoop-daemon.sh --config /etc/hadoop/conf start datanode"


2)修改hbase配置
 hbase配置位置:/home/hadoop/hbase
# 同步hbase配置
cat /home/hadoop/hbase/conf/regionservers|xargs -i -t scp /home/hadoop/hbase/conf/hbase-site.xml hadoop@{}:/home/hadoop/hbase/conf/hbase-site.xml
 
# graceful重启
cd ~/hbase
bin/graceful_stop.sh --restart --reload --debug inspurXXX.xxx.xxx.org


hbase shell 脚本


编写一个文本文件hbasedemo.txt:
disable 'table1'
drop 'table1'
create 'table1', 'column_family1','column_family2' 
list 'table1' 
put 'table1', 'row_key1', 'column_family1:col1', 'value1' 
put 'table1', 'row_key2', 'column_family1:col2', 'value2' 
put 'table1', 'row_key3', 'column_family2:col3', 'value3' 
put 'table1', 'row_key4', 'column_family2:col4', 'value4' 
scan 'table1' 
scan 'table1',{LIMIT=>5}
get 'table1', 'row_key1' 
get 'table1','row_key1', 'column_family1:col1'
count 'table1'


 


disable 'table1' 
alter 'table1',NAME=>'column_family3'
alter 'table1','delete'=>'column_family3'
enable 'table1'
describe 'table1'
grant 'root','RW','table1'
user_permission 'table1'


delete 'table1','row_key1','column_family1:col1'
deleteall 'table1','row_key1'
truncate 'table1'


在HBase shell中运行这个脚本
hbase shell hbasedemo.txt


需要注意的是,如果编写的txt文件中没有exit这条命令的话,当脚本执行完成后,会停留在hbase shell的界面中,如果有exit命令的话,就会退出到系统shell中。


首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Mysql主从同步-概念和原理介绍 下一篇Ubuntu下HBase数据库的安装和配置..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目