Ejemplo n.º 1
0
def get_hbase_param(key, default):
    env = os.environ.copy()
    if os.name == 'posix':
        hbase_exec_name = 'hbase'
    elif os.name == 'nt':
        hbase_exec_name = 'hbase.cmd'
    else:
        print(
            'Unknown platform "%s", defaulting to HBase executable of "hbase"'
            % os.name)
        hbase_exec_name = 'hbase'

    hbase_cmd = phoenix_queryserver_utils.which(hbase_exec_name)
    if hbase_cmd is None:
        print('Failed to find hbase executable on PATH, defaulting %s to %s.' %
              (key, default))
        return default

    env['HBASE_CONF_DIR'] = phoenix_queryserver_utils.hbase_conf_dir
    proc = subprocess.Popen(
        [hbase_cmd, 'org.apache.hadoop.hbase.util.HBaseConfTool', key],
        env=env,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE)
    (stdout, stderr) = proc.communicate()
    if proc.returncode != 0:
        print('Failed to extract %s from hbase-site.xml, defaulting to %s.' %
              (key, default))
        return default
    # Don't expect this to happen, but give a default value just in case
    if stdout is None:
        return default

    stdout = tryDecode(stdout.strip())
    if stdout == 'null':
        return default
    return stdout
Ejemplo n.º 2
0
# Avatica HTTPS truststore
parser.add_argument(
    '-t',
    '--truststore',
    help='Truststore file that contains the TLS certificate of the server.')
parser.add_argument('-tp',
                    '--truststore-password',
                    help='Password for the server TLS certificate truststore')
# Common arguments across sqlline.py and sqlline-thin.py
phoenix_queryserver_utils.common_sqlline_args(parser)
# Parse the args
args = parser.parse_args()

phoenix_queryserver_utils.setPath()

url = tryDecode(args.url)
sqlfile = tryDecode(args.sqlfile)

serialization_key = 'phoenix.queryserver.serialization'
default_serialization = 'PROTOBUF'
hbase_authentication_key = 'hbase.security.authentication'
default_hbase_authentication = ''
spnego_auth_disabled_key = 'phoenix.queryserver.spnego.auth.disabled'
default_spnego_auth_disabled = 'false'


def cleanup_url(url):
    parsed = parse_url(url)
    if parsed.scheme == "":
        url = "http://" + url
        parsed = parse_url(url)
Ejemplo n.º 3
0
        command = 'stop'
    elif args[1] == 'makeWinServiceDesc':
        command = 'makeWinServiceDesc'

if command:
    # Pull off queryserver.py and the command
    args = args[2:]
else:
    # Just pull off queryserver.py
    args = args[1:]

if os.name == 'nt':
    args = subprocess.list2cmdline(args)
else:
    import pipes  # pipes module isn't available on Windows
    args = " ".join([pipes.quote(tryDecode(v)) for v in args])

# HBase configuration folder path (where hbase-site.xml reside) for
# HBase/Phoenix client side property override
hbase_conf_dir = phoenix_queryserver_utils.hbase_conf_dir
hadoop_conf_dir = phoenix_queryserver_utils.hadoop_conf_dir

# TODO: add windows support
phoenix_file_basename = 'phoenix-%s-queryserver' % getpass.getuser()
phoenix_log_file = '%s.log' % phoenix_file_basename
phoenix_out_file = '%s.out' % phoenix_file_basename
phoenix_pid_file = '%s.pid' % phoenix_file_basename

# load hbase-env.??? to extract JAVA_HOME, HBASE_PID_DIR, HBASE_LOG_DIR
hbase_env_path = None
hbase_env_cmd = None