Modifying the Hive Configuration Files
- All Hive configuration files are stored in the $HIVE_HOME/conf directory. Before modifying the configuration files, go to the $HIVE_HOME/conf directory first.
1cd $HIVE_HOME/conf
- Modify the hive-env.sh file.
- Copy the Hive log configuration template file to generate an editable configuration file.
1cp hive-env.sh.template hive-env.sh
- Open hive-env.sh.
1vi hive-env.sh - Press i to enter the insert mode and add the following content to the file:
1 2 3
export JAVA_HOME=/usr/local/jdk8u252-b09 export HADOOP_HOME=/usr/local/hadoop export HIVE_CONF_DIR=/usr/local/hive/conf
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Copy the Hive log configuration template file to generate an editable configuration file.
- Modify the hive-log4j2.properties log configuration file.
- Copy the Hive log configuration template file to generate an editable configuration file.
1cp hive-log4j2.properties.template hive-log4j2.properties
- Open the hive-log4j2.properties file.
1vi hive-log4j2.properties - Press i to enter the insert mode and modify parameters in the hive-log4j2.properties file.
1property.hive.log.dir = /usr/local/hive/log
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Copy the Hive log configuration template file to generate an editable configuration file.
- Modify the hive-site.xml file.
- Change the name of the hive-default.xml.template file to hive-site.xml.
1cp hive-default.xml.template hive-site.xml
- Run the following command to replace for&# with for to prevent encoding problems during initialization:
1sed -i 's/for&#/for/g' hive-site.xml
- Open the file.
1vi hive-site.xml - Press i to enter the insert mode. Modify the values of related parameters in the hive-site.xml file or add the values to the end of the hive-site.xml file as follows.Set the user name, password, and ZooKeeper IP address and port.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
<property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://server1:3306/hive?createDatabaseIfNotExist=true</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>root</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>xxxxxxxx</value> <!--The password is the database password set when installing MariaDB.--> </property> <property> <name>hive.exec.local.scratchdir</name> <value>/tmp/hive</value> </property> <property> <name>hive.downloaded.resources.dir</name> <value>/tmp/${hive.session.id}_resources</value> </property> <property> <name>hive.querylog.location</name> <value>/tmp/hive</value> </property> <property> <name>hive.server2.logging.operation.log.location</name> <value>/tmp/hive/operation_logs</value> </property> <property> <name>hive.tez.exec.print.summary</name> <value>true</value> </property> <property> <name>hive.tez.container.size</name> <value>10240</value> </property> <property> <name>hive.exec.dynamic.partition.mode</name> <value>nonstrict</value> </property> <property> <name>hive.exec.max.dynamic.partitions</name> <value>100000</value> </property> <property> <name>hive.exec.max.dynamic.partitions.pernode</name> <value>100000</value> </property> <property> <name>hive.exec.max.created.files</name> <value>1000000</value> </property> <property> <name>hive.execution.engine</name> <value>tez</value> </property> <property> <name>hive.zookeeper.quorum</name> <value>agent1:2181,agent2:2181,agent3:2181</value> </property>
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Change the name of the hive-default.xml.template file to hive-site.xml.
Parent topic: Deploying Hive