HBASE-5874 When 'fs.default.name' not configured, the hbck tool and Merge tool throws IllegalArgumentException (fulin wang)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1345902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b737e2e8bd
commit
b975bdc489
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.hadoop.hbase.util;
|
package org.apache.hadoop.hbase.util;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -2992,7 +2993,10 @@ public class HBaseFsck {
|
||||||
|
|
||||||
// create a fsck object
|
// create a fsck object
|
||||||
Configuration conf = HBaseConfiguration.create();
|
Configuration conf = HBaseConfiguration.create();
|
||||||
conf.set("fs.defaultFS", conf.get(HConstants.HBASE_DIR));
|
Path hbasedir = new Path(conf.get(HConstants.HBASE_DIR));
|
||||||
|
URI defaultFs = hbasedir.getFileSystem(conf).getUri();
|
||||||
|
conf.set("fs.defaultFS", defaultFs.toString()); // for hadoop 0.21+
|
||||||
|
conf.set("fs.default.name", defaultFs.toString()); // for hadoop 0.20
|
||||||
HBaseFsck fsck = new HBaseFsck(conf);
|
HBaseFsck fsck = new HBaseFsck(conf);
|
||||||
long sleepBeforeRerun = DEFAULT_SLEEP_BEFORE_RERUN;
|
long sleepBeforeRerun = DEFAULT_SLEEP_BEFORE_RERUN;
|
||||||
|
|
||||||
|
|
|
@ -384,8 +384,12 @@ public class Merge extends Configured implements Tool {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void usage() {
|
private void usage() {
|
||||||
System.err.println(
|
System.err
|
||||||
"Usage: bin/hbase merge <table-name> <region-1> <region-2>\n");
|
.println("For hadoop 0.20, Usage: bin/hbase org.apache.hadoop.hbase.util.Merge "
|
||||||
|
+ "[-Dfs.default.name=hdfs://nn:port] <table-name> <region-1> <region-2>\n");
|
||||||
|
System.err
|
||||||
|
.println("For hadoop 0.21+, Usage: bin/hbase org.apache.hadoop.hbase.util.Merge "
|
||||||
|
+ "[-Dfs.defaultFS=hdfs://nn:port] <table-name> <region-1> <region-2>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
Loading…
Reference in New Issue