平台组件安装

hive 安装

  1. 解压hive

    [root@master h3cu]# tar -xzvf apache-hive-1.1.0-bin.tar.gz -C /usr/src/
  2. 修改系统环境变量

    [root@master h3cu]# vi /etc/profile 
    export HIVE_HOME=/usr/src/apache-hive-1.1.0-bin                                     
    export PATH=$PATH:$HIVE_HOME/bin
    [root@master ~]# source /etc/profile
    [root@master ~]# hive --version
    Hive 1.1.0
    Subversion git://localhost.localdomain/Users/noland/workspaces/hive-apache/hive -r 3
    b87e226d9f2ff5d69385ed20704302cffefab21
    Compiled by noland on Wed Feb 18 16:06:08 PST 2015
    From source with checksum bca57a923a7578b7e5e9350ffb165cca
  3. 修改 hive-site.xml 文件

    [root@master ~]# cd /usr/src/apache-hive-1.1.0-bin/conf
    [root@master conf]# cp hive-default.xml.template hive-site.xml
    
    • 修改内容

        <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>root</value>                                                             
          <description>password to use against metastore database</description>           
        </property> 
       <property>                                                                        
          <name>javax.jdo.option.ConnectionURL</name>
          <value>jdbc:mysql://master:3306/hive</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> 
- #### 执行命令 在vi编辑器中执行
# 修改数据路径,在配置文件中修改所有的数据路径
# 所有${system:java.io.tmpdir}/${system:user.name}
# 改成/usr/src/apache-hive-1.1.0-bin/tmp/root
: %s@${system:user.name}@root@g 
: %s@${system:java.io.tmpdir}@/usr/src/apache-hive-1.1.0-bin/tmp@g
  1. 复制mysql驱动到hive/lib下

    [root@master conf]# cp /h3cu/mysql-connector-java-5.1.47.jar /usr/src/apache-hive-1.1.0-bin/lib/
  1. 初始化hive

    [root@master conf]# cd /usr/src/apache-hive-1.1.0-bin/bin
    [root@master bin]# schematool -dbType mysql -initSchema
    [ERROR] Terminal initialization failed; falling back to unsupported
    java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface wa
    s expected
# 由于 hadoop 2.6.0 中 jline 包版本冲突所有这里进行删除
[root@master bin]# cd /usr/src/hadoop-2.6.0/share/hadoop/yarn/lib
[root@master lib]# rm -rf jline-0.9.94.jar
# 重新初始化
[root@master lib]# cd /usr/src/apache-hive-1.1.0-bin/bin                            
[root@master bin]# schematool -dbType mysql -initSchema
  1. 启动hive

    [root@master bin]# hive
  1. 重置mysql数据库密码

    [root@master bin]# vi /etc/my.cnf
    skip-grant-tables
    [root@master bin]# systemctl restart mysqld
    [root@master bin]# mysql -u root -p
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    mysql> set password for 'root'@'localhost'=password('root');                        
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    mysql> quit
    Bye
    [root@master bin]# vi /etc/my.cnf
    #skip-grant-tables
    [root@master bin]# systemctl restart mysqld