diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java index f40fe53995e..e6c830dbe34 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java @@ -46,6 +46,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.AuthUtil; import org.apache.hadoop.hbase.ChoreService; +import org.apache.hadoop.hbase.ClusterStatus; import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HColumnDescriptor; @@ -924,7 +925,12 @@ public final class Canary implements Tool { admin.enableTable(writeTableName); } - int numberOfServers = admin.getClusterStatus().getServers().size(); + ClusterStatus status = admin.getClusterStatus(); + int numberOfServers = status.getServersSize(); + if (status.getServers().contains(status.getMaster())) { + numberOfServers -= 1; + } + List locations; RegionLocator locator = connection.getRegionLocator(writeTableName); try {