apache-flink - Apache Flink 设置运算符 Uid 与 UidHash

标签 apache-flink flink-streaming

我正在使用 Apache Flink 1.2.0。根据生产准备 list ( https://ci.apache.org/projects/flink/flink-docs-release-1.2/ops/production_ready.html ),建议为运算符(operator)设置 Uid 以确保保存点的兼容性。
我找不到 flatMap 的 setUid() 方法,但我找到了 uid() 和 setUidHash() 根据文档。说

用户界面

"Sets an ID for this operator.

The specified ID is used to assign the same operator ID across job submissions (for example when starting a job from a savepoint)."

uidHash
"Sets an user provided hash for this operator. This will be used AS IS the create the JobVertexID.

The user provided hash is an alternative to the generated hashes, that is considered when identifying an operator through the default hash mechanics fails (e.g. because of changes between Flink versions)."

哪一个实际上应该在 flatMap 上设置,例如 uid() 或 setUidHash()?或两者?

最佳答案

uid()建议在这种情况下使用方法。setUidHash()应该使用 只有作为修复使用默认 uid 创建的作业而不是用户定义的作业的解决方法。它在 javadoc 中有说明:

this should be used as a workaround or for trouble shooting. The provided hash needs to be unique per transformation and job. Otherwise, job submission will fail. Furthermore, you cannot assign user-specified hash to intermediate nodes in an operator chain and trying so will let your job fail.

关于apache-flink - Apache Flink 设置运算符 Uid 与 UidHash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46112142/

相关文章:

java - 弗林克 : scala version conflict?

apache-flink - Apache 弗林克 : AWS S3 timeout exception when starting a job from a savepoint

java - 如何根据json中的特定键将一个数据流中的接收器添加到不同的路径?

apache-kafka - Apache Flink 1.4 与 Apache Kafka 1.0.0

apache-flink - 在 Flink 中,我可以在同一个槽中有一个运算符(operator)的多个子任务吗?

apache-flink - Apache 弗林克 : Merge two DataStreams with a CoFlatMapFunction

apache-flink - 弗林克 : how to store state and use in another stream?

apache-flink - flink集群启动错误[ERROR]无法正确获取JVM参数

java - Flink : Trigger. onElement 工作

redis - Flink Redis 连接器 : update getCommandDescription() after instantiation