kafka stream(kafka流处理)
问题:
1)列转化问题(列转化行)
- user_attendees friend_id
//打开zookeeper
[root@bigdata bin]# zkServer.sh start
//启动kafka
[root@bigdata bin]# ./kafka-server-start.sh ../config/server.properties
//启动Spark
[root@bigdata ~]# cd /opt/bigdata/spark243/sbin
[root@bigdata sbin]# ./start-all.sh
//查看kafuka下面的文件名
[root@bigdata bin]# ./kafka-topics.sh --zookeeper 127.0.0.1:2181 --list
//还原kafka里面的消息队列数据
[root@bigdata bin]# ./kafka-streams-application-reset.sh --zookeeper 127.0.0.1:2181 --application-id user_friends --input-topics user
_friends
//导入maven中的kafka
<!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.12</artifactId>
<version>1.0.0</version>
</dependency>
//配置maven最低为1.8以后才可以用
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
主程序
package com.mykstream.services;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.</