1.下载apache-hive-0.13.0-bin.tar.gz 默认下载存放路径/usr/local/apache-hive-0.13.0-bin.tar.gz
tar -zvxf apache-hive-0.13.0-bin.tar.gz
mv apache-hive-0.13.0-bin hive-0.13.0
2.配置环境变量
export HIVE_HOME=/usr/local/hive-0.13.0
export $PAHT=$HIVE_HOME/bin:$PATH
3.配置hive
cp hive-default.xml.template hive-site.xml
修改hive-site.xml(删除所有内容,只留一个<property></property>)
添加如下内容:
<!-- mysql 数据库连接 -->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?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-connector-5.1.8.jar 到$HIVE_HOME/lib 下
5.hive 依赖hadoop,启动hadoop
sh start-dfs.sh && sh start-yarn.sh
6.启动mysql
service mysql start
7.用hive 外壳启动hive
$HIVE_HOME/bin/hive
注意:
如果报错:An exception was thrown while adding/validating class(es) : Specified key was too long;
max key length is 767 bytesAn exception was thrown while adding/validating class(es)
解决方案:在mysql上 :alter database hive character set latin1; 重启hive
tar -zvxf apache-hive-0.13.0-bin.tar.gz
mv apache-hive-0.13.0-bin hive-0.13.0
2.配置环境变量
export HIVE_HOME=/usr/local/hive-0.13.0
export $PAHT=$HIVE_HOME/bin:$PATH
3.配置hive
cp hive-default.xml.template hive-site.xml
修改hive-site.xml(删除所有内容,只留一个<property></property>)
添加如下内容:
<!-- mysql 数据库连接 -->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?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-connector-5.1.8.jar 到$HIVE_HOME/lib 下
5.hive 依赖hadoop,启动hadoop
sh start-dfs.sh && sh start-yarn.sh
6.启动mysql
service mysql start
7.用hive 外壳启动hive
$HIVE_HOME/bin/hive
注意:
如果报错:An exception was thrown while adding/validating class(es) : Specified key was too long;
max key length is 767 bytesAn exception was thrown while adding/validating class(es)
解决方案:在mysql上 :alter database hive character set latin1; 重启hive