Hive部署安装

1.解压安装包

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

2.添加环境变量,在文件/etc/profile中或者/home/登录用户名/.bash_profile中添加,两者有什么区别请自行查找。

    导入下面的环境变量

    export HIVE_HOME = hive目录路径

    export PATH = $HIVE_HOME/bin

    使用下面的命令使修改的环境变量生效

     source /etc/profile   或者  source /home/登录用户名/.bash_profile

3.配置hive-env.sh 

   添加hadoop_home路径:

    HADOOP_HOME = hadoop安装路径

    添加HIVE_CONF_DIR路径:

    export HIVE_CONF_DIR = hive中的conf目录路径

    添加HIVE_AUX_JARS_PATH路径:

    export HIVE_AUX_JARS_PATH = hive中lib目录路径

4.在hive/lib目录下放入mysql-connector-java-5.1.40.jar包

5.修改配置文件hive-site.xml

       


    hive.exec.local.scratchdir
    /data/tmp/hive/local
    Local scratch space for Hive jobs


    

  
    hive.downloaded.resources.dir
    /data/tmp/hive/resources
    Temporary local directory for added resources in the remote file system.
 


  
    javax.jdo.option.ConnectionPassword
    需要连接mysql数据库的密码
    password to use against metastore database
 


  
    javax.jdo.option.ConnectionURL
   
    jdbc:mysql://mysql数据库ip地址:3306/hive?createDatabaseIfNotExist=true&useSSL=false
   
      JDBC connect string for a JDBC metastore.
      To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
      For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
   

 


  
    datanucleus.schema.autoCreateAll
    true
    Auto creates necessary schema on a startup if one doesn't exist. Set this to false, after creating it once.To enable auto create also set hive.metastore.schema.verification=false. Auto creation is not recommended for production use cases, run schematool command instead.
 


 
    hive.metastore.schema.verification
    false
   
      Enforce metastore schema version consistency.
      True: Verify that version information stored in is compatible with one from Hive jars.  Also disable automatic
            schema migration attempt. Users are required to manually migrate schema after Hive upgrade which ensures
            proper metastore schema migration. (Default)
      False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
   

 


    

  
    javax.jdo.option.ConnectionDriverName
    com.mysql.jdbc.Driver
    Driver class name for a JDBC metastore
 


  
    javax.jdo.option.ConnectionUserName
    连接的mysql数据库用户名
    Username to use against metastore database
 


6.启动hive:

   hive启动分为metastore和hiveserver2,其中metastore用于和mysql之间的表结构创建或更新时通讯,hiveserver2用于客户端连接,这两个都要启动。

   启动metastore的命令:

nohup ./hive --service metastore >> metastore.log 2>&1 &
启动hiveserver2的命令:
nohup ./hive --service hiveserver2 > hiveserver2.log 2>&1 &

你可能感兴趣的:(大数据,hive)