wso2 bam 2.4.0配置单元脚本api管理器在mysql 5.1.73上创建表时出错(最大密钥长度)

elcex8rz  于 2021-06-02  发布在  Hadoop
关注(0)|答案(0)|浏览(279)

我已经使用mysql为wso2am\u stats\u db配置了bam。当配置单元脚本尝试创建表时,api**失败并出现此错误。你知道吗?

[2014-05-13 13:27:05,966] ERROR {org.wso2.carbon.hadoop.hive.jdbc.storage.db.DBO
peration} -  Failed to create the table API_RESPONSE_SUMMARY
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too
 long; max key length is 1000 bytes
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
        at com.mysql.jdbc.Util.getInstance(Util.java:384)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2832)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1755)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1679)

更新:脚本

CREATE EXTERNAL TABLE IF NOT EXISTS APIRequestData (key STRING,api STRING,
    api_version STRING,consumerKey STRING,userId STRING,
    context STRING,version STRING, request INT, requestTime BIGINT, resource STRING, method STRING, hostName STRING, apiPublisher STRING) STORED BY 
    'org.apache.hadoop.hive.cassandra.CassandraStorageHandler' WITH SERDEPROPERTIES ( 'wso2.carbon.datasource.name'='WSO2BAM_CASSANDRA_DATASOURCE',
    "cassandra.cf.name" = "org_wso2_apimgt_statistics_request",
    "cassandra.columns.mapping" = ":key,payload_api, payload_api_version,payload_consumerKey,payload_userId,payload_context,payload_version, payload_request, payload_requestTime, payload_resource, payload_method,payload_hostName,payload_apiPublisher" );   

CREATE EXTERNAL TABLE IF NOT EXISTS APIRequestSummaryData (api STRING, api_version STRING, version STRING, apiPublisher STRING,
    consumerKey STRING,userId STRING,context STRING, max_request_time BIGINT,
    total_request_count INT, hostName STRING,year SMALLINT,month SMALLINT,day SMALLINT, time STRING) STORED BY 
    'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES ( 'wso2.carbon.datasource.name'='WSO2AM_STATS_DB',
    'hive.jdbc.update.on.duplicate' = 'true',
    'hive.jdbc.primary.key.fields'='api,api_version,version,apiPublisher,consumerKey,userId,context,hostName,time',
    'hive.jdbc.table.create.query' = 'CREATE TABLE API_REQUEST_SUMMARY ( api VARCHAR(100), api_version VARCHAR(100), version VARCHAR(100),
    apiPublisher VARCHAR(100),consumerKey VARCHAR(100),userId VARCHAR(100), context VARCHAR(100),max_request_time BIGINT, total_request_count INT, hostName VARCHAR(100), year SMALLINT, month SMALLINT, day SMALLINT, time VARCHAR(30),PRIMARY KEY(api,api_version,apiPublisher,consumerKey,userId,context,hostName,time))' );

CREATE EXTERNAL TABLE IF NOT EXISTS APIVersionUsageSummaryData ( api STRING, version STRING, apiPublisher STRING,context STRING,total_request_count INT, hostName STRING,year SMALLINT,month SMALLINT,day SMALLINT, time STRING) STORED BY   'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES ( 'wso2.carbon.datasource.name'='WSO2AM_STATS_DB',
    'hive.jdbc.update.on.duplicate' = 'true',
    'hive.jdbc.primary.key.fields'='api,version,apiPublisher,context,hostName,time',
    'hive.jdbc.table.create.query' = 'CREATE TABLE API_VERSION_USAGE_SUMMARY ( api VARCHAR(100), version VARCHAR(100),apiPublisher VARCHAR(100),context VARCHAR(100),
    total_request_count INT,hostName VARCHAR(100), year SMALLINT, month SMALLINT, day SMALLINT, time VARCHAR(30), PRIMARY KEY(api,version,apiPublisher,context,hostName,time))' );

CREATE EXTERNAL TABLE IF NOT EXISTS APIResourcePathUsageSummaryData ( api STRING, version STRING,apiPublisher STRING,context STRING, method STRING, total_request_count INT ,hostName STRING,year SMALLINT,month SMALLINT,day SMALLINT, time STRING) STORED BY 'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES 
    ( 'wso2.carbon.datasource.name'='WSO2AM_STATS_DB',
    'hive.jdbc.update.on.duplicate' = 'true',
    'hive.jdbc.primary.key.fields'='api,version,apiPublisher,context,method,hostName,time',
    'hive.jdbc.table.create.query' = 'CREATE TABLE API_Resource_USAGE_SUMMARY ( api VARCHAR(100), version VARCHAR(100),apiPublisher VARCHAR(100),context VARCHAR(100),
    method VARCHAR(100), total_request_count INT, hostName VARCHAR(100), year SMALLINT, month SMALLINT, day SMALLINT, time VARCHAR(30), PRIMARY KEY(api,version,apiPublisher,context,method,time))' );

CREATE EXTERNAL TABLE IF NOT EXISTS APIResponseData (key STRING,
    api_version STRING,apiPublisher STRING,context STRING,serviceTime BIGINT,
    response INT,hostName STRING,responseTime BIGINT) STORED BY 
    'org.apache.hadoop.hive.cassandra.CassandraStorageHandler' WITH SERDEPROPERTIES ('wso2.carbon.datasource.name'='WSO2BAM_CASSANDRA_DATASOURCE',
    "cassandra.cf.name" = "org_wso2_apimgt_statistics_response",
    "cassandra.columns.mapping" = ":key,payload_api_version,payload_apiPublisher,payload_context,payload_serviceTime,payload_response,payload_hostName,payload_responseTime" );  

CREATE EXTERNAL TABLE IF NOT EXISTS APIResponseSummaryData (api_version STRING,apiPublisher STRING,context STRING,serviceTime INT,total_response_count INT,hostName STRING,year SMALLINT,month SMALLINT,day SMALLINT, time STRING) STORED BY 
    'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES ( 'wso2.carbon.datasource.name'='WSO2AM_STATS_DB',
    'hive.jdbc.update.on.duplicate' = 'true',
    'hive.jdbc.primary.key.fields'='api_version,apiPublisher,context,hostName,time',
    'hive.jdbc.table.create.query' = 'CREATE TABLE API_RESPONSE_SUMMARY ( api_version VARCHAR(100),apiPublisher VARCHAR(100),
    context VARCHAR(100),serviceTime INT,total_response_count INT,hostName VARCHAR(100), year SMALLINT, month SMALLINT, day SMALLINT, time VARCHAR(30), PRIMARY KEY(api_version,apiPublisher,context,hostName,time))' );

CREATE EXTERNAL TABLE IF NOT EXISTS APIFaultData (key STRING,
    api STRING,version STRING,apiPublisher STRING,context STRING, errorCode STRING,
    errorMessage STRING, requestTime STRING, hostName STRING) STORED BY 
    'org.apache.hadoop.hive.cassandra.CassandraStorageHandler' WITH SERDEPROPERTIES ( 'wso2.carbon.datasource.name'='WSO2BAM_CASSANDRA_DATASOURCE',
    "cassandra.cf.name" = "org_wso2_apimgt_statistics_fault",
    "cassandra.columns.mapping" = ":key,payload_api, payload_version,payload_apiPublisher,payload_context,payload_errorCode,payload_errorMessage,payload_requestTime,payload_hostName" ); 

CREATE EXTERNAL TABLE IF NOT EXISTS APIFaultSummaryData (api STRING, version STRING,apiPublisher STRING,context STRING, total_fault_count INT, hostName STRING, year SMALLINT,month SMALLINT,day SMALLINT, time STRING) STORED BY 
    'org.wso2.carbon.hadoop.hive.jdbc.storage.JDBCStorageHandler' TBLPROPERTIES ( 'wso2.carbon.datasource.name'='WSO2AM_STATS_DB',
    'hive.jdbc.update.on.duplicate' = 'true',
    'hive.jdbc.primary.key.fields'='api,version,apiPublisher,context,hostName,time',
    'hive.jdbc.table.create.query' = 'CREATE TABLE API_FAULT_SUMMARY ( api VARCHAR(100), version VARCHAR(100),apiPublisher VARCHAR(100),context VARCHAR(100),
    total_fault_count INT, hostName VARCHAR(100), year SMALLINT, month SMALLINT, day SMALLINT, time VARCHAR(30), PRIMARY KEY(api,version,apiPublisher,context,hostName,time))' );

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题