Пример #1
0
def recover_region_server(args, ip):
  package_root = deploy_utils.get_hbase_package_root(
      args.hbase_config.cluster.version)
  Log.print_info("Recover region server: " + ip);
  host = socket.gethostbyaddr(ip)[0]
  args.command = ["ruby", "%s/bin/region_mover.rb" % package_root,
    "load", host]
  if run_shell(args) != 0:
    Log.print_critical("Load host %s failed." % host);
Пример #2
0
def recover_region_server(args, ip):
    package_root = deploy_utils.get_hbase_package_root(
        args.hbase_config.cluster.version)
    Log.print_info("Recover region server: " + ip)
    host = socket.gethostbyaddr(ip)[0]
    args.command = [
        "ruby", "%s/bin/region_mover.rb" % package_root, "load", host
    ]
    if run_shell(args) != 0:
        Log.print_critical("Load host %s failed." % host)
Пример #3
0
def run_shell(args):
    get_hbase_service_config(args)

    main_class, options = deploy_utils.parse_shell_command(
        args, SHELL_COMMAND_INFO)
    if not main_class:
        return

    core_site_dict = args.hbase_config.configuration.generated_files[
        "core-site.xml"]
    hdfs_site_dict = args.hbase_config.configuration.generated_files[
        "hdfs-site.xml"]
    hbase_site_dict = args.hbase_config.configuration.generated_files[
        "hbase-site.xml"]

    hbase_opts = list()
    for key, value in core_site_dict.iteritems():
        hbase_opts.append("-D%s%s=%s" %
                          (deploy_utils.HADOOP_PROPERTY_PREFIX, key, value))
    for key, value in hdfs_site_dict.iteritems():
        hbase_opts.append("-D%s%s=%s" %
                          (deploy_utils.HADOOP_PROPERTY_PREFIX, key, value))
    for key, value in hbase_site_dict.iteritems():
        hbase_opts.append("-D%s%s=%s" %
                          (deploy_utils.HADOOP_PROPERTY_PREFIX, key, value))

    if deploy_utils.is_security_enabled(args):
        hbase_opts.append("-Djava.security.krb5.conf=%s/krb5-hadoop.conf" %
                          deploy_utils.get_config_dir())

        (jaas_fd, jaas_file) = tempfile.mkstemp()
        os.write(jaas_fd, deploy_zookeeper.generate_client_jaas_config(args))
        os.close(jaas_fd)
        hbase_opts.append("-Djava.security.auth.login.config=%s" % jaas_file)

    package_root = deploy_utils.get_hbase_package_root(
        args.hbase_config.cluster.version)
    class_path = "%s/:%s/lib/*:%s/*" % (package_root, package_root,
                                        package_root)

    cmd = ["java", "-cp", class_path] + hbase_opts + [main_class]
    if args.command[0] == "shell":
        cmd += ["-X+O", "%s/bin/hirb.rb" % package_root]
    cmd += options
    p = subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
    return p.wait()
Пример #4
0
def run_shell(args):
  get_hbase_service_config(args)

  main_class, options = deploy_utils.parse_shell_command(
      args, SHELL_COMMAND_INFO)
  if not main_class:
    return

  core_site_dict = args.hbase_config.configuration.generated_files["core-site.xml"]
  hdfs_site_dict = args.hbase_config.configuration.generated_files["hdfs-site.xml"]
  hbase_site_dict = args.hbase_config.configuration.generated_files["hbase-site.xml"]

  hbase_opts = list()
  for key, value in core_site_dict.iteritems():
    hbase_opts.append("-D%s%s=%s" % (deploy_utils.HADOOP_PROPERTY_PREFIX,
          key, value))
  for key, value in hdfs_site_dict.iteritems():
    hbase_opts.append("-D%s%s=%s" % (deploy_utils.HADOOP_PROPERTY_PREFIX,
          key, value))
  for key, value in hbase_site_dict.iteritems():
    hbase_opts.append("-D%s%s=%s" % (deploy_utils.HADOOP_PROPERTY_PREFIX,
          key, value))

  if deploy_utils.is_security_enabled(args):
    hbase_opts.append("-Djava.security.krb5.conf=%s/krb5-hadoop.conf" %
        deploy_utils.get_config_dir())

    (jaas_fd, jaas_file) = tempfile.mkstemp()
    os.write(jaas_fd, deploy_zookeeper.generate_client_jaas_config(args))
    os.close(jaas_fd)
    hbase_opts.append("-Djava.security.auth.login.config=%s" % jaas_file)

  package_root = deploy_utils.get_hbase_package_root(
      args.hbase_config.cluster.version)
  class_path = "%s/:%s/lib/*:%s/*" % (package_root, package_root, package_root)

  cmd = ["java", "-cp", class_path] + hbase_opts + [main_class]
  if args.command[0] == "shell":
    cmd += ["-X+O", "%s/bin/hirb.rb" % package_root]
  cmd += options
  p = subprocess.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr)
  return p.wait()