hive - beeline命令行可以使用的命令

发布时间 2023-06-01 15:33:50作者: HOUHUILIN

 

 

 

beeline> !help
!all                Execute the specified SQL against all the current connections
!autocommit         Set autocommit mode on or off
!batch              Start or execute a batch of statements
!brief              Set verbose mode off
!call               Execute a callable statement
!close              Close the current connection to the database
!closeall           Close all current open connections
!columns            List all the columns for the specified table
!commit             Commit the current transaction (if autocommit is off)
!connect            Open a new connection to the database.
!dbinfo             Give metadata information about the database
!describe           Describe a table
!dropall            Drop all tables in the current database
!exportedkeys       List all the exported keys for the specified table
!go                 Select the current connection
!help               Print a summary of command usage
!history            Display the command history
!importedkeys       List all the imported keys for the specified table
!indexes            List all the indexes for the specified table
!isolation          Set the transaction isolation for this connection
!list               List the current connections
!manual             Display the BeeLine manual
!metadata           Obtain metadata information
!nativesql          Show the native SQL for the specified statement
!nullemptystring    Set to true to get historic behavior of printing null as
                    empty string. Default is false.
!outputformat       Set the output format for displaying results
                    (table,vertical,csv,tsv,xmlattrs,xmlelements)
!primarykeys        List all the primary keys for the specified table
!procedures         List all the procedures
!properties         Connect to the database specified in the properties file(s)
!quit               Exits the program
!reconnect          Reconnect to the database
!record             Record all output to the specified file
!rehash             Fetch table and column names for command completion
!rollback           Roll back the current transaction (if autocommit is off)
!run                Run a script from the specified file
!save               Save the current variabes and aliases
!scan               Scan for installed JDBC drivers
!script             Start saving a script to a file
!set                Set a beeline variable
!show               show an options current value
!source             Execute a SQL file
!sql                Execute a SQL command
!tables             List all the tables in the database
!typeinfo           Display the type map for the current connection
!verbose            Set verbose mode on

Comments, bug reports, and patches go to ???
beeline>

 

 

建立连接

beeline> !connect jdbc:hive2://node03:10000
scan complete in 3ms
Connecting to jdbc:hive2://node03:10000
Enter username for jdbc:hive2://node03:10000: harley
Enter password for jdbc:hive2://node03:10000: ******
2023-06-01 15:24:12,238 INFO jdbc.Utils: Supplied authorities: node03:10000
2023-06-01 15:24:12,239 INFO jdbc.Utils: Resolved authority: node03:10000
Connected to: Apache Hive (version 0.12.0-transwarp-tdh4310)
Driver: Hive JDBC (version 0.12.0-transwarp-tdh4310)
Transaction isolation: TRANSACTION_REPEATABLE_READ
beeline>
0: jdbc:hive2://node03:10000>

也可以直接写成一行:beeline> !connect jdbc:hive2://node03:10000 harley 123456