1、处理hbase的master宕机 操作命令: 。hbasedaemon。shstartmaster 。hbasedaemon。shstartzookeeper可选 2、处理hbase的regionserver宕机 操作命令: 。hbasedaemon。shstartregionserver 。hbasedeamon。shstartzookeeper可选 3、hbase集群间数据迁移方法总结 一、需要在hbase集群停掉的情况下迁移 步骤: (1)执行hadoopdistcpffilelisthdfs:newclusterip:9000hbasetest (2)在newcluster执行。hbaseorg。jruby。mainaddtable。rbhbasetable20111222,将拷贝来的表加入到。meat。中(会出现region的数目不一致的问题,这个需要重启hase才能解决) 说明:(1)filelist为hdfs上的列表文件,内容如下: hbasetable20111222 hbasetable20120131 (2)如果两个集群的hadoop版本不一致,需要在newcluster上执行hadoopdistcp,否则会出现读写异常; 二、在集群运行的时候进行数据迁移 1、replication:这个是动态的备份(可以理解为实时备份) 步骤:(1)在oldcluster将需要迁移的表属性进行修改: disableyourtable alteryourtable,{namefamilyname,replicationscope1} enableyourtable (2)打开newcluster集群的replication,修改hbasesite。xml hbase。replication true property (3)添加peer,在newcluster的hbaseshell中执行:addpeer1,oldclusterip:2181:hbase,启动replication,执行startreplication 说明:需要两个集群的hadoop版本一致,否则出现读写错误 2、copytable:可以在本集群中拷贝一张表,也可以将表拷贝到其他的集群中。 命令:。hbaseorg。apache。hadoop。hbase。mapreduce。copytablepeer。adrnewclusterip:2181:hbasezytest 说明:(1)拷贝完成,不需要重启机器,在newcluster中就可以看到该表; (2)稳定性还需要考虑,测试过程中遇到一个问题,拷贝过程中始终都停留在这里lookeduprootregionlocation,查看日志没有什么错误和相关的信息。 3、exportandimport 步骤:(1)在oldcluster上执行:。hbaseorg。apache。hadoop。hbase。mapreduce。exporttesthdfs:newclusterip:9000zhuangyangtest (2)在newcluster上执行:。hbaseorg。apache。hadoop。hbase。mapreduce。importtesthdfs:newclusterip:9000zhongyaotest 说明:(1)一定要写全路径,不能写相对路劲; (2)在import前,需要将表事先在newcluster中创建好。 以上都是在oldcluster和newcluster网络相通的情况下实现数据迁移的办法。 如果两个集群网络不通,只能先将oldcluster中的数据都下载到本地或者其他的地方,然后在人工的转移到newcluster上了 13。不重启namenode可以使配置文件生效 hadoopdfsadminrefreshnodes