本文整理汇总了Java中org.apache.hadoop.hbase.master.RackManager类的典型用法代码示例。如果您正苦于以下问题:Java RackManager类的具体用法?Java RackManager怎么用?Java RackManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RackManager类属于org.apache.hadoop.hbase.master包,在下文中一共展示了RackManager类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testRegionReplicationOnMidClusterWithRacks
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
@Test (timeout = 800000)
public void testRegionReplicationOnMidClusterWithRacks() {
conf.setLong(StochasticLoadBalancer.MAX_STEPS_KEY, 10000000L);
conf.setFloat("hbase.master.balancer.stochastic.maxMovePercent", 1.0f);
conf.setLong("hbase.master.balancer.stochastic.maxRunningTime", 120 * 1000); // 120 sec
loadBalancer.setConf(conf);
int numNodes = 30;
int numRegions = numNodes * 30;
int replication = 3; // 3 replicas per region
int numRegionsPerServer = 28;
int numTables = 10;
int numRacks = 4; // all replicas should be on a different rack
Map<ServerName, List<HRegionInfo>> serverMap =
createServerMap(numNodes, numRegions, numRegionsPerServer, replication, numTables);
RackManager rm = new ForTestRackManager(numRacks);
testWithCluster(serverMap, rm, false, true);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestStochasticLoadBalancer.java
示例2: beforeAllTests
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
@BeforeClass
public static void beforeAllTests() throws Exception {
Configuration conf = HBaseConfiguration.create();
conf.setClass("hbase.util.ip.to.rack.determiner", MockMapping.class, DNSToSwitchMapping.class);
loadBalancer = new MockBalancer();
loadBalancer.setConf(conf);
MasterServices st = Mockito.mock(MasterServices.class);
Mockito.when(st.getServerName()).thenReturn(master);
loadBalancer.setMasterServices(st);
// Set up the rack topologies (5 machines per rack)
rackManager = Mockito.mock(RackManager.class);
for (int i = 0; i < NUM_SERVERS; i++) {
servers[i] = ServerName.valueOf("foo"+i+":1234",-1);
if (i < 5) {
Mockito.when(rackManager.getRack(servers[i])).thenReturn("rack1");
}
if (i >= 5 && i < 10) {
Mockito.when(rackManager.getRack(servers[i])).thenReturn("rack2");
}
if (i >= 10) {
Mockito.when(rackManager.getRack(servers[i])).thenReturn("rack3");
}
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:TestBaseLoadBalancer.java
示例3: setConf
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
@Override
public void setConf(Configuration conf) {
this.config = conf;
setSlop(conf);
if (slop < 0) slop = 0;
else if (slop > 1) slop = 1;
if (overallSlop < 0) overallSlop = 0;
else if (overallSlop > 1) overallSlop = 1;
this.tablesOnMaster = LoadBalancer.isTablesOnMaster(this.config);
this.onlySystemTablesOnMaster = LoadBalancer.isSystemTablesOnlyOnMaster(this.config);
// If system tables on master, implies tablesOnMaster = true.
if (this.onlySystemTablesOnMaster && !this.tablesOnMaster) {
LOG.warn("Set " + TABLES_ON_MASTER + "=true because " + SYSTEM_TABLES_ON_MASTER + "=true");
this.tablesOnMaster = true;
}
this.rackManager = new RackManager(getConf());
if (useRegionFinder) {
regionFinder.setConf(conf);
}
// Print out base configs. Don't print overallSlop since it for simple balancer exclusively.
LOG.info("slop=" + this.slop + ", tablesOnMaster=" + this.tablesOnMaster +
", systemTablesOnMaster=" + this.onlySystemTablesOnMaster);
}
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:BaseLoadBalancer.java
示例4: testRegionReplicationOnMidClusterWithRacks
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
@Test
public void testRegionReplicationOnMidClusterWithRacks() {
conf.setLong(StochasticLoadBalancer.MAX_STEPS_KEY, 10000000L);
conf.setFloat("hbase.master.balancer.stochastic.maxMovePercent", 1.0f);
conf.setLong("hbase.master.balancer.stochastic.maxRunningTime", 120 * 1000); // 120 sec
loadBalancer.setConf(conf);
int numNodes = 30;
int numRegions = numNodes * 30;
int replication = 3; // 3 replicas per region
int numRegionsPerServer = 28;
int numTables = 10;
int numRacks = 4; // all replicas should be on a different rack
Map<ServerName, List<RegionInfo>> serverMap =
createServerMap(numNodes, numRegions, numRegionsPerServer, replication, numTables);
RackManager rm = new ForTestRackManager(numRacks);
testWithCluster(serverMap, rm, false, true);
}
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:TestStochasticLoadBalancerRegionReplicaWithRacks.java
示例5: FavoredNodeAssignmentHelper
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
public FavoredNodeAssignmentHelper(final List<ServerName> servers,
final RackManager rackManager) {
this.servers = servers;
this.rackManager = rackManager;
this.rackToRegionServerMap = new HashMap<String, List<ServerName>>();
this.regionServerToRackMap = new HashMap<ServerName, String>();
this.uniqueRackList = new ArrayList<String>();
this.random = new Random();
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:FavoredNodeAssignmentHelper.java
示例6: setConf
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
@Override
public void setConf(Configuration conf) {
super.setConf(conf);
globalFavoredNodesAssignmentPlan = new FavoredNodesPlan();
this.rackManager = new RackManager(conf);
super.setConf(conf);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:FavoredNodeLoadBalancer.java
示例7: Cluster
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
protected Cluster(
Map<ServerName, List<HRegionInfo>> clusterState,
Map<String, Deque<RegionLoad>> loads,
RegionLocationFinder regionFinder,
RackManager rackManager) {
this(null, clusterState, loads, regionFinder,
rackManager);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:BaseLoadBalancer.java
示例8: setConf
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
@Override
public void setConf(Configuration conf) {
setSlop(conf);
if (slop < 0) slop = 0;
else if (slop > 1) slop = 1;
this.config = conf;
String[] tables = getTablesOnMaster(conf);
if (tables != null && tables.length > 0) {
Collections.addAll(tablesOnMaster, tables);
}
this.rackManager = new RackManager(getConf());
regionFinder.setConf(conf);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:BaseLoadBalancer.java
示例9: testWithCluster
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
protected void testWithCluster(Map<ServerName, List<HRegionInfo>> serverMap,
RackManager rackManager, boolean assertFullyBalanced, boolean assertFullyBalancedForReplicas) {
List<ServerAndLoad> list = convertToList(serverMap);
LOG.info("Mock Cluster : " + printMock(list) + " " + printStats(list));
loadBalancer.setRackManager(rackManager);
// Run the balancer.
List<RegionPlan> plans = loadBalancer.balanceCluster(serverMap);
assertNotNull(plans);
// Check to see that this actually got to a stable place.
if (assertFullyBalanced || assertFullyBalancedForReplicas) {
// Apply the plan to the mock cluster.
List<ServerAndLoad> balancedCluster = reconcile(list, plans, serverMap);
// Print out the cluster loads to make debugging easier.
LOG.info("Mock Balance : " + printMock(balancedCluster));
if (assertFullyBalanced) {
assertClusterAsBalanced(balancedCluster);
List<RegionPlan> secondPlans = loadBalancer.balanceCluster(serverMap);
assertNull(secondPlans);
}
if (assertFullyBalancedForReplicas) {
assertRegionReplicaPlacement(serverMap, rackManager);
}
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:BalancerTestBase.java
示例10: FavoredNodeAssignmentHelper
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
public FavoredNodeAssignmentHelper(final List<ServerName> servers,
final RackManager rackManager) {
this.servers = servers;
this.rackManager = rackManager;
this.rackToRegionServerMap = new HashMap<>();
this.regionServerToRackMap = new HashMap<>();
this.uniqueRackList = new ArrayList<>();
this.random = new Random();
}
开发者ID:apache,项目名称:hbase,代码行数:10,代码来源:FavoredNodeAssignmentHelper.java
示例11: initialize
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
@Override
public synchronized void initialize() throws HBaseIOException {
super.initialize();
super.setConf(conf);
this.fnm = services.getFavoredNodesManager();
this.rackManager = new RackManager(conf);
super.setConf(conf);
}
开发者ID:apache,项目名称:hbase,代码行数:9,代码来源:FavoredNodeLoadBalancer.java
示例12: FavoredNodesManager
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
public FavoredNodesManager(MasterServices masterServices) {
this.masterServices = masterServices;
this.globalFavoredNodesAssignmentPlan = new FavoredNodesPlan();
this.primaryRSToRegionMap = new HashMap<>();
this.secondaryRSToRegionMap = new HashMap<>();
this.teritiaryRSToRegionMap = new HashMap<>();
this.rackManager = new RackManager(masterServices.getConfiguration());
}
开发者ID:apache,项目名称:hbase,代码行数:9,代码来源:FavoredNodesManager.java
示例13: Cluster
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
protected Cluster(
Map<ServerName, List<RegionInfo>> clusterState,
Map<String, Deque<BalancerRegionLoad>> loads,
RegionLocationFinder regionFinder,
RackManager rackManager) {
this(null, clusterState, loads, regionFinder, rackManager);
}
开发者ID:apache,项目名称:hbase,代码行数:8,代码来源:BaseLoadBalancer.java
示例14: testWithCluster
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
protected void testWithCluster(Map<ServerName, List<RegionInfo>> serverMap,
RackManager rackManager, boolean assertFullyBalanced, boolean assertFullyBalancedForReplicas) {
List<ServerAndLoad> list = convertToList(serverMap);
LOG.info("Mock Cluster : " + printMock(list) + " " + printStats(list));
loadBalancer.setRackManager(rackManager);
// Run the balancer.
List<RegionPlan> plans = loadBalancer.balanceCluster(serverMap);
assertNotNull(plans);
// Check to see that this actually got to a stable place.
if (assertFullyBalanced || assertFullyBalancedForReplicas) {
// Apply the plan to the mock cluster.
List<ServerAndLoad> balancedCluster = reconcile(list, plans, serverMap);
// Print out the cluster loads to make debugging easier.
LOG.info("Mock Balance : " + printMock(balancedCluster));
if (assertFullyBalanced) {
assertClusterAsBalanced(balancedCluster);
List<RegionPlan> secondPlans = loadBalancer.balanceCluster(serverMap);
assertNull(secondPlans);
}
if (assertFullyBalancedForReplicas) {
assertRegionReplicaPlacement(serverMap, rackManager);
}
}
}
开发者ID:apache,项目名称:hbase,代码行数:30,代码来源:BalancerTestBase.java
示例15: setRackManager
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
public void setRackManager(RackManager rackManager) {
this.rackManager = rackManager;
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:4,代码来源:BaseLoadBalancer.java
示例16: setConf
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
@Override
public void setConf(Configuration conf) {
globalFavoredNodesAssignmentPlan = new FavoredNodesPlan();
this.rackManager = new RackManager(conf);
this.conf = conf;
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:7,代码来源:FavoredNodeLoadBalancer.java
示例17: getRackManager
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
public RackManager getRackManager() {
return rackManager;
}
开发者ID:apache,项目名称:hbase,代码行数:4,代码来源:FavoredNodesManager.java
示例18: setConf
import org.apache.hadoop.hbase.master.RackManager; //导入依赖的package包/类
@Override
public void setConf(Configuration conf) {
globalFavoredNodesAssignmentPlan = new FavoredNodesPlan();
this.rackManager = new RackManager(conf);
super.setConf(conf);
}
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:7,代码来源:FavoredNodeLoadBalancer.java
注:本文中的org.apache.hadoop.hbase.master.RackManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论