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中。