4、编辑Hive配置文件
a、编辑 hive-env.sh ,指定 HADOOP_HOME 、HIVE_CONF_DIR
[grid@hadoop1 conf]$ pwd
/home/grid/apache-hive-1.0.0-bin/conf
[grid@hadoop1 conf]$ cp hive-env.sh.template hive-env.sh
[grid@hadoop1 conf]$ vim hive-env.sh
# Set HADOOP_HOME to point to a specific hadoop install directory
HADOOP_HOME=/home/grid/hadoop-1.2.1
# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/home/grid/apache-hive-1.0.0-bin/conf
b、编辑 hive-site.xml ,修改数据库连接属性(javax.jdo.option.ConnectionURL/ConnectionDriverName/ConnectionUserName/ConnectionPassword)
[grid@hadoop1 conf]$ cp hive-default.xml.template hive-site.xml
[grid@hadoop1 conf]$ vi hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.0.103:3306/hivedb</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://192.168.0.104:9083</value>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>