海豚dolphinscheduler-shell 执行hivesql任务 Permission denied 异常

在DolphinScheduler中执行涉及HSQL的任务时,遇到了由于缺少对/tmp/dolphinscheduler/hive.log文件的写权限导致的错误。异常详细信息涉及到log4j的配置问题,无法创建或访问该日志文件。解决方案包括使用命令行添加文件权限,创建并修改用户组,以及更新用户到组的映射。
摘要由CSDN通过智能技术生成

一、dolphinscheduler 执行shell处理hsql任务时出现没有访问权限

关键异常:

/tmp/dolphinscheduler/hive.log (Permission denied) java.io.FileNotFoundException: /tmp/dolphinscheduler/hive.log (Permission denied)

异常明细:

[INFO] 2023-04-20 11:09:03.350  - [taskAppId=TASK-43-815-3377]:[129] -  -> 2023-04-20 11:09:02,670 main ERROR Cannot access RandomAccessFile java.io.FileNotFoundException: /tmp/dolphinscheduler/hive.log (Permission denied) java.io.FileNotFoundException: /tmp/dolphinscheduler/hive.log (Permission denied)
		at java.io.RandomAccessFile.open0(Native Method)
		at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
		at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
		at java.io.RandomAccessFile.<init>(RandomAccessFile.java:124)
		at org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager$RollingRandomAccessFileManagerFactory.createManager(RollingRandomAccessFileManager.java:180)
		at org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager$RollingRandomAccessFileManagerFactory.createManager(RollingRandomAccessFileManager.java:156)
		at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:112)
		at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114)
		at org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager.getRollingRandomAccessFileManager(RollingRandomAccessFileManager.java:87)
		at org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender$Builder.build(RollingRandomAccessFileAppender.java:116)
		at org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender$Builder.build(RollingRandomAccessFileAppender.java:52)
		at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
		at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
		at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
		at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:239)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:159)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:131)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:101)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:188)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jDefault(LogUtils.java:176)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:109)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:101)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:84)
		at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:717)
		at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:701)
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.lang.reflect.Method.invoke(Method.java:498)
		at org.apache.hadoop.util.RunJar.run(RunJar.java:313)
		at org.apache.hadoop.util.RunJar.main(RunJar.java:227)
	
	2023-04-20 11:09:02,674 main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender, element RollingRandomAccessFile. java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager$RollingRandomAccessFileManagerFactory@f627d13] unable to create manager for [/tmp/dolphinscheduler/hive.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager$FactoryData@4e928fbf]
		at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:114)
		at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114)
		at org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager.getRollingRandomAccessFileManager(RollingRandomAccessFileManager.java:87)
		at org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender$Builder.build(RollingRandomAccessFileAppender.java:116)
		at org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender$Builder.build(RollingRandomAccessFileAppender.java:52)
		at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
		at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
		at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
		at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:239)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:159)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:131)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:101)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:188)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jDefault(LogUtils.java:176)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:109)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:101)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:84)
		at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:717)
		at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:701)
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.lang.reflect.Method.invoke(Method.java:498)
		at org.apache.hadoop.util.RunJar.run(RunJar.java:313)
		at org.apache.hadoop.util.RunJar.main(RunJar.java:227)
	
	2023-04-20 11:09:02,675 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender for element RollingRandomAccessFile. java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender
		at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:224)
		at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:130)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
		at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
		at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
		at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
		at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:239)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:159)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:131)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:101)
		at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:188)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jDefault(LogUtils.java:176)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:109)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:101)
		at org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:84)
		at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:717)
		at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:701)
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.lang.reflect.Method.invoke(Method.java:498)
		at org.apache.hadoop.util.RunJar.run(RunJar.java:313)
		at org.apache.hadoop.util.RunJar.main(RunJar.java:227)
	
	2023-04-20 11:09:02,676 main ERROR Null object returned for RollingRandomAccessFile in Appenders.
	2023-04-20 11:09:02,676 main ERROR Unable to locate appender "DRFA" for logger config "root"
[INFO] 2023-04-20 11:09:04.178  - [taskAppId=TASK-43-815-3377]:[217] - process has exited, execute path:/tmp/dolphinscheduler/exec/process/5/43/815/3377, processId:23896 ,exitStatusCode:0
[INFO] 2023-04-20 11:09:04.352  - [taskAppId=TASK-43-815-3377]:[129] -  -> 23/04/20 11:09:03 INFO session.SessionState: Created HDFS directory: /tmp/hive/dolphinscheduler/82a46c9d-de6c-45fb-ac3b-9c6bdeba6569
	23/04/20 11:09:03 INFO session.SessionState: Created local directory: /tmp/dolphinscheduler/82a46c9d-de6c-45fb-ac3b-9c6bdeba6569
	23/04/20 11:09:03 INFO session.SessionState: Created HDFS directory: /tmp/hive/dolphinscheduler/82a46c9d-de6c-45fb-ac3b-9c6bdeba6569/_tmp_space.db
	Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Permission denied
		at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:582)
		at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:540)
		at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:765)
		at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:701)
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.lang.reflect.Method.invoke(Method.java:498)
		at org.apache.hadoop.util.RunJar.run(RunJar.java:313)
		at org.apache.hadoop.util.RunJar.main(RunJar.java:227)
	Caused by: java.io.IOException: Permission denied
		at java.io.UnixFileSystem.createFileExclusively(Native Method)
		at java.io.File.createTempFile(File.java:2024)
		at org.apache.hadoop.hive.common.FileUtils.createTempFile(FileUtils.java:821)
		at org.apache.hadoop.hive.ql.session.SessionState.createTempFile(SessionState.java:960)
		at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:580)
		... 9 more

二、解决方法

每一个节点执行如下操作:
touch -p /tmp/dolphinscheduler/hive.log
groupadd supergroup
usermod -a -G supergroup dolphinscheduler
sudo -u hdfs hdfs dfsadmin -refreshUserToGroupsMappings
chown -R dolphinscheduler:dolphinscheduler /tmp/dolphinscheduler


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

潘永青

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值