1. 程式人生 > 實用技巧 >flink學習---初學實現wordscount

flink學習---初學實現wordscount

step1: 完成統計詞頻的flink程式碼,可以直接在我的github上下載:https://github.com/hiahia121/flink-wordscount

step2: 將程式碼打包成jar包,使用maven管理打包

涉及的打包外掛

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <
version>1.4</version> <configuration> <createDependencyReducedPom>true</createDependencyReducedPom> </configuration> <executions> <execution> <
phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.flink.main.FlinkWordCountMain</mainClass> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>reference.conf</resource> </transformer> </transformers> </configuration> </execution> </executions> </plugin>

完整的pom.xml

pom.xml

idea打包操作

執行打好的jar包,驗證包可以使用

step3: 啟動flink