【发布时间】:2015-10-05 06:22:05
【问题描述】:
我每天都在尝试在 Oozie 中运行带有配置单元操作的 shell 脚本。我在 Oozie 中取得了成功,但 shell 脚本中的配置单元部分不起作用。当我从 shell 运行脚本时,它工作正常。位于 HDFS 中的文件。 这是例外
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1422)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.<init>(RetryingMetaStoreClient.java:62)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:72)
at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2457)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2469)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:341)
... 7 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1420)
... 12 more
Caused by: MetaException(message:Could not connect to meta store using any of the URIs provided. Most recent failure: org.apache.thrift.transport.TTransportException: GSS initiate failed
at org.apache.thrift.transport.TSaslTransport.sendAndThrowMessage(TSaslTransport.java:221)
at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:297)
at org.apache.thrift.transport.TSaslClientTransport.open(TSaslClientTransport.java:37)
at org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport$1.run(TUGIAssumingTransport.java:52)
at org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport$1.run(TUGIAssumingTransport.java:49)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
这是我的脚本
S=$(hive -S -hiveconf MY_VAR1=$DB -hiveconf MY_VAR2=$avgpay -hiveconf MY_VAR3=$Date_LastDay -hiveconf MY_VAR4=$Date_LastNmonth -f hv.hql)
`mysql ...`
S1=( $( for k in $S ; do echo $k ; done ) )
cntn=${#S1[@]}
for (( p=0 ; p<$cntn; p=p+5 ))
do
`mysql ...`
done
这是工作流程
<workflow-app name="shell-wf" xmlns="uri:oozie:workflow:0.4" >
<start to="shellbpxp"/>
<action name="shellbpxp">
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<exec>netcool.sh</exec>
<file>netcool.sh#netcool.sh</file>
<file>hv.hql#hv.hql</file>
</shell>
<ok to="end" />
<error to="fail" />
</action>
<kill name="fail">
<message>Script failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name='end' />
</workflow-app>
【问题讨论】:
-
然后在 xml 中创建凭据部分我有错误 E0701 -“XML 架构错误”
-
你能登录Datanodes吗?有可能 hive-site.conf 没有被推送到数据节点,当您尝试从数据节点运行 hive shell 命令时(这是 oozie 将执行的操作),它将不起作用。将数据节点中的 hive-site.xml 与 hadoop 客户端节点上的 hive-site.xml 进行比较。我之前遇到过类似的问题,并且该错误看起来很相似。为什么不在 Oozie 中将 hive 脚本作为 Hive 操作运行?
-
因为我需要 Hive 脚本的结果来解析它并写入 mysql DB。我在 HDFS 中有 hive-site.xml,我从 /etc/hive/conf 获取它。我应该比较什么?
-
我会尝试从其中一个数据节点(通常在 /etc/hadoop/conf,但它可能在其他地方)获取 hive-site.xml,并将其与 hive-site 进行比较.xml 您放入 hdfs。当您运行 shell 任务时,它将在其中一个数据节点上运行,然后它将使用数据节点上的 hive-site.xml 副本,而不是 HDFS 中的副本。您可以通过一个 hive 步骤来实现您的目标,该步骤将查询结果保存到 hdfs,然后使用 sqoop 作业将该数据推送到 mysql。
-
我不知道怎么解决这个问题,谢谢。