Flink数仓项目常见问题总结
一、开发中的常见bug
1、OutputTag的对象新建问题缺少花括号
Exception in thread "main" org.apache.flink.api.common.functions.InvalidTypesException: Could not determine TypeInformation for the OutputTag type. The most common reason is forgetting to make the OutputTag an anonymous inner class. It is also not possible to use generic type variables with OutputTags, such as 'Tuple2<A, B>'.
问题原因:类型擦除问题
因为flink要识别侧输出的数据类型。这是实现成了匿名内部类,泛型里就带类型了,flink就能够推测出你要输出的是什么数据类型。
OutputTag<String> startTag = new OutputTag<String>("startTag"){};
OutputTag<String> startTag = new OutputTag<String>("startTag");
解决方案:
记得新建对象时加花括号OutputTag<String> startTag = new OutputTag<String>("startTag"){};
2、maxwell启动失败!!!
原因:在MySQL中增加新的数据库时gmall0106_config ,如果之前已经初始化过Binlog,会导致maxwell的配置表中找不到 gmall0106_config的元数据信息,导致启动失败
解决方案:
删除maxwell的元数据信息,重启maxwell.
3、ERROR (com.alibaba.druid.pool.DruidDataSource:init) - init datasource error, url: jdbc:phoenix:hadoop102,hadoop103,hadoop104:2181
java.sql.SQLException: ERROR 726 (43M10): Inconsistent namespace mapping properties. Cannot initiate connection as SYSTEM:CATALOG is found but client does not have phoenix.schema.isNamespaceMappingEnabled enabled
错误原因:hbase服务器的namespace和phoenix客户端(idea)的schema没有实现映射
解决方案: <configuration>
<!-- 注意:为了开启hbase的namespace和phoenix的schema的映射,在程序中需要加这个配置文件,另外在linux服务上,也需要在hbase以及phoenix的hbase-site.xml配置文件中,加上以上两个配置,并使用xsync进行同步-->
<property>
<name>phoenix.schema.isNamespaceMappingEnabled</name>
<value>true</value>
</property>
<property>
<name>phoenix.schema.mapSystemTablesToNamespace</name>
<value>true</value>
</property>
</configuration>
注:phoenix客户端(cmd)客户端配置文件也需要添加以上两个配置
3、Exception in thread "main" org.apache.flink.table.api.TableException: Could not instantiate the executor. Make sure a planner module is on the classpath
原因:执行flinkSQL时,缺少配置信息
解决方案两种:
1)添加黄色配置信息StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env, EnvironmentSettings.newInstance().useAnyPlanner().build());
2)添加必要依赖
dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.version}</artifactId>
<version>${flink.version}</version>
</dependency>
标签:OutputTag,数仓,常见问题,startTag,phoenix,maxwell,flink,version,Flink From: https://www.cnblogs.com/xie-pf/p/16632444.html