...
Using the set command in the CLI for setting session level values for the configuration variable for all statements subsequent to the set command. For example, the following command sets the scratch directory (which is used by Hive to store temporary output and plans) to
/tmp/mydir
for all subsequent statements:No Format set hive.exec.scratchdir=/tmp/mydir;
Using the
--hiveconf
option of thehive
command (in the CLI) or thebeeline
command for the entire session. For example:No Format bin/hive --hiveconf hive.exec.scratchdir=/tmp/mydir
In
hive-site.xml
. This is used for setting values for the entire Hive configuration. For example:No Format <property> <name>hive.exec.scratchdir</name> <value>/tmp/mydir</value> <description>Scratch space for Hive jobs</description> </property>
- In server specific configuration files. You can set metastore specific configuration values in hivemetastore-site.xml, and hiveserver2 specific configuration values in hiveserver2-site.xml
HiveMetastore server reads hive-site.xml as well as hivemetastore-site.xml configuration files that are available in the $HIVE_CONF_DIR or in the classpath. If metastore is being used in embedded mode (ie hive.metastore.uris is not set or empty) in hive commandline or hiveserver2, the hivemetastore-site.xml gets loaded by the parent process as well.
The value of hive.metastore.uris is examined to determine this, and the value should be set appropriately in hive-site.xml .
Certain metastore configuration parameters like hive.metastore.sasl.enabled, hive.metastore.kerberos.principal, hive.metastore.execute.setugi, hive.metastore.thrift.framed.transport.enabled are used by the metastore client as well as server. For such common parameters it is better to set the values in hive-site.xml, that will help in keeping them consistent.HiveServer2 reads hive-site.xml as well as hiveserver2-site.xml that are available in the $HIVE_CONF_DIR or in the classpath.
If hiveserver2 is using metastore in embedded mode, hivemetastore-site.xml also is loaded.The order of precedence of the config files is as follows (later one has higher precedence) -
hive-site.xml -> hivemetastore-site.xml -> hiveserver2-site.xml -> '-hiveconf' commandline parameters
hive-site.xml and hive-default.xml.template
...