Impala Shell Configuration File
You can store a set of default settings for impala-shell in the impala-shell configuration file.
The global impala-shell configuration file is located
in /etc/impalarc
.
The user-level impala-shell configuration file is
located in ~/.impalarc
.
Note that the global-level file name is different from the user-level file name. The global-level file name does not include a dot (.) in the file name.
The default path of the global configuration file can be changed by
setting the $IMPALA_SHELL_GLOBAL_CONFIG_FILE
environment
variable.
To specify a different file name or path for the user-level configuration
file, start impala-shell with the
--config_file
impala-shell option set to the path of the
configuration file.
Typically, an administrator creates the global configuration file for the impala-shell, and if the user-level configuration file exists, the options set in the user configuration file take precedence over those in the global configuration file.
In turn, any options you specify on the impala-shell command line override any corresponding options within the configuration file.
The impala-shell configuration file (global or user)
must contain a header label [impala]
, followed by the
options specific to impala-shell.
The impala-shell configuration file consists of
key-value pairs, one option per line. Everything after the
#
character on a line is treated as a comment and
ignored.
The names of the options in the configuration file are similar (although not necessarily identical) to the long-form command-line arguments to the impala-shell command. For the supported options in the configuration file, see Impala Shell Configuration Options.
You can specify key-value pair options using keyval
,
similar to the --var
command-line option. For example,
keyval=
variable1=value1.
The query options specified in the [impala]
section
override the options specified in the
[impala.query_options]
section.
The following example shows a configuration file that you might use
during benchmarking tests. It sets verbose mode, so that the output from
each SQL query is followed by timing information.
impala-shell starts inside the database containing
the tables with the benchmark data, avoiding the need to issue a
USE
statement or use fully qualified table names.
In this example, the query output is formatted as delimited text rather
than enclosed in ASCII art boxes, and is stored in a file rather than
printed to the screen. Those options are appropriate for benchmark
situations, so that the overhead of impala-shell
formatting and printing the result set does not factor into the timing
measurements. It also enables the show_profiles
option.
That option prints detailed performance information after each query,
which might be valuable in understanding the performance of benchmark
queries.
[impala]
verbose=true
default_db=tpc_benchmarking
write_delimited=true
output_delimiter=,
output_file=/home/tester1/benchmark_results.csv
show_profiles=true
keyval=msg1=hello,keyval=msg2=world
The following example shows a configuration
file that connects to a specific remote Impala node, runs a single query
within a particular database, then exits. Any query options predefined
under the [impala.query_options]
section in the
configuration file take effect during the session.
You would typically use this kind of single-purpose configuration
setting with the impala-shell command-line option
--config_file=path_to_config_file
,
to easily select between many predefined queries that could be run against
different databases, hosts, or even different clusters. To run a sequence
of statements instead of a single query, specify the configuration option
query_file=path_to_query_file
instead.
[impala]
impalad=impala-test-node1.example.com
default_db=site_stats
# Issue a predefined query and immediately exit.
query=select count(*) from web_traffic where event_date = trunc(now(),'dd')
[impala.query_options]
mem_limit=32g