1.COPY配置文件:
cp hive-default.xml.template hive-site.xml
cp hive-env.sh.template hive-env.sh
cp hive-exec-log4j.properties.template hive-exec-log4j.properties
cp hive-log4j.properties.template hive-log4j.properties
2.配置HADOOP主目录:
vim hive-env.sh
HADOOP_HOME=/usr/app/hdp/hadoop
3.配置数据库(我用的mysql):
vim hive-site.sh
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.1.120:3306/test?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
<description>password to use against metastore database</description>
</property>
4.mysql官网下载连接库到lib下
5.连接hive测试:
./bin/hive
14/05/02 04:42:19 WARN conf.HiveConf: DEPRECATED: hive.metastore.ds.retry.* no longer has any effect. Use hive.hmshandler.retry.* instead
Logging initialized using configuration in file:/usr/app/hive/conf/hive-log4j.properties
hive>
6.建个表试试:
hive> create table test1(id int,name string);
OK
Time taken: 1.686 seconds
原文:http://xiaofengge315.blog.51cto.com/405835/1408486