DTStack / DTStack/chunjun

local 环境 metricPluginConf 配置 chunjun 指标至mysql 找不到database

Open
#1,453 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
4.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### Search before asking

- [ ] I had searched in the [issues](https://github.com/DTStack/chunjun/issues) and found no similar question.

- [ ] I had googled my question but i didn't get any help.

- [ ] I had read the documentation: [ChunJun doc](https://dtstack.github.io/chunjun) but it didn't help me.

### Description

ERROR [Legacy Source Thread - Source: mysqlsourcefactory -> Sink: mysqlsinkfactory (1/1)#0] com.dtstack.chunjun.source.DtInputFormatSourceFunction:Exception happened, start to close format
java.lang.RuntimeException: Unknown database 'null'
at com.dtstack.chunjun.metrics.rdb.RdbReporter.createTableIfNotExist(RdbReporter.java:111)
at com.dtstack.chunjun.metrics.rdb.RdbReporter.open(RdbReporter.java:177)
at com.dtstack.chunjun.source.format.BaseRichInputFormat.openInputFormat(BaseRichInputFormat.java:185)
at com.dtstack.chunjun.source.DtInputFormatSourceFunction.run(DtInputFormatSourceFunction.java:121)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:110)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:66)
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:267)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'null'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2482)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2440)
at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:845)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:745)
at com.dtstack.chunjun.metrics.rdb.RdbReporter.createTableIfNotExist(RdbReporter.java:107)
配置如下
`{
"job":{
"content":[
{
"reader":{
"name":"mysqlreader",
"parameter":{
"column":[
"id",
"user_name",
"id_card",
"create_time"
],
"customSql":"",
"where":"",
"increColumn":"id",
"polling":true,
"pollingInterval":2000,
"queryTimeOut":3000,
"username":"root",
"password":"root",
"connection":[
{
"jdbcUrl":[
"jdbc:mysql://localhost:3306/data?useUnicode=true&characterEncoding=UTF-8&useSSL=false"
],
"table":[
"ods_user_info"
]
}
]
}
},
"writer":{
"name":"mysqlwriter",
"parameter":{
"username":"root",
"password":"root",
"connection":[
{
"jdbcUrl":"jdbc:mysql://localhost:3306/data?useUnicode=true&characterEncoding=UTF-8&useSSL=false",
"table":[
"ods_user_info_copy1"
]
}
],
"writeMode":"replace",
"flushIntervalMills":"3000",
"column":[
"id",
"user_name",
"id_card",
"update_time"
]
}
}
}
],
"setting":{
"restore":{
"isStream":true,
"isRestore":true,
"restoreColumnName":"id",
"restoreColumnIndex":0
},
"speed":{
"channel":1,
"bytes":0
},
"log":{
"isLogger":true,
"level":"info",
"path":"/Users/gaoxiang/app/chunjun/logs",
"pattern":""
},
"metricPluginConf" : {
"pluginName": "mysql",
"pluginProp": {
"jdbcUrl":"jdbc:mysql://localhost:3306/data?useUnicode=true&characterEncoding=UTF-8&useSSL=false",
"database":"data",
"table":"chunjun",
"username":"root",
"password":"root"
}
}
}
}
}`

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.