Closed ZhiYinZhang closed 4 years ago
请按如下步骤检查一下:
我也写了数据到表里面,表里也有数据。程序batch也会触发,说明能监听到事件的发生,但是就是没有数据 mysql>show master status; +------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+-------------------+ | binlog.000002 | 10603 | | | | +------------------+----------+--------------+------------------+-------------------+ val df = spark.readStream .format("org.apache.spark.sql.mlsql.sources.MLSQLBinLogDataSource") .option("host","localhost") .option("port","3306") .option("userName","root") .option("password","123456") .option("databaseNamePattern","test") .option("tableNamePattern","test1") .option("binlogIndex", "2") .option("binlogFileOffset", "10603") .option("bingLogNamePrefix","binlog") .load() df.writeStream.format("console").outputMode("append").start().awaitTermination()
+-----+ |value| +-----+ +-----+
+-----+ |value| +-----+ +-----+
Spark Structured streaming 会打印每个周期的一些明细,比如处理了几条数据等等,你能把这个也贴出来么?
每个batch的numInputRows都为0,
这两个参数我都配置了,而且我单独使用下面这个包去监听binlog是可以读到各类事件的数据的
这是我的代码: val df = spark.readStream .format("org.apache.spark.sql.mlsql.sources.MLSQLBinLogDataSource") .option("host","localhost") .option("port","3306") .option("userName","root") .option("password","123456") .option("databaseNamePattern","test") .option("tableNamePattern","test1") .option("binlogIndex", "2") .option("binlogFileOffset", "4") .option("bingLogNamePrefix","binlog") .load() df.writeStream.format("console").outputMode("append").start().awaitTermination()
输出:
Batch: 0
+-----+ |value| +-----+ +-----+
Batch: 1
+-----+ |value| +-----+ +-----+
Batch: 2
+-----+ |value| +-----+ +-----+