scripts/hbase/hbase_mv_regions.rb
def distributePrimaryRegions(priRegions)
  c = HBaseConfiguration.new()
  admin = HBaseAdmin.new(c)
  servers = Array.new()
  dServers = Array.new()
  dServers = admin.getClusterStatus.getDeadServerNames()
  serv = admin.getClusterStatus.getServers()
  serv.each do |s|
    if (!dServers.include?(s))
      servers << s.getServerName()
    end
  end
  count=0
  totRS = servers.size()
  priRegions.each do |r|
    puts r+" will move to "+servers[count%totRS]
    move r,servers[count%totRS]
    count+=1
  end
  puts priRegions.size().to_s() + "primary regions moved"
end
#
# Distribute the regions in the array passed uniformly across
# the server array provided
#
Distribute the regions in the array passed uniformly across
the server array provided
Distribute the regions in the array passed uniformly across the server array provided
def distributePrimaryRegions(priRegions)
  c = HBaseConfiguration.new()
  admin = HBaseAdmin.new(c)
  servers = Array.new()
  dServers = Array.new()
  dServers = admin.getClusterStatus.getDeadServerNames()
  serv = admin.getClusterStatus.getServers()
  serv.each do |s|
    if (!dServers.include?(s))
      servers << s.getServerName()
    end
  end
  count=0
  totRS = servers.size()
  priRegions.each do |r|
    puts r+" will move to "+servers[count%totRS]
    move r,servers[count%totRS]
    count+=1
  end
  puts priRegions.size().to_s() + "primary regions moved"
end
def distributePrimaryRegions ( priRegions ) c = HBaseConfiguration . new ( ) admin = HBaseAdmin . new ( c ) servers = Array . new ( ) dServers = Array . new ( ) dServers = admin . getClusterStatus . getDeadServerNames ( ) serv = admin . getClusterStatus . getServers ( ) serv . each do | s | if ( ! dServers . include? ( s ) ) servers << s . getServerName ( ) end end count = 0 totRS = servers . size ( ) priRegions . each do | r | puts r + " will move to " + servers [ count % totRS ] move r , servers [ count % totRS ] count += 1 end puts priRegions . size ( ) . to_s ( ) + "primary regions moved" end
Distribute the regions in the array passed uniformly across
the server array provided
Distribute the regions in the array passed uniformly across the server array provided
priRegions