spring-cloud-data-flow on docker-compose,初探

项目官网

实验环境

软件 版本
spring-cloud-data-flow 2.0.1.RELEASE
docker-compose 1.23.2

搭建过程

下载其docker-compose.yml文件

wget https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/v2.0.1.RELEASE/spring-cloud-dataflow-server/docker-compose.yml

然后在这个文件所在目录,启动

DATAFLOW_VERSION=2.0.1.RELEASE SKIPPER_VERSION=2.0.0.RELEASE docker-compose up

访问web-ui首页
发现app为空

spring-cloud-data-flow on docker-compose,初探_第1张图片
安装后发现app为空

查看日志,见

dataflow-server    | java.lang.RuntimeException: Error reading from URL [http://bit.ly/Einstein-GA-stream-applications-kafka-maven]
dataflow-server    |    at org.springframework.cloud.dataflow.registry.service.DefaultAppRegistryService.loadProperties(DefaultAppRegistryService.java:284)
略
dataflow-server    | Caused by: java.net.SocketException: Connection reset
dataflow-server    |    at java.net.SocketInputStream.read(SocketInputStream.java:210)
略

dataflow-server    | java.lang.RuntimeException: Error reading from URL [http://bit.ly/Dearborn-SR1-task-applications-maven]
dataflow-server    |    at org.springframework.cloud.dataflow.registry.service.DefaultAppRegistryService.loadProperties(DefaultAppRegistryService.java:284)
略
dataflow-server    | Caused by: java.net.SocketException: Connection reset
dataflow-server    |    at java.net.SocketInputStream.read(SocketInputStream.java:210)
略

想法下载到这两个文件,通过Add Application(s)按钮,导入这两个文件。

spring-cloud-data-flow on docker-compose,初探_第2张图片
添加app界面

较大文件会导入失败,见日志

dataflow-server    | 2019-03-28 09:45:11.379  INFO 1 --- [nio-9393-exec-2] o.apache.coyote.http11.Http11Processor   : Error parsing HTTP request header
dataflow-server    |  Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
dataflow-server    | 
dataflow-server    | java.lang.IllegalArgumentException: Request header is too large
dataflow-server    |    at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:718)

将大文件截开,分多次导入即可


spring-cloud-data-flow on docker-compose,初探_第3张图片
手工导入app后的界面

一个小例子

项目首页中给出了一个每秒打印时间的例子

time | log

在名为dataflow-server容器中tail日志可看到效果

另有一个带tap的例子
在reference文档tap示例

http | step1: transform --expression=payload.toUpperCase() | step2: transform --expression=payload+'!' | log

这个写法会报错,看执行docker-compose up处的日志

dataflow-server    | 2018-12-22 14:11:41.763  WARN 1 --- [io-9393-exec-10] o.s.c.d.s.c.RestControllerAdvice         : Caught exception while handling a request: 100E:(pos 99): Found unexpected data after stream definition: ''!''
dataflow-server    | http | step1: transform --expression=payload.toUpperCase() | step2: transform --expression=payload '!' | log
dataflow-server    |                                                                                                   *^
dataflow-server    |
dataflow-server    | 2018-12-22 14:11:41.764  WARN 1 --- [io-9393-exec-10] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.cloud.dataflow.server.controller.support.InvalidStreamDefinitionException: 100E:(pos 99): Found unexpected data after stream definition: ''!''
dataflow-server    | http | step1: transform --expression=payload.toUpperCase() | step2: transform --expression=payload '!' | log
dataflow-server    |                                                                                                   *^
dataflow-server    | ]

可知报错原因,于是把step2payload+'!'换为payload.concat("!")

http | step1: transform --expression=payload.toUpperCase() | step2: transform --expression=payload.concat("!!") | log

如果用curl发送信息需要指定Content-Type:application/json,否则报错

curl -v -d 'hello world' -H "Content-Type:application/json" http://172.19.0.5:46215

同样,可在名为dataflow-server的容器中看到日志

你可能感兴趣的:(spring-cloud-data-flow on docker-compose,初探)