Hive安裝

1.解壓java

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

2.在hive下的conf文件夾下建立hive-site.xmlnode

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

3.添加配置信息mysql

<?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在本機中的位置路徑)sql

5.複製mysql的連接jar包到hive的lib文件夾下apache

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

6.啓動hdfs,yarn及hiveoop

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庫則表示成功啦。spa

舒適提示:本文命令中的路徑和域名均爲本人機器的,請操做時改成自身路徑。且還有一些配置沒涉及到,須要時再本身配 哦。命令行

相關文章
相關標籤/搜索