Impala Shell Configuration File
You can define a set of default options for your impala-shell environment.
The impala-shell configuration file is stored in the
file $HOME/.impalarc. This file consists of key-value
pairs, one option per line. Everything after a #
character on a line is treated as a comment and ignored.
The configuration file must contain a header label
[impala]
, followed by the options specific to
impala-shell. (This standard convention for
configuration files lets you use a single file to hold configuration
options for multiple applications.)
To specify a different file name or path for the configuration file,
specify the argument
--config_file=path_to_config_file
on the impala-shell command line.
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.
Any options you specify on the impala-shell command line override any corresponding options within the configuration file.
You can specify key-value pair options using keyval
,
similar to the --var
command-line option. For example,
keyval=
variable1=value1.
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