运行配置单元脚本“am_stats_analyzer_163”cassandra时出现WSO2 BAM错误

时间:2014-03-18 11:57:55

标签: hadoop cassandra hive wso2 wso2bam

我在2个不同的虚拟机上运行APIM和BAM,在BAM上使用外部Cassandra。

执行Hive脚本时出现 "错误。查询返回非零代码:9,原因:FAILED:执行错误,从org.apache.hadoop.hive返回代码2。执行配置单元脚本时出现ql.exec.MapRedTask" 错误(am_stats_analyzer_163)

这是完整的错误跟踪:

TID: [0] [BAM] [2014-03-18 12:34:07,948] ERROR {org.apache.hadoop.hive.ql.exec.ExecDriver} -  Ended Job = job_local_0001 with errors {org.apache.hadoop.hive.ql.exec.ExecDriver}
TID: [0] [BAM] [2014-03-18 12:34:07,950] ERROR {org.apache.hadoop.hive.ql.exec.ExecDriver} -  Error during job, obtaining debugging information... {org.apache.hadoop.hive.ql.exec.ExecDriver}
TID: [0] [BAM] [2014-03-18 12:34:08,041] ERROR {org.apache.hadoop.hive.ql.exec.Task} -  Execution failed with exit status: 2 {org.apache.hadoop.hive.ql.exec.Task}
TID: [0] [BAM] [2014-03-18 12:34:08,042] ERROR {org.apache.hadoop.hive.ql.exec.Task} -  Obtaining error information {org.apache.hadoop.hive.ql.exec.Task}
TID: [0] [BAM] [2014-03-18 12:34:08,042] ERROR {org.apache.hadoop.hive.ql.exec.Task} -
Task failed!
Task ID:
  Stage-0

Logs:
 {org.apache.hadoop.hive.ql.exec.Task}
TID: [0] [BAM] [2014-03-18 12:34:08,042] ERROR {org.apache.hadoop.hive.ql.exec.Task} -  /opt/wso2bam-2.4.0/repository/logs//wso2carbon.log {org.apache.hadoop.hive.ql.exec.Task}
TID: [0] [BAM] [2014-03-18 12:34:08,042] ERROR {org.apache.hadoop.hive.ql.exec.ExecDriver} -  Execution failed with exit status: 2 {org.apache.hadoop.hive.ql.exec.ExecDriver}
TID: [0] [BAM] [2014-03-18 12:34:08,042] ERROR {org.apache.hadoop.hive.ql.Driver} -  FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask {org.apache.hadoop.hive.ql.Driver}
TID: [0] [BAM] [2014-03-18 12:34:08,044] ERROR {org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl} -  Error while executing Hive script.
Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask {org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl}
java.sql.SQLException: Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask
    at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:189)
    at org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.executeHiveQuery(HiveExecutorServiceImpl.java:569)
    at org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.call(HiveExecutorServiceImpl.java:282)
    at org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl$ScriptCallable.call(HiveExecutorServiceImpl.java:189)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
TID: [0] [BAM] [2014-03-18 12:34:08,044] ERROR {org.wso2.carbon.analytics.hive.task.HiveScriptExecutorTask} -  Error while executing script : am_stats_analyzer_163 {org.wso2.carbon.analytics.hive.task.HiveScriptExecutorTask}
org.wso2.carbon.analytics.hive.exception.HiveExecutionException: Error while executing Hive script.Query returned non-zero code: 9, cause: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask
org.wso2.carbon.analytics.hive.impl.HiveExecutorServiceImpl.execute(HiveExecutorServiceImpl.java:115)
org.wso2.carbon.analytics.hive.task.HiveScriptExecutorTask.execute(HiveScriptExecutorTask.java:60)
    at     org.wso2.carbon.ntask.core.impl.TaskQuartzJobAdapter.execute(TaskQuartzJobAdapter.java:67)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)    

我用于cassandra的用户名​​和密码是默认的(admin / admin),它们在 [BAM_HOME] /repository/conf/etc/cassandra-auth.xml 和 [BAM_HOME] /repository/conf/datasources/master-datasources.xml

你知道这可能是什么问题吗?

永恒的MySQL数据源配置:

<datasource>
            <name>WSO2AM_STATS_DB</name>
            <description>The datasource used for getting statistics to API Manager</description>
            <jndiConfig>
            <name>jdbc/WSO2AM_STATS_DB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:mysql://GCEP-IDS:3306/APIMGTSTATS_DB</url>
                <username>ldapadmin</username>
                <password>ldapadmin</password>
                <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <minIdle>5</minIdle>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
     </datasource>

api-manager.xml 配置:

 <Enabled>true</Enabled>
    <PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass>
    <ThriftPort>7611</ThriftPort>

    <BAMServerURL>tcp://135.238.115.232:7611</BAMServerURL>
    <BAMUsername>admin</BAMUsername>
    <BAMPassword>admin</BAMPassword>
    <DataSourceName>jdbc/WSO2AM_STATS_DB</DataSourceName>

这些表也是在MySQL DB中创建的:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| APIMGTSTATS_DB     |
| mysql              |
| regdb              |
| test               |
+--------------------+
5 rows in set (0.02 sec)

mysql> use APIMGTSTATS_DB
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+---------------------------+
| Tables_in_APIMGTSTATS_DB  |
+---------------------------+
| API_REQUEST_SUMMARY       |
| API_RESPONSE_SUMMARY      |
| API_VERSION_USAGE_SUMMARY |
+---------------------------+
3 rows in set (0.00 sec)

mysql> select * from API_REQUEST_SUMMARY;
Empty set (0.00 sec)

mysql> select * from API_RESPONSE_SUMMARY;
Empty set (0.00 sec)

mysql> select * from API_VERSION_USAGE_SUMMARY;
Empty set (0.00 sec)

mysql> \q
Bye
[root@GCEP-IDS ~]#

3 个答案:

答案 0 :(得分:0)

请确保您已使用正确的BAMServerURL和ThriftPort配置api-manager.xml,该文件位于/repository/conf/api-manager.xml

<!-- Enable/Disable the API usage tracker. -->
<Enabled>true</Enabled>  
    <PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass>
    <ThriftPort>7612</ThriftPort>
    <BAMServerURL>tcp://localhost:7612/</BAMServerURL>
    <BAMUsername>admin</BAMUsername>
    <BAMPassword>admin</BAMPassword>
    <!-- JNDI name of the data source to be used for getting BAM statistics. This data source should
        be defined in the master-datasources.xml file in conf/datasources directory. -->
    <DataSourceName>jdbc/WSO2AM_STATS_DB</DataSourceName>

</APIUsageTracking>

答案 1 :(得分:0)

由于SQL异常,似乎与RDBMS相关的Hive查询有问题。请在重新检查Hive脚本是否在“insert overwrite ...”查询被删除时运行。如果是这种情况,请重新检查该部分脚本。在重新执行查询之前,手动删除RDBMS表(例如,使用H2数据库客户端)并在Hive脚本之上添加“drop table ...”之类的查询来清理RDBMS包装的Hive表。

答案 2 :(得分:0)

在data-bridge-config.xml中尝试将hostName设置为0.0.0.0:

<thriftDataReceiver>
    <hostName>0.0.0.0</hostName>
        <port>7611</port>
        <securePort>7711</securePort>
</thriftDataReceiver>

并在cassandra.yaml中设置rpc_address:0.0.0.0。

错误与错误的主机/端口有关。