hive hadoop安装配置

1,下载

官网下载hive,如:hive-0.12.0.tar.gz

下载地址:http://mirrors.hust.edu.cn/apache/hive/

上传hive-0.12.0.tar.gz至/usr/local/src

2,解压

#tar -xvf hive-0.12.0.tar.gz

hive移到装好的hadoop目录下

#mv  hive-0.12.0 /usr/local/hadoop/hive

3,配置环境变量

#vim /etc/profile

在末尾添加如下代码:

export HIVE_HOME=/usr/local/hadoop/hive

export PATH=$HIVE_HOME/bin:$PATH

#source /etc/profile

4,启动hive

#hive

进入hive编辑命令模式,输入如下:

hive> show tables; 
OK 
Time taken: 3.496 seconds

代表安装成功

5,配置mysql数据源

#cd /usr/local/hadoop/hive/conf

#mv hive-default.xml.default hive-site.xml

修改如下内容:

<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>root123</value>  
  <description>password to use against metastore database</description>  
</property>

配置完之后把mysql-connector-java-5.1.17-bin.jar上传到hive下的lib目录 

重新启动

6,hive安装错误

  1,java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

  解决:

  将hive.site.xml文件中的

<property>

 <name>hive.metastore.schema.verification</name>

 <value>true</value>

  <description>

  </description>

</property>

改为false

  2,org.xml.sax.SAXParseException: The element type "value" must be terminated by the matching end-tag "</value>"

  解决:

  将hive-default.xml.template重命名为hive-site.xml

(hive-env.sh.template文件中存在一个bug,第2000行,<value>auth</auth>,应该改成<value>auth</value>

相关推荐