Hive安装

1.解压

tar -zxvf apache-hive-0.13.1-bin.tar.gz -C /opt/modules/

2.在hive下的conf文件夹下创建hive-site.xml

touch hive-site.xml
vi hive-site.xml

3.添加配置信息

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://hadoop-senior.niel.com:3306/metastore?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>

    <property>
        <name>hive.cli.print.header</name>
        <value>true</value>
        <description>Whether to print the names of the columns in query output.</description>
    </property>

    <property>
        <name>hive.cli.print.current.db</name>
        <value>true</value>
        <description>Whether to include the current database in the Hive prompt.</description>
    </property>
</configuration>

4.修改hive-env.sh.template改名为hive-env.sh使其生效并配置HADOOP_HOME=(HADOOP在本机中的位置路径)

5.复制mysql的链接jar包到hive的lib文件夹下

cp mysql-connector-java-5.1.21-bin.jar /opt/modules/apache-hive-0.13.1-bin/lib/

6.启动hdfs,yarn及hive

sbin/hadoop-daemon.sh start namenode
sbin/hadoop-daemon.sh start datanode
sbin/yarn-daemon.sh start resourcemanager
sbin/yarn-daemon.sh start nodemanager
bin/hive

7.如果正常显示命令行还有在mysql数据 库下找到metastore库则表示成功啦。

温馨提示:本文命令中的路径和域名均为本人机器的,请操作时改为自身路径。且还有一些配置没涉及到,需要时再自己配 哦。

 

posted @ 2017-04-20 11:58  Kyhoon  阅读(205)  评论(0编辑  收藏  举报