Hive 2.1.1 安装

原创
2017/04/26 00:39
阅读数 214

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

配置环境变量

sudo vi ~/.bashrc:

export HIVE_HOME=/opt/apache-hive-2.1.1-bin
export PATH=$HIVE_HOME/bin:$PATH

安装mysql

作为metastore的储存

配置Hive

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

vi hive-site.xml:

<configuration>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://192.168.70.1:3306/hive?createDatabaseIfNotExist=true
&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false&amp;</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>hive</value>
        <description>username to use against metastore database</description>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>hive</value>
        <description>password to use against metastore database</description>
    </property>

<property>
   <name>hive.metastore.schema.verification</name>
   <value>false</value>
    <description>
    Enforce metastore schema version consistency.
    True: Verify that version information stored in metastore matches with one f
rom Hive jars.  Also disable automatic
          schema migration attempt. Users are required to manully migrate schema
 after Hive upgrade which ensures
          proper metastore schema migration. (Default)
    False: Warn if the version information stored in metastore doesn't match wit
h one from in Hive jars.
    </description>
 </property>

<property>
   <name>datanucleus.schema.autoCreateTables</name>
   <value>true</value>
</property>

<property>
  <name>hive.metastore.sasl.enabled</name>
  <value>false</value>
  <description>If true, the metastore Thrift interface will be secured with SASL
. Clients must authenticate with Kerberos.</description>
</property>

<property>
 <name>hive.server2.enable.doAs</name>
 <value>true</value>
</property>

<property>
  <name>hive.server2.authentication</name>
  <value>NONE</value>
</property>


</configuration>

安装Mysql JDBC驱动

下载 mysql-connector-java-5.1.41-bin.jar

cp mysql-connector-java-5.1.41-bin.jar /opt/apache-hive-2.1.1-bin/lib

配置Hive用户

在Hadoop的core-site.xml上加上hive用户的配置:

vi etc/hadoop/core-site.xml:

<!-- 定义hive用户vagrant -->
<property>
  <name>hadoop.proxyuser.vagrant.groups</name>
  <value>*</value>
</property>

<property>
  <name>hadoop.proxyuser.vagrant.hosts</name>
  <value>*</value>
</property>

重启启动Hadoop使配置生效:

stop-dfs.sh

stop-yarn.sh

hadoop-daemons.sh start journalnode

hadoop-daemons.sh start namenode

hadoop-daemons.sh start datanode

start-yarn.sh

hadoop-daemons.sh start zkfc

启动Hive

bin/hiveserver2

客户端连接Hive

beeline -u jdbc:hive2://192.168.70.103:10000 -n vagrant -p vagrant

show databases;

show tables;

select * from pokes;

访问 http://c7003:10002/ 可以查看hive服务器信息

界面客户端工具

下载Oracle SQL Developer:

http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html

下载Hive JDBC Driver for Oracle SQL Developer:

http://www.cloudera.com/downloads/connectors/hive/jdbc/2-5-15.html

解压,将Cloudera_HiveJDBC4_2.5.15.1040.zip解压

打开sqldeveloper.exe,点击”工具”–>“首选项”,在”数据库”–>”第三方JDBC驱动”中,添加Hive JDBC驱动。

重启sqldeveloper,就能看到可以建立Hive连接了。

 

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部