Apache Ranger系列七:Hive 和 Spark 执行过程中的文件路径配置
背景:在使用Ranger鉴权的过程中,要求必须开启impersonation功能(即执行用户与提交用户保持一致,而不是统一代理的hive/spark)。但是在执行的过程中,会需要在hdfs存储临时的文件,此时容易出现权限不足的问题。对此,我们需要关注这些路径的生成/使用规则。
路径分析
报错异常的日志来自DagUtils
.java,这里我们没有粘贴完全
ERROR : Failed to execute tez graph.
Caused by: org.apache.hadoop.ipc.RemoteException: Permission denied: user=your_name, access=WRITE, inode="/user":hdfs:hdfsadmingroup:drwxr-xr-x
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPermissionChecker.java:399)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:255)
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(FSPermissionChecker.java:193)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(FSDirectory.java:1879)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(FSDirectory.java:1863)
分析源码
UserGroupInformation ugi = Utils.getUGI();
String userName = ugi.getShortUserName();
String userPathStr = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_USER_INSTALL_DIR);
Path userPath = new Path(userPathStr);
FileSystem fs = userPath.getFileSystem(conf); String jarPathStr = userPathStr + "/" + userName;
由于没有显示指定HiveConf.ConfVars.HIVE_USER_INSTALL_DIR
HIVE_JAR_DIRECTORY("hive.jar.directory", null,
"This is the location hive in tez mode will look for to find a site wide \n" +
"installed hive instance."), HIVE_USER_INSTALL_DIR("hive.user.install.directory", "/user/",
"If hive (in tez mode only) cannot find a usable hive jar in \"hive.jar.directory\", \n" +
"it will upload the hive jar to \"hive.user.install.directory/user.name\"\n" +
"and use it to run queries."),
jarPathStr = "/user/user.name"
https://cwiki.apache.org/confluence/display/hive/configuration+properties#ConfigurationProperties-hive.user.install.directory
与官方文档描述的一致:
hive.user.install.directory
- Default Value:
hdfs:///user/
- Added In: Hive 0.13.0 with HIVE-5003 and HIVE-6098
If Hive (in Tez mode only) cannot find a usable Hive jar in hive.jar.directory, it will upload the Hive jar to <hive.user.install.directory>/<user_name> and use it to run queries.
- Default Value:
同理,spark在执行时会将文件上传到hdfs的.sparkStaging/applicationId目录下
hdfs://yourcluster/user/your_username
与官方文档描述的一致:https://spark.apache.org/docs/latest/running-on-yarn.html#spark-properties
spark.yarn.stagingDir |
Current user's home directory in the filesystem | Staging directory used while submitting applications. |
路径配置
hadoop fs -mkdir -p /user/ranger/hive/
hadoop fs -chmod -R 777 /user/ranger/hive/ hadoop fs -mkdir -p /user/ranger/spark/staging/
hadoop fs -chmod -R 777 /user/ranger/spark/staging/
hive-site.xml里的 hive.user.install.directory 参数,定义了HDFS的路径
sudo vi /etc/hive/conf/hive-site.xml,增加下面的内容
<property>
<name>hive.user.install.directory</name>
<value>/user/ranger/hive/
</value> </property>
保存后,重启服务
sudo systemctl restart hive-server2.service
spark.yarn.stagingDir /user/ranger/spark/staging
不需要重启,yarn是实时调用生效的。
Apache Ranger系列七:Hive 和 Spark 执行过程中的文件路径配置的更多相关文章
- 【原创】控制perl和python脚本执行过程中脚本文件是否关闭的方法
引子 跟踪perl和python脚本对文件的访问,实际过程中,perl和python解析器在解析完脚本后,直接关闭了 脚本文件,在进程中查询不到是访问文件的脚本文件名称. shell.perl和pyt ...
- Hadoop概念学习系列之为什么hadoop/spark执行作业时,输出路径必须要不存在?(三十九)
很多人只会,但没深入体会和想为什么要这样? 拿Hadoop来说,当然,spark也一样的道理. 输出路径由Hadoop自己创建,实际的结果文件遵守part-nnnn的约定. 如何指定一个已有目录作为H ...
- Hive扩展功能(七)--Hive On Spark
软件环境: linux系统: CentOS6.7 Hadoop版本: 2.6.5 zookeeper版本: 3.4.8 主机配置: 一共m1, m2, m3这五部机, 每部主机的用户名都为centos ...
- mysql系列九、mysql语句执行过程及运行原理(分组查询和关联查询原理)
一.背景介绍 了解一个sql语句的执行过程,了解一部分都做了什么,更有利于对sql进行优化,因为你知道它的每一个连接.where.分组.子查询是怎么运行的,都干了什么,才会知道怎么写是不合理的. 大致 ...
- SQL SERVER 2008:内部查询处理器错误: 查询处理器在执行过程中遇到意外错误
今天一个同事突然告诉我,以前跑得很正常的一个SQL语句,执行时突然报如下错误: 消息1222,级别16,状态18,第1 行 已超过了锁请求超时时段. ...
- Deepin下phpunit安装,以及执行过程中所遇到的问题
Deepin下phpunit安装,以及执行过程中所遇到的问题 安装phpunit步骤 wget https://phar.phpunit.de/phpunit.phar chmod +x phpuni ...
- 【已解决】Makefile执行过程中出错:make: *** No rule to make target ` ‘, needed by xxx. Stop(转载)
转自: http://www.crifan.com/makefile_error_make_no_rule_to_make_target_needed_by_stop/ [问题] 有个已有的Makef ...
- 转:Oracle中SQL语句执行过程中
Oracle中SQL语句执行过程中,Oracle内部解析原理如下: 1.当一用户第一次提交一个SQL表达式时,Oracle会将这SQL进行Hard parse,这过程有点像程序编译,检查语法.表名.字 ...
- UI5-技术篇-jQuery.ajax执行过程中Token验证及JSON格式传值问题
最近两天在测试OData服务类方法CREATE_DEEP_ENTITY及GET_EXPANDED_ENTITYSET,刚开始采用ODataModel方式调用没有任何问题,但是ODataModel采用的 ...
- maven执行过程中抛出的各类异常信息
价值 各类异常信息分类 举例 maven源代码的模块maven-core里的各类*Exception命名的class包含里,maven执行过程中打印的各类异常日志内容 比如如下错误 错误信息分别来自( ...
随机推荐
- 如何修改vagrant系统的root用户密码
1. 先使用vagrant 用户登录. 2. $sudo passwd root #按照提示输入两次新的密码,并加以确认. 然后就可以修改root用户密码
- Promise的几个方法解析
Promise.all 此方法在集合多个 promise 的返回结果时很有用. 输入的promise中只要有一个reject,即进入reject,否则会进入then 完成(Fulfillment):在 ...
- python如何实现对word内段落文本及表格的读取
在以下方法中用到的三方库是:python-docx from docx import Document 获取指定段落的文本 def get_paragraph_text(path, n): " ...
- 分布式事务 seata
seata-server-1.3.0 配置: file.conf: registry.conf: application.yml配置: 配置中心配置文件: 数据库: 使用:
- Linux:服务器(CentOS)搭建FTP服务
Vsftpd(very secure FTP deamon)是众多Linux发行版中默认的FTP服务器.本文以CentOS 8(腾讯云)服务器为例,使用vsftpd搭建Linux云服务器的FTP服务器 ...
- How to find WWN and WWPN of HBA card in Linux
There are several ways to detect the WWN of a Fibre Channel (FC) HBA and their details in Linux/Unix ...
- Linux 使用vsftpd服务传输文件
文件传输协议 FTP是一种在互联网中进行文件传输的协议,基于客户端/服务器模式,默认使用20.21号端口,其中端口20(数据端口)用于进行数据传输,端口21(命令端口)用于接受客户端发出的相关FTP命 ...
- 添加新模块 import
import getpass username = input("username") password = input("password") #passwo ...
- Eclipse 搭建一个简单的SpringBoot+WebSocket环境
WebSocket是一种在单个TCP连接上进行全双工通信的协议. WebSocket通信协议于2011年被IETF定为标准RFC 6455,并由RFC7936补充规范. WebSocket API也被 ...
- shell相关基础面试题
用sed修改test.txt的23行test为tset: sed –i '23s/test/tset/g' test.txt 查看/web.log第25行第三列的内容. sed –n '25p' /w ...