这篇文章给大家分享的是有关Hive CLI beeline是什么的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
未来替换hive脚本的最新使用方式。
HiveServer2提供了一个新的命令行工具Beeline,它是基于SQLLine CLI的JDBC客户端。关于SQLLine的的知识,可以参考这个网站:http://sqlline.sourceforge.net/#manual
Beeline工作模式有两种,即本地嵌入模式和远程模式。嵌入模式情况下,它返回一个嵌入式的Hive(类似于Hive CLI)。而远程模式则是通过Thrift协议与某个单独的HiveServer2进程进行连接通信。
% bin/beeline Hive version 0.11.0-SNAPSHOT by Apache beeline> !connect jdbc:hive2://localhost:10000 scott tiger!connect jdbc:hive2://localhost:10000 scott tiger Connecting to jdbc:hive2://localhost:10000 Connected to: Hive (version 0.10.0) Driver: Hive (version 0.10.0-SNAPSHOT) Transaction isolation: TRANSACTION_REPEATABLE_READ 0: jdbc:hive2://localhost:10000> show tables; show tables; +-------------------+ | tab_name | +-------------------+ | primitives | | src | | src1 | | src_json | | src_sequencefile | | src_thrift | | srcbucket | | srcbucket2 | | srcpart | +-------------------+ 9 rows selected (1.079 seconds)
或者从系统出读取文件
You can also specify the connection parameters on command line. This means you can find the command with the connection string from your UNIX shell history.
% beeline -u jdbc:hive2://localhost:10000/default -n scott -w password_file Hive version 0.11.0-SNAPSHOT by Apache Connecting to jdbc:hive2://localhost:10000/default
Command | Description |
---|---|
!<SQLLine command> | List of SQLLine commands available at http://sqlline.sourceforge.net/. Example: |
The Beeline CLI supports these command line options:
Option | Description |
---|---|
Option | Description |
-u <database URL> | The JDBC URL to connect to. Usage: |
-r | Reconnect to last used URL (if a user has previously used Usage: Version: 2.1.0 (HIVE-13670) |
-n <username> | The username to connect as. Usage: |
-p <password> | The password to connect as. Usage: |
-d <driver class> | The driver class to use. Usage: |
-e <query> | Query that should be executed. Double or single quotes enclose the query string. This option can be specified multiple times. Usage: Support to run multiple SQL statements separated by semicolons in a single query_string: 1.2.0 (HIVE-9877) |
-f <file> | Script file that should be executed. Usage: Version: 0.12.0 (HIVE-4268) |
-w (or) --password-file <password file> | The password file to read password from. Version: 1.2.0 (HIVE-7175) |
--hiveconf property=value | Use value for the given configuration property. Properties that are listed inhive.conf.restricted.list cannot be reset with hiveconf (see Restricted List and Whitelist). Usage: Version: 0.13.0 (HIVE-6173) |
--hivevar name=value | Hive variable name and value. This is a Hive-specific setting in which variables can be set at the session level and referenced in Hive commands or queries. Usage: |
--color=[true/false] | Control whether color is used for display. Default is false. Usage: (Not supported for Separated-Value Output formats. See HIVE-9770) |
--showHeader=[true/false] | Show column names in query results (true) or not (false). Default is true. Usage: |
--headerInterval=ROWS | The interval for redisplaying column headers, in number of rows, when outputformat is table. Default is 100. Usage: (Not supported for Separated-Value Output formats. See HIVE-9770) |
--fastConnect=[true/false] | When connecting, skip building a list of all tables and columns for tab-completion of HiveQL statements (true) or build the list (false). Default is true. Usage: |
--autoCommit=[true/false] | Enable/disable automatic transaction commit. Default is false. Usage: |
--verbose=[true/false] | Show verbose error messages and debug information (true) or do not show (false). Default is false. Usage: |
--showWarnings=[true/false] | Display warnings that are reported on the connection after issuing any HiveQL commands. Default is false. Usage: |
--showNestedErrs=[true/false] | Display nested errors. Default is false. Usage: |
--numberFormat=[pattern] | Format numbers using a DecimalFormat pattern. Usage: |
--force=[true/false] | Continue running script even after errors (true) or do not continue (false). Default is false. Usage: |
--maxWidth=MAXWIDTH | The maximum width to display before truncating data, in characters, when outputformatis table. Default is to query the terminal for current width, then fall back to 80. Usage: |
--maxColumnWidth=MAXCOLWIDTH | The maximum column width, in characters, when outputformat is table. Default is 15. Usage: |
--silent=[true/false] | Reduce the amount of informational messages displayed (true) or not (false). It also stops displaying the log messages for the query from HiveServer2 (Hive 0.14 and later) and the HiveQL commands (Hive 1.2.0 and later). Default is false. Usage: |
--autosave=[true/false] | Automatically save preferences (true) or do not autosave (false). Default is false. Usage: |
--outputformat=[table/vertical/csv/tsv/dsv/csv2/tsv2] | Format mode for result display. Default is table. See Separated-Value Output Formatsbelow for description of recommended sv options. Usage: Version: dsv/csv2/tsv2 added in 0.14.0 (HIVE-8615) |
--truncateTable=[true/false] | If true, truncates table column in the console when it exceeds console length. Version: 0.14.0 (HIVE-6928) |
--delimiterForDSV= DELIMITER | The delimiter for delimiter-separated values output format. Default is '|' character. Version: 0.14.0 (HIVE-7390) |
--isolation=LEVEL | Set the transaction isolation level to TRANSACTION_READ_COMMITTED Usage: |
--nullemptystring=[true/false] | Use historic behavior of printing null as empty string (true) or use current behavior of printing null as NULL (false). Default is false. Usage: Version: 0.13.0 (HIVE-4485) |
--incremental=[true/false] | Defaults to |
--help | Display a usage message. Usage: |
感谢各位的阅读!关于“Hive CLI beeline是什么”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。