hive:如何获取集群的名称

zi8p0yeb  于 2021-06-01  发布在  Hadoop
关注(0)|答案(1)|浏览(396)

我要获取运行配置单元的群集的名称。通常,我做的是

[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* ?

v1l68za4

v1l68za41#

所以我就是这样做的 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)

相关问题