Hive從零起步

1.上傳hive安裝包


2.解壓
    將Mysql的jdbc驅動包放到hive的lib下 java

三、配置 node

    3.1 安裝MySql mysql

       查詢之前安裝的mysql相關包
        rpm -qa | grep mysql
        暴力刪除這個包
        rpm -e mysql-libs-5.1.66-2.el6_3.i686 --nodeps

        rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm 
        rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm

        執行命令設置mysql
        /usr/bin/mysql_secure_installation

    設置權限
        GRANT ALL PRIVILEGES ON hive.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
        FLUSH PRIVILEGES

     執行如下命令,以防報錯:(若不執行會出現com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes sql


      alter database hive character set latin1; vim



     3.2 環境變量配置


       vim hive-env.sh

       export HADOOP_HOME=/usr/local/hadoop-2.6.0
        export HIVE_HOME=/usr/local/hive-1.2.1
        export HIVE_CONF_DIR=/usr/local/hive-1.2.1/conf

       

    vim hive-site.xml oop

<property>   <name>hive.metastore.warehouse.dir</name>   <value>/user/hive/warehouse</value>   <description>location of default database for the warehouse</description>  </property> <property>   <name>javax.jdo.option.ConnectionURL</name>   <value>jdbc:mysql://192.168.1.1/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> </property> <property>   <name>javax.jdo.option.ConnectionPassword</name>   <value>123456</value> </property> <property>   <name>hive.metastore.uris</name>   <value>thrift://192.168.1.1 :9083</value> </property>        須要更換Hadoop下面的jline文件  $HIVE_HOME/lib/jline-2.12.jar放到$HADOOP_HOME/share/hadoop/yarn/lib/jline-2.12.jar   啓動metastore,遠程訪問hive。   hive --service metastore &   
相關文章
相關標籤/搜索