Exemple #1
0
def generate_client_config(args, artifact, version):
    config_path = "%s/%s/%s-%s/conf" % (args.package_root, args.cluster,
                                        artifact, version)
    master_host = args.hbase_config.jobs["master"].hosts[0].ip
    config_path = "%s/%s/%s-%s/conf" % (args.package_root, args.cluster,
                                        artifact, version)
    deploy_utils.write_file(
        "%s/hbase-site.xml" % config_path,
        deploy_utils.generate_site_xml(
            args,
            args.hbase_config.configuration.generated_files["hbase-site.xml"]))
    deploy_utils.write_file(
        "%s/hadoop-metrics.properties" % config_path,
        generate_metrics_config(args, master_host, "master"))
    deploy_utils.write_file(
        "%s/core-site.xml" % config_path,
        deploy_utils.generate_site_xml(
            args,
            args.hbase_config.configuration.generated_files["core-site.xml"]))
    deploy_utils.write_file(
        "%s/hdfs-site.xml" % config_path,
        deploy_utils.generate_site_xml(
            args,
            args.hbase_config.configuration.generated_files["hdfs-site.xml"]))
    args.zookeeper_config.parse_generated_config_files(args)
    deploy_utils.write_file("%s/jaas.conf" % config_path,
                            deploy_zookeeper.generate_client_jaas_config(args))
    deploy_utils.write_file(
        "%s/krb5.conf" % config_path,
        args.hbase_config.configuration.raw_files["krb5.conf"])
    update_hbase_env_sh(args, artifact, version)
Exemple #2
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

    # parse the service_config, suppose the instance_id is -1
    args.hbase_config.parse_generated_config_files(args)
    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()
        args.zookeeper_config.parse_generated_config_files(args)
        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_artifact_package_root(
        args, args.hbase_config.cluster, "hbase")
    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()
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

  # parse the service_config, suppose the instance_id is -1
  args.hbase_config.parse_generated_config_files(args)
  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()
    args.zookeeper_config.parse_generated_config_files(args)
    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_artifact_package_root(args,
      args.hbase_config.cluster, "hbase")
  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()
Exemple #4
0
def generate_client_config(args, artifact, version):
  config_path = "%s/%s/%s-%s/conf" % (args.package_root,
      args.cluster, artifact, version)
  master_host = args.hbase_config.jobs["master"].hosts[0]
  config_path = "%s/%s/%s-%s/conf" % (args.package_root,
      args.cluster, artifact, version)
  deploy_utils.write_file("%s/hbase-site.xml" % config_path,
      deploy_utils.generate_site_xml(args,
        args.hbase_config.configuration.generated_files["hbase-site.xml"]))
  deploy_utils.write_file("%s/hadoop-metrics.properties" % config_path,
      generate_metrics_config(args, master_host, "master"))
  deploy_utils.write_file("%s/core-site.xml" % config_path,
      deploy_utils.generate_site_xml(args,
        args.hbase_config.configuration.generated_files["core-site.xml"]))
  deploy_utils.write_file("%s/hdfs-site.xml" % config_path,
      deploy_utils.generate_site_xml(args,
        args.hbase_config.configuration.generated_files["hdfs-site.xml"]))
  deploy_utils.write_file("%s/jaas.conf" % config_path,
      deploy_zookeeper.generate_client_jaas_config(args))
  deploy_utils.write_file("%s/krb5.conf" % config_path,
      args.hbase_config.configuration.raw_files["krb5.conf"])
  update_hbase_env_sh(args, artifact, version)