1前面Mysql开启了Bin_log,canal实时的去监听然后发送到kafka的example中,现在用Spark-streaming实时的去消费将这些信息打印出来
pom依赖:
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-10_2.11</artifactId>
<version>2.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.alibaba.otter</groupId>
<artifactId>canal.client</artifactId>
<version>1.1.3</version>
</dependency>
spark-streaming代码如下
object KafkaTest {
def main(args: Array[String]): Unit = {
val conf &