Улей: Как получить название кластера - PullRequest
0 голосов
/ 27 ноября 2018

Я хочу получить имя кластера, на котором работает куст.Обычно я делаю

[user@someVM ~]$ hive -H
*Attached to the someCluster Hadoop cluster*
usage: hive
 -d,--define <key=value>          Variable subsitution to apply to hive
                                  commands. e.g. -d A=B or --define A=B
    --database <databasename>     Specify the database to use
 -e <quoted-query-string>         SQL from command line
 -f <filename>                    SQL from files
 -h <hostname>                    connecting to Hive Server on remote host
 -H,--help                        Print help information
    --hiveconf <property=value>   Use value for given property
    --hivevar <key=value>         Variable subsitution to apply to hive
                                  commands. e.g. --hivevar A=B
 -i <filename>                    Initialization SQL file
 -p <port>                        connecting to Hive Server on port number
 -S,--silent                      Silent mode in interactive shell
 -v,--verbose                     Verbose mode (echo executed SQL to the
                                  console)

, поэтому здесь я могу легко увидеть *Attached to the someCluster Hadoop cluster* и сказать, в каком кластере я нахожусь.Затем я попытался

[user@someVM ~]$ hive -H > out.txt

, но вот что было захвачено

[user@someVM ~]$ hive -H > out.txt
[user@someVM ~]$ cat out.txt
usage: hive
     -d,--define <key=value>          Variable subsitution to apply to hive
                                      commands. e.g. -d A=B or --define A=B
        --database <databasename>     Specify the database to use
     -e <quoted-query-string>         SQL from command line
     -f <filename>                    SQL from files
     -h <hostname>                    connecting to Hive Server on remote host
     -H,--help                        Print help information
        --hiveconf <property=value>   Use value for given property
        --hivevar <key=value>         Variable subsitution to apply to hive
                                      commands. e.g. --hivevar A=B
     -i <filename>                    Initialization SQL file
     -p <port>                        connecting to Hive Server on port number
     -S,--silent                      Silent mode in interactive shell
     -v,--verbose                     Verbose mode (echo executed SQL to the
                                      console)

обратите внимание, что *Attached to the someCluster Hadoop cluster* не был отправлен в файл out.txt

Как можноЯ захватил линию *Attached to the someCluster Hadoop cluster*?

1 Ответ

0 голосов
/ 27 ноября 2018

так вот как я это сделал

hive -H 2>&1 | tee out.txt

тогда cat out.txt дает мне

*Attached to the someCluster Hadoop cluster*
usage: hive
 -d,--define <key=value>          Variable subsitution to apply to hive
                                  commands. e.g. -d A=B or --define A=B
    --database <databasename>     Specify the database to use
 -e <quoted-query-string>         SQL from command line
 -f <filename>                    SQL from files
 -h <hostname>                    connecting to Hive Server on remote host
 -H,--help                        Print help information
    --hiveconf <property=value>   Use value for given property
    --hivevar <key=value>         Variable subsitution to apply to hive
                                  commands. e.g. --hivevar A=B
 -i <filename>                    Initialization SQL file
 -p <port>                        connecting to Hive Server on port number
 -S,--silent                      Silent mode in interactive shell
 -v,--verbose                     Verbose mode (echo executed SQL to the
                                  console)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...