David:
Attached is a hacked up tool that you can use to online your regions.
Put it into your hbase install at src/java/org/apache/hadoop/hbase.
Compile. Then you should be able to do something like "./bin/hbase
org.apache.hadoop.hbase.HBaseTool" to see a usage message. Pass the row
name and whether you want it 'on' or 'off'.
St.Ack
package org.apache.hadoop.hbase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.util.MetaUtils;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
public class HBaseTool implements Tool {
private Configuration conf;
public int run(String[] args) throws Exception {
// Make sure there are at least 3 parameters
if (args.length < 2) {
System.err.println("ERROR: Wrong number of parameters: " + args.length);
return printUsage();
}
// First argument is the row in .META.
Text row = new Text(args[0]);
boolean enable = false;
if (args[1].toLowerCase().equals("on")) {
enable = true;
} else if (args[1].toLowerCase().equals("off")) {
enable = false;
} else {
System.err.println("ERROR: Second argument is not 'on' or 'off: " +
args.length);
return printUsage();
}
MetaUtils.changeOnlineStatus((HBaseConfiguration)this.conf, row, enable);
return 0;
}
public Configuration getConf() {
return this.conf;
}
public void setConf(Configuration c) {
this.conf = c;
}
static int printUsage() {
System.out.println("HBaseTool <region_name> <enable | disable>");
return -1;
}
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
HBaseConfiguration c = new HBaseConfiguration();
int errCode = ToolRunner.run(c, new HBaseTool(), args);
System.exit(errCode);
}
}