赞
踩
2.选择整合或者不整合hadoop的版本
3. 下载
上传下载的压缩包到虚拟机,并解压
在解压目录下面bin/ 执行命令 ./start-cluster.sh 即可, 同理停止集群 ./stop-cluster.sh
web页面查看 *****:8081
提交任务
<!-- pom依赖 --> <dependencies> <dependency> <groupId>org.apache.flink</groupId> <artifactId>flink-scala_2.11</artifactId> <version>1.7.2</version> </dependency> <dependency> <groupId>org.apache.flink</groupId> <artifactId>flink-streaming-scala_2.11</artifactId> <version>1.7.2</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.11.12</version> </dependency> <dependency> <groupId>org.scala-lang.modules</groupId> <artifactId>scala-xml_2.11</artifactId> <version>1.0.1</version> </dependency> <!--entity--> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.8</version> <scope>provided</scope> </dependency> </dependencies> /** * 代码 * 将项目打包 上传即可。 */ object StreamWC { def main(args: Array[String]): Unit = { val environment = StreamExecutionEnvironment.getExecutionEnvironment val words = environment.socketTextStream("localhost", 7777) val unit = words.flatMap(_.split("\t")) .map((_, 1)) .keyBy(0) unit.print() // 设置并行度 environment.setParallelism(2) environment.execute("test stream flink") } }
org.apache.flink.runtime.jobmanager.scheduler.NoResourceAvailableException: Could not allocate all requires slots within timeout of 300000 ms. Slots required: 9, slots allocated: 2
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。