1.下载hive安装包

http://www.eu.apache.org/dist/hive/stable/apache-hive-1.2.2-bin.tar.gz

2.将apache-hive-1.2.2-bin.tar.gz上传到/usr/local/src目录下,解压

tar -zxvf apache-hive-1.2.2-bin.tar.gz

3.配置hive-site.xml

进入conf目录

cp hive-default.xml.template hive-site.xml

在hive-site.xml文件开头增加如下配置

<property>
    <name>system:java.io.tmpdir</name>
    <value>/tmp/hive/java</value>
</property>
<property>
    <name>system:user.name</name>
    <value>${user.name}</value>
</property>

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

4.配置hive-env.sh

cp hive-env.sh.template hive-env.sh

修改hive-env.sh文件:

HADOOP_HOME=/usr/local/src/hadoop-2.6.5
JAVA_HOME=/usr/local/src/jdk1.8.0_172
HIVE_HOME=/usr/local/src/apache-hive-1.2.2-bin

5.把mysql-connector-java-5.1.41-bin.jar拷贝到hive的lib目录中

posted on 2019-11-25 19:39  shen1hua  阅读(169)  评论(0编辑  收藏  举报