目录
1、Kylin在JDBC 数据源模式下执行CUBE build
报hive用户无权限错误及解决办法
报错:
ERROR : FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.security.AccessControlException: Permission denied: user=hive, access=WRITE, inode="/kylin/kylin_metadata/kylin-d8758305-c631-b9c6-8fc3-6d0ea392a91b/kylin_intermediate_tidbtestcube_7a841e72_b435_616e_ca30_0bc0ff8d526b":hdfs:hdfs:drwxr-xr-x
可以看到最主要的信息是:
Permission denied: user=hive, access=WRITE, inode="/kylin/kylin_metadata/
这是由于hive用户没有权限导致,我们先看下HDFS目录/kylin/kylin_metadata/
下用户权限:
hadoop fs -ls /kylin/kylin_metadata
显示如下:
drwxrwxrwx - hdfs hdfs 0 2021-01-04 16:45 /kylin/kylin_metadata/
解决办法:
方法1、通过上面的方法,看到只有hdfs用户有权限,通过如下方法给hive用户授权:
su hdfs
# hdfs dfs -mkdir /kylin/kylin_metadata #这一句不用执行,因为已经有该目录了
hdfs dfs -chown -R hive:hdfs /kylin/kylin_metadata #把该目录下所有目录授权给hive用户即可
exit
方法2、一步到位,这个错误是因为hive没有hdfs用户的权限,我们把hive加入到hdfs组即可。
- 先查看hdfs用户id信息,可以看到用户id、组id
# id hdfs
uid=1008(hdfs) gid=1003(hadoop) groups=1003(hadoop),1002(hdfs)
- 再查看hive用户id信息,可以看到用户id、组id
# id hive
uid=1000(hive) gid=1003(hadoop) groups=1003(hadoop)
可以看到hive用户不在hdfs组里,把它加入hdfs组即可
通过usermod -G supergroup user1
将用户(已存在的)添加到这个组中
(在所有节点中运行)
usermod -G hdfs hive
2、does not exist! HCatalog jobs will fail.
java.io.IOException: OS command error exit with return code: 1, error message: Warning: /usr/hdp/3.0.1.0-187/hive-hcatalog/ does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
出现这个问题我们的第一反应就是这个目录不存在肯定是去建这个目录。但是其实不然我们只要建下面的目录,然后在脚本中引入上面的报错的这个环境变量就可以正常的运行:
解决办法:
mkdir /var/lib/accumulo
export ACCUMULO_HOME=/var/lib/accumulo
3、ERROR tool.ImportTool: Output directory hdfs XXX already exists
21/01/27 10:06:27 ERROR tool.ImportTool: Import failed: org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://xxxxxx:8020/kylin/kylin_metadata/kylin-e7803054-e303-643c-8c74-d765aa802af4/kylin_intermediate_ttestcube01_6750244c_e6a7_5f9b_5b4c_46d2180e806f already exists
at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:164)
at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:277)
at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:143)
at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1570)
at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1567)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1730)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1567)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1588)
at org.apache.sqoop.mapreduce.ImportJobBase.doSubmitJob(ImportJobBase.java:196)
at org.apache.sqoop.mapreduce.ImportJobBase.runJob(ImportJobBase.java:169)
at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:266)
at org.apache.sqoop.manager.SqlManager.importQuery(SqlManager.java:748)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:543)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:656)
at org.apache.sqoop.Sqoop.run(Sqoop.java:150)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:186)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:240)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:249)
at org.apache.sqoop.Sqoop.main(Sqoop.java:258)
删除该文件即可:
hadoop fs -rm -r /kylin/kylin_metadata/kylin-e7803054-e303-643c-8c74-d765aa802af4/kylin_intermediate_ttestcube01_6750244c_e6a7_5f9b_5b4c_46d2180e806f
4、kylin 创建model时能正常加载JDBC表,build时报链接错误
build时报错如下:
Error when connect to JDBC source jdbc:mysql://IP:端口/数据库
检查kylin_properties时,连接字符串如下:
kylin.source.default=8
kylin.source.jdbc.connection-url=jdbc:mysql://XXXX:端口/数据库
kylin.source.jdbc.driver=com.mysql.jdbc.Driver
kylin.source.jdbc.dialect=mysql
kylin.source.jdbc.user=用户名
kylin.source.jdbc.pass=密码
kylin.source.jdbc.sqoop-home=/usr/hdp/current/sqoop-client
kylin.source.jdbc.filed-delimiter=|
kylin.source.jdbc.sqoop-mapper-num=4
发现kylin.source.jdbc.dialect=mysql
是mysql
,把它改为default
后重启kylin就可以build了。
正确的配置应该如下:
kylin.source.default=8
kylin.source.jdbc.connection-url=jdbc:mysql://XXXX:端口/数据库
kylin.source.jdbc.driver=com.mysql.jdbc.Driver
kylin.source.jdbc.dialect=default
kylin.source.jdbc.user=用户名
kylin.source.jdbc.pass=密码
kylin.source.jdbc.sqoop-home=/usr/hdp/current/sqoop-client
kylin.source.jdbc.filed-delimiter=|
kylin.source.jdbc.sqoop-mapper-num=4
5、error message: /bin/bash: /usr/hdp/current/sqoop-client/bin/bin/sqoop: No such file or directory
发现路径中多了一个bin
,把kylin_properties
配置文件中的kylin.source.jdbc.sqoop-home=/usr/hdp/current/sqoop-clientin
改为kylin.source.jdbc.sqoop-home=/usr/hdp/current/sqoop-client
重新启动kylin即可。