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的DDL/DML作业计算结果本地存储目录 -->   

<property>
    <name>hive.exec.local.scratchdir</name>
    <value>/data/tmp/hive/local</value>
    <description>Local scratch space for Hive jobs</description>

</property>


 <!--  用于向远程文件系统添加资源的本地临时目录 -->   

  <property>
    <name>hive.downloaded.resources.dir</name>
    <value>/data/tmp/hive/resources</value>
    <description>Temporary local directory for added resources in the remote file system.</description>
  </property>


  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>需要连接mysql数据库的密码</value>
    <description>password to use against metastore database</description>
  </property>


  <property>
    <name>javax.jdo.option.ConnectionURL</name>
   <!-- <value>jdbc:derby:;databaseName=metastore_db;create=true</value> -->
    <value>jdbc:mysql://mysql数据库ip地址:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value>
    <description>
      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.
    </description>
  </property>


  <property>
    <name>datanucleus.schema.autoCreateAll</name>
    <value>true</value>
    <description>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.</description>
  </property>


  <property>
    <name>hive.metastore.schema.verification</name>
    <value>false</value>
    <description>
      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.
    </description>
  </property>


 <!--  连接mysql数据库的驱动 -->   

  <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>连接的mysql数据库用户名</value>
    <description>Username to use against metastore database</description>
  </property>


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 &
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值