当前位置: 首页 > news >正文

【hive基础】hive常见操作速查

文章目录

  • 一. hive变量操作
    • 1. 查看当前hive配置信息
    • 2. 设置变量
    • 3. 修改变量
    • 4. 进入hive终端重新加载配置
  • 二. 执行hive sql
  • 三. 启动hive

一. hive变量操作

1. 查看当前hive配置信息

# 查看当前所有配置信息
hive > set ;# 查看某一项配置信息
hive >set hive.metastore.uris;

不进入hive终端模糊搜索某项配置

# 模糊搜索set命令的输出结果中某个于warehouse相关的属性
$ hive -S -e "set" | grep warehouse
hive.metastore.warehouse.dir=/user/hive/warehouse
hive.warehouse.subdir.inherit.perms=false

 

2. 设置变量

hive> set com.gao.username;
com.gao.username is undefined
hive> set com.gao.username=liang;
hive> set com.gao.username;
com.gao.username=liang

设置hive变量

$ bin/hive --hiveconf <property=value>

注意:此种方式设置属性的值,仅仅在当前会话session生效。

 

3. 修改变量

# hiveconf: Hive相关的配置属性
# 不进入Hive进行配置属性修改
hive --hiveconf hive.cli.print.current.db=true
# 进入hive进行配置修改
hive>set hiveconf:hive.cli.print.current_db=true;

注意有些hiveconf无法修改

# 查看
hive> set hiveconf:hive.security.authorization.enabled;
hiveconf:hive.security.authorization.enabled=true# 设置失败
hive> set hiveconf:hive.security.authorization.enabled=false;
Query returned non-zero code: 1, cause: Cannot modify hive.security.authorization.enabled at runtime. It is in the list of parameters that can't be modified at runtime or is prefixed by a restricted variable

 

4. 进入hive终端重新加载配置

$ hive --config /hive-0.9.0/conf (重新载入新的配置文件)

 

二. 执行hive sql

# 执行命令方式1:使用下面的 “一次使用”命令(-e是指一次执行,-S是指静默模式,在输出结果中不显示Ok和Time taken字段)
hive -e -S "select * from mytable limit 3";# 执行命令方式2:调用Hive执行hql文件
hive -f /path/query.hql# 执行命令方式3:在Hive shell内执行hql文件
$ hive
hive>source /path/query.hql

 

三. 启动hive

启动hiveserver和metastore

nohup hive --service hiveserver2 >> /tmp/hiveserver2.log 2>&1 &
nohup hive --service metastore >> /tmp/hivemeta.log 2>&1 &

 

http://www.lryc.cn/news/233835.html

相关文章:

  • 2024年山东省职业院校技能大赛中职组“网络安全”赛项竞赛试题-A
  • 基于51单片机电子钟温度计数码显示设计( proteus仿真+程序+设计报告+讲解视频)
  • jenkins+centos7上传发布net6+gitlab
  • python趣味编程-5分钟实现一个F1 赛车公路游戏(含源码、步骤讲解)
  • Kafka快速入门
  • 基于Pytorch的从零开始的目标检测
  • interview review
  • layui表头多出一列(已解决)
  • ​LeetCode解法汇总307. 区域和检索 - 数组可修改
  • Java源码分析:Guava之不可变集合ImmutableMap的源码分析
  • 详解自动化测试之 Selenium
  • vue监听对象属性值变化
  • Unicode编码的emoji表情如何在前端页面展示(未完成)
  • 基于SSM的设备配件管理和设备检修系统
  • 鸿蒙开发|鸿蒙系统项目开发前的准备工作
  • Evil靶场
  • 第77题. 组合
  • 读书笔记:彼得·德鲁克《认识管理》第21章 企业与政府
  • C/C++疫情集中隔离 2021年12月电子学会青少年软件编程(C/C++)等级考试一级真题答案解析
  • 052-第三代软件开发-系统监测
  • 向量矩阵范数pytorch
  • NVIDIA Jetson OTA升级
  • 【算法】算法题-20231118
  • 某60区块链安全之整数溢出漏洞实战学习记录
  • 图数据库Neo4J 中文分词查询及全文检索(建立全文索引)
  • element-china-area-data使用问题
  • 248: vue+openlayers 以静态图片作为底图,并在上面绘制矢量多边形
  • thinkphp6(TP6)访问控制器报404(Nginx)
  • 腾讯云轻量应用服务器使用场景列举说明
  • 【漏洞复现】IP-guard WebServer 远程命令执行