In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is to share with you about what Hive CLI beeline is. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The latest way to replace hive scripts in the future.
HiveServer2 provides a new command line tool, Beeline, which is a JDBC client based on SQLLine CLI. For more information about SQLLine, you can refer to this website: http://sqlline.sourceforge.net/#manual
There are two modes of Beeline operation, local embedded mode and remote mode. In the case of embedded mode, it returns an embedded Hive (similar to Hive CLI). Remote mode, on the other hand, communicates with a single HiveServer2 process through Thrift protocol.
Beeline Example% bin/beeline Hive version 0.11.0-SNAPSHOT by Apachebeeline >! connect jdbc:hive2://localhost:10000 scott tigerheads connect jdbc:hive2://localhost:10000 scott tiger Connecting to jdbc:hive2://localhost:10000Connected to: Hive (version 0.10.0) Driver: Hive (version 0.10.0-SNAPSHOT) Transaction isolation: TRANSACTION_REPEATABLE_READ0: 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)
Or read files from the system
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_fileHive version 0.11.0-SNAPSHOT by ApacheConnecting to jdbc:hive2://localhost:10000/defaultBeeline Commands (using some commands from sqline)
Command
Description
!
List of SQLLine commands available at http://sqlline.sourceforge.net/.
Example:! quit exits the Beeline client.
Beeline Hive Commands (same as hive command) Beeline Command Options
The Beeline CLI supports these command line options:
Option
Description
Option
Description
-u
The JDBC URL to connect to.
Usage: beeline-u db_URL
-r
Reconnect to last used URL (if a user has previously used! connect to a URL and usedsaved to a beeline.properties file).
Usage: beeline-r
Version: 2.1.0 (HIVE-13670)
-n
The username to connect as.
Usage: beeline-n valid_user
-p
The password to connect as.
Usage: beeline-p valid_password
-d
The driver class to use.
Usage: beeline-d driver_class
-e
Query that should be executed. Double or single quotes enclose the query string. This option can be specified multiple times.
Usage: beeline-e "query_string"
Support to run multiple SQL statements separated by semicolons in a single query_string: 1.2.0 (HIVE-9877)
Bug fix (null pointer exception): 0.13.0 (HIVE-5765)
Bug fix (--headerInterval not honored): 0.14.0 (HIVE-7647)
Bug fix (running-e in background): 1.3.0 and 2.0.0 (HIVE-6758); workaround available for earlier versions
-f
Script file that should be executed.
Usage: beeline-f filepath
Version: 0.12.0 (HIVE-4268)
Note: If the script contains tabs, query compilation fails in version 0.12.0. This bug is fixed in version 0.13.0 (HIVE-6359).
Bug fix (running-f in background): 1.3.0 and 2.0.0 (HIVE-6758); workaround available for earlier versions
W (or)-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: beeline-- hiveconf prop1=value1
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: beeline-- hivevar var1=value1
-- color= [true/false]
Control whether color is used for display. Default is false.
Usage: beeline-- color=true
(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: beeline-- showHeader=false
-- headerInterval=ROWS
The interval for redisplaying column headers, in number of rows, when outputformat is table. Default is 100.
Usage: beeline-- headerInterval=50
(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: beeline-- fastConnect=false
-- autoCommit= [true/false]
Enable/disable automatic transaction commit. Default is false.
Usage: beeline-- autoCommit=true
-- verbose= [true/false]
Show verbose error messages and debug information (true) or do not show (false). Default is false.
Usage: beeline-- verbose=true
-- showWarnings= [true/false]
Display warnings that are reported on the connection after issuing any HiveQL commands. Default is false.
Usage: beeline-- showWarnings=true
-- showNestedErrs= [true/false]
Display nested errors. Default is false.
Usage: beeline-- showNestedErrs=true
-- numberFormat= [pattern]
Format numbers using a DecimalFormat pattern.
Usage: beeline-- numberFormat= "#, # #, # # 0.00"
-- force= [true/false]
Continue running script even after errors (true) or do not continue (false). Default is false.
Usage: beeline--force=true
-- 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: beeline-- maxWidth=150
-- maxColumnWidth=MAXCOLWIDTH
The maximum column width, in characters, when outputformat is table. Default is 15.
Usage: beeline-- maxColumnWidth=25
-- 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: beeline-- silent=true
-- autosave= [true/false]
Automatically save preferences (true) or do not autosave (false). Default is false.
Usage: beeline-- autosave=true
-- 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: beeline-- outputformat=tsv
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
Or TRANSACTION_SERIALIZABLE.
See the "Field Detail" section in the Java Connection documentation.
Usage: beeline-- isolation=TRANSACTION_SERIALIZABLE
-- 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: beeline-- nullemptystring=false
Version: 0.13.0 (HIVE-4485)
-- incremental= [true/false]
Defaults to false. When set to false, the entire result set is fetched and buffered before being displayed, yielding optimal display column sizing. When set to true, result rows are displayed immediately as they are fetched, yielding lower latency and memory usage at the price of extra display column padding. Setting-incremental=true is recommended if you encounter an OutOfMemory on the client side (due to the fetched result set size being large).
-- help
Display a usage message.
Usage: beeline-- help
Thank you for reading! This is the end of this article on "what is Hive CLI beeline?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.