Hive CLI User Manual

The writing is not complete enough, I will fill it up later when I have time <personal Chinese proficiency is limited, language organization is mediocre, sorry>
hive CLI language manual
[hive command line operation]
You can use the command ./hive -H or ./hive -help to view the help
( Used for hive version 0.9.0)
usage: hive
-d,--define <key=value> The variable substitution application in hive
-e <quoted-query-string> The hive command line does not display the execution process
-f <filename> Execute the hive script non-interactively, the script comes from an executable file
-H, --help print help
-h <hostname> Specify the server IP connected to hive --hiveconf <property=value> Specify the temporary configuration     during
    hive execution-
-hivevar <key=value> Same as above
-i <filename> Initialize the sql file
-p <port> Specify the port number to connect to the hive server
-S,--silent Execute the hive shll command in silent mode
-v,--verbose verbose mode (display the hive execution details on the console)
--database <dbname> Specify the database used


Example :
1. hive query
$HIVE_HOME/bin/hive -e 'select a.col from tab1 a'
2. Set the drive parameters of hive [The specific hive parameters will be explained in detail in the follow-up document]
$HIVE_HOME/bin/hive -e 'select a.col from tab1 a' --hiveconf hive.exec.scratchdir=/home/my /hive_scratch --hiveconf mapred.reduce.tasks=32
3. Output the output result to the specified text in a silent way
$HIVE_HOME/bin/hive -S -e 'select a.col from tab1 a' > a.txt
4 .Execute the local script in a non-interactive way
$HIVE_HOME/bin/hive -f /home/my/hive-script.sql
5. Execute the script file in the file system supported by hadoop in a non-interactive way
$HIVE_HOME/bin/hive -f hdfs://<namenode>:<port>/hive-script.sql
$HIVE_HOME/bin/hive -f s3://mys3bucket/s3-script.sql
6. Enter the interactive mode before the initialization script
$HIVE_HOME/bin/hive -i /home/my/hive-init.sql <not verified>


[Remarks]
hiverc file
When -i is not used to specify the initialization sql file, hive will Try loading $HIVE_HOME/bin/.hiverc and $HOME/.hiverc as initialization files

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326749100&siteId=291194637